From e04f167dcebc93ced95caeb2fd08d78075204efc Mon Sep 17 00:00:00 2001 From: jsing <> Date: Wed, 11 Oct 2017 17:35:53 +0000 Subject: Update regress now that ssl_cipher_list_to_bytes() takes a CBB. Based on a diff from doug@ --- src/regress/lib/libssl/unit/cipher_list.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/regress/lib/libssl/unit/cipher_list.c b/src/regress/lib/libssl/unit/cipher_list.c index 7a7ca37708..e19acaa3ea 100644 --- a/src/regress/lib/libssl/unit/cipher_list.c +++ b/src/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 * Copyright (c) 2015 Joel Sing @@ -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); -- cgit v1.2.3-55-g6feb