diff options
author | Matt Caswell <matt@openssl.org> | 2016-10-19 14:39:39 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-11-04 12:09:46 +0000 |
commit | 153703dfde6bf3f1cf72576a19d0f2fabe61a826 (patch) | |
tree | 4e8ffd2fd7e5a0d222df929f5e13634a38c130f5 /ssl/packet_locl.h | |
parent | 8051ab2b6f8e1fb9e957771afcc3555560f9694f (diff) | |
download | openssl-153703dfde6bf3f1cf72576a19d0f2fabe61a826.zip openssl-153703dfde6bf3f1cf72576a19d0f2fabe61a826.tar.gz openssl-153703dfde6bf3f1cf72576a19d0f2fabe61a826.tar.bz2 |
Add some PACKET functions for size_t
And use them in the DTLS code
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'ssl/packet_locl.h')
-rw-r--r-- | ssl/packet_locl.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/ssl/packet_locl.h b/ssl/packet_locl.h index cee1400..ec31a33 100644 --- a/ssl/packet_locl.h +++ b/ssl/packet_locl.h @@ -160,6 +160,19 @@ __owur static ossl_inline int PACKET_get_net_2(PACKET *pkt, unsigned int *data) return 1; } +/* Same as PACKET_get_net_2() but for a size_t */ +__owur static ossl_inline int PACKET_get_net_2_len(PACKET *pkt, size_t *data) +{ + unsigned int i; + int ret; + + ret = PACKET_get_net_2(pkt, &i); + if (ret) + *data = (size_t)i; + + return ret; +} + /* * Peek ahead at 3 bytes in network order from |pkt| and store the value in * |*data| @@ -189,6 +202,19 @@ __owur static ossl_inline int PACKET_get_net_3(PACKET *pkt, unsigned long *data) return 1; } +/* Same as PACKET_get_net_3() but for a size_t */ +__owur static ossl_inline int PACKET_get_net_3_len(PACKET *pkt, size_t *data) +{ + unsigned long i; + int ret; + + ret = PACKET_get_net_3(pkt, &i); + if (ret) + *data = (size_t)i; + + return ret; +} + /* * Peek ahead at 4 bytes in network order from |pkt| and store the value in * |*data| @@ -219,6 +245,19 @@ __owur static ossl_inline int PACKET_get_net_4(PACKET *pkt, unsigned long *data) return 1; } +/* Same as PACKET_get_net_4() but for a size_t */ +__owur static ossl_inline int PACKET_get_net_4_len(PACKET *pkt, size_t *data) +{ + unsigned long i; + int ret; + + ret = PACKET_get_net_4(pkt, &i); + if (ret) + *data = (size_t)i; + + return ret; +} + /* Peek ahead at 1 byte from |pkt| and store the value in |*data| */ __owur static ossl_inline int PACKET_peek_1(const PACKET *pkt, unsigned int *data) @@ -242,6 +281,19 @@ __owur static ossl_inline int PACKET_get_1(PACKET *pkt, unsigned int *data) return 1; } +/* Same as PACKET_get_1() but for a size_t */ +__owur static ossl_inline int PACKET_get_1_len(PACKET *pkt, size_t *data) +{ + unsigned int i; + int ret; + + ret = PACKET_get_1(pkt, &i); + if (ret) + *data = (size_t)i; + + return ret; +} + /* * Peek ahead at 4 bytes in reverse network order from |pkt| and store the value * in |*data| |