diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2017-10-11 17:35:54 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2017-10-11 17:35:54 +0000 |
commit | 3832446e8e775bd51871b138f632274c681ada9d (patch) | |
tree | 9bf41ac4d05c96a4eb37d4aae807a24e9377951f /regress/lib | |
parent | b0cd2fc7db02605b17c2e4e3ad5a7660203cbf64 (diff) |
Update regress now that ssl_cipher_list_to_bytes() takes a CBB.
Based on a diff from doug@
Diffstat (limited to 'regress/lib')
-rw-r--r-- | regress/lib/libssl/unit/cipher_list.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/regress/lib/libssl/unit/cipher_list.c b/regress/lib/libssl/unit/cipher_list.c index 7a7ca377081..e19acaa3ead 100644 --- a/regress/lib/libssl/unit/cipher_list.c +++ b/regress/lib/libssl/unit/cipher_list.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cipher_list.c,v 1.7 2017/10/10 16:52:17 jsing Exp $ */ +/* $OpenBSD: cipher_list.c,v 1.8 2017/10/11 17:35:53 jsing Exp $ */ /* * Copyright (c) 2015 Doug Hogan <doug@openbsd.org> * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> @@ -89,6 +89,7 @@ ssl_bytes_to_list_alloc(SSL *s, STACK_OF(SSL_CIPHER) **ciphers) static int ssl_list_to_bytes_scsv(SSL *s, STACK_OF(SSL_CIPHER) **ciphers) { + CBB cbb; unsigned char *buf = NULL; size_t buflen, outlen; int ret = 0; @@ -98,7 +99,9 @@ ssl_list_to_bytes_scsv(SSL *s, STACK_OF(SSL_CIPHER) **ciphers) buflen = sizeof(cipher_bytes) + 2 + 2; CHECK((buf = calloc(1, buflen)) != NULL); - CHECK(ssl_cipher_list_to_bytes(s, *ciphers, buf, buflen, &outlen)); + CHECK(CBB_init_fixed(&cbb, buf, buflen)); + CHECK(ssl_cipher_list_to_bytes(s, *ciphers, &cbb)); + CHECK(CBB_finish(&cbb, NULL, &outlen)); CHECK_GOTO(outlen > 0 && outlen == buflen - 2); CHECK_GOTO(memcmp(buf, cipher_bytes, sizeof(cipher_bytes)) == 0); @@ -115,6 +118,7 @@ err: static int ssl_list_to_bytes_no_scsv(SSL *s, STACK_OF(SSL_CIPHER) **ciphers) { + CBB cbb; unsigned char *buf = NULL; size_t buflen, outlen; int ret = 0; @@ -129,7 +133,9 @@ ssl_list_to_bytes_no_scsv(SSL *s, STACK_OF(SSL_CIPHER) **ciphers) /* Set renegotiate so it doesn't add SCSV */ s->internal->renegotiate = 1; - CHECK(ssl_cipher_list_to_bytes(s, *ciphers, buf, buflen, &outlen)); + CHECK(CBB_init_fixed(&cbb, buf, buflen)); + CHECK(ssl_cipher_list_to_bytes(s, *ciphers, &cbb)); + CHECK(CBB_finish(&cbb, NULL, &outlen)); CHECK_GOTO(outlen > 0 && outlen == buflen - 2); CHECK_GOTO(memcmp(buf, cipher_bytes, sizeof(cipher_bytes)) == 0); |