diff options
author | Matt Caswell <matt@openssl.org> | 2016-09-13 11:32:52 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-09-14 00:02:34 +0100 |
commit | b2b3024e0eef58589f7a49ebd48da98d4564a348 (patch) | |
tree | 579578a6ae0230d93b2817e23a18e6aa3bc97f22 /test | |
parent | f1ec23c0bcc8ebb40331120b87a0e99f6823da67 (diff) | |
download | openssl-b2b3024e0eef58589f7a49ebd48da98d4564a348.zip openssl-b2b3024e0eef58589f7a49ebd48da98d4564a348.tar.gz openssl-b2b3024e0eef58589f7a49ebd48da98d4564a348.tar.bz2 |
Add a WPACKET_sub_allocate_bytes() function
Updated the construction code to use the new function. Also added some
convenience macros for WPACKET_sub_memcpy().
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/wpackettest.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/wpackettest.c b/test/wpackettest.c index ca2a1a7..c2e194e 100644 --- a/test/wpackettest.c +++ b/test/wpackettest.c @@ -325,6 +325,22 @@ static int test_WPACKET_allocate_bytes(void) return 0; } + /* Repeat with WPACKET_sub_allocate_bytes */ + if ( !WPACKET_init_len(&pkt, buf, 1) + || !WPACKET_sub_allocate_bytes(&pkt, 2, &bytes, 1)) { + testfail("test_WPACKET_allocate_bytes():3 failed\n", &pkt); + return 0; + } + bytes[0] = 0xfe; + bytes[1] = 0xff; + if ( !WPACKET_finish(&pkt) + || !WPACKET_get_total_written(&pkt, &written) + || written != sizeof(submem) + || memcmp(buf->data, &submem, written) != 0) { + testfail("test_WPACKET_allocate_bytes():4 failed\n", &pkt); + return 0; + } + return 1; } |