diff options
author | Matt Caswell <matt@openssl.org> | 2016-09-06 15:19:32 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-09-13 09:41:21 +0100 |
commit | fb790f1673884f4a9db9118e93714650f92eed66 (patch) | |
tree | 62cbf4e69c4ee3a06ce55e82d67f5fca16e9dcf9 /ssl/packet.c | |
parent | 0217dd19c00657b8bfd2bce1090785eb32abb235 (diff) |
Add WPACKET_sub_memcpy() function
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'ssl/packet.c')
-rw-r--r-- | ssl/packet.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ssl/packet.c b/ssl/packet.c index d4f964922d..db301a47f6 100644 --- a/ssl/packet.c +++ b/ssl/packet.c @@ -301,6 +301,20 @@ int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) } /* + * Copy |len| bytes of data from |*src| into the WPACKET and prefix with its + * length (consuming |lenbytes| of data for the length) + */ +int WPACKET_sub_memcpy(WPACKET *pkt, const void *src, size_t len, size_t lenbytes) +{ + if (!WPACKET_start_sub_packet_len(pkt, lenbytes) + || !WPACKET_memcpy(pkt, src, len) + || !WPACKET_close(pkt)) + return 0; + + return 1; +} + +/* * Return the total number of bytes written so far to the underlying buffer. * This might includes bytes written by a parent WPACKET. */ |