mirror of
https://github.com/openssl/openssl.git
synced 2024-11-21 01:15:20 +08:00
Fix a few style nits in the wpacket code
Addressing more feedback comments. Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
parent
df065a2b3b
commit
c0f9e23c6b
11
ssl/packet.c
11
ssl/packet.c
@ -34,8 +34,8 @@ int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
|
||||
if (BUF_MEM_grow(pkt->buf, newlen) == 0)
|
||||
return 0;
|
||||
}
|
||||
pkt->written += len;
|
||||
*allocbytes = (unsigned char *)pkt->buf->data + pkt->curr;
|
||||
pkt->written += len;
|
||||
pkt->curr += len;
|
||||
|
||||
return 1;
|
||||
@ -100,10 +100,10 @@ int WPACKET_set_flags(WPACKET *pkt, unsigned int flags)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Store the |value| of length |size| at location |data| */
|
||||
static int put_value(unsigned char *data, size_t value, size_t size)
|
||||
/* Store the |value| of length |len| at location |data| */
|
||||
static int put_value(unsigned char *data, size_t value, size_t len)
|
||||
{
|
||||
for (data += size - 1; size > 0; size--) {
|
||||
for (data += len - 1; len > 0; len--) {
|
||||
*data = (unsigned char)(value & 0xff);
|
||||
data--;
|
||||
value >>= 8;
|
||||
@ -127,7 +127,7 @@ static int wpacket_intern_close(WPACKET *pkt)
|
||||
size_t packlen = pkt->written - sub->pwritten;
|
||||
|
||||
if (packlen == 0
|
||||
&& sub->flags & WPACKET_FLAGS_NON_ZERO_LENGTH)
|
||||
&& (sub->flags & WPACKET_FLAGS_NON_ZERO_LENGTH) != 0)
|
||||
return 0;
|
||||
|
||||
if (packlen == 0
|
||||
@ -229,6 +229,7 @@ int WPACKET_put_bytes(WPACKET *pkt, unsigned int val, size_t size)
|
||||
|
||||
/* Internal API, so should not fail */
|
||||
assert(size <= sizeof(unsigned int));
|
||||
|
||||
if (size > sizeof(unsigned int)
|
||||
|| !WPACKET_allocate_bytes(pkt, size, &data)
|
||||
|| !put_value(data, val, size))
|
||||
|
@ -1228,7 +1228,6 @@ int dtls1_close_construct_packet(SSL *s, WPACKET *pkt)
|
||||
s->init_off = 0;
|
||||
|
||||
/* Buffer the message to handle re-xmits */
|
||||
|
||||
if (!dtls1_buffer_message(s, 0))
|
||||
return 0;
|
||||
|
||||
|
@ -3331,6 +3331,7 @@ int tls12_copy_sigalgs(SSL *s, WPACKET *pkt,
|
||||
const unsigned char *psig, size_t psiglen)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < psiglen; i += 2, psig += 2) {
|
||||
if (tls12_sigalg_allowed(s, SSL_SECOP_SIGALG_SUPPORTED, psig)) {
|
||||
if (!WPACKET_put_bytes(pkt, psig[0], 1)
|
||||
|
Loading…
Reference in New Issue
Block a user