summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2017-10-11 17:35:53 +0000
committerjsing <>2017-10-11 17:35:53 +0000
commite04f167dcebc93ced95caeb2fd08d78075204efc (patch)
treeced872639f413465005a064e45bc8e0a0a95c34c
parent4b096d9251fbf4f46e597bb2ac44a0829138544f (diff)
downloadopenbsd-e04f167dcebc93ced95caeb2fd08d78075204efc.tar.gz
openbsd-e04f167dcebc93ced95caeb2fd08d78075204efc.tar.bz2
openbsd-e04f167dcebc93ced95caeb2fd08d78075204efc.zip
Update regress now that ssl_cipher_list_to_bytes() takes a CBB.
Based on a diff from doug@
-rw-r--r--src/regress/lib/libssl/unit/cipher_list.c12
1 files changed, 9 insertions, 3 deletions
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 @@
1/* $OpenBSD: cipher_list.c,v 1.7 2017/10/10 16:52:17 jsing Exp $ */ 1/* $OpenBSD: cipher_list.c,v 1.8 2017/10/11 17:35:53 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2015 Doug Hogan <doug@openbsd.org> 3 * Copyright (c) 2015 Doug Hogan <doug@openbsd.org>
4 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> 4 * Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
@@ -89,6 +89,7 @@ ssl_bytes_to_list_alloc(SSL *s, STACK_OF(SSL_CIPHER) **ciphers)
89static int 89static int
90ssl_list_to_bytes_scsv(SSL *s, STACK_OF(SSL_CIPHER) **ciphers) 90ssl_list_to_bytes_scsv(SSL *s, STACK_OF(SSL_CIPHER) **ciphers)
91{ 91{
92 CBB cbb;
92 unsigned char *buf = NULL; 93 unsigned char *buf = NULL;
93 size_t buflen, outlen; 94 size_t buflen, outlen;
94 int ret = 0; 95 int ret = 0;
@@ -98,7 +99,9 @@ ssl_list_to_bytes_scsv(SSL *s, STACK_OF(SSL_CIPHER) **ciphers)
98 buflen = sizeof(cipher_bytes) + 2 + 2; 99 buflen = sizeof(cipher_bytes) + 2 + 2;
99 CHECK((buf = calloc(1, buflen)) != NULL); 100 CHECK((buf = calloc(1, buflen)) != NULL);
100 101
101 CHECK(ssl_cipher_list_to_bytes(s, *ciphers, buf, buflen, &outlen)); 102 CHECK(CBB_init_fixed(&cbb, buf, buflen));
103 CHECK(ssl_cipher_list_to_bytes(s, *ciphers, &cbb));
104 CHECK(CBB_finish(&cbb, NULL, &outlen));
102 105
103 CHECK_GOTO(outlen > 0 && outlen == buflen - 2); 106 CHECK_GOTO(outlen > 0 && outlen == buflen - 2);
104 CHECK_GOTO(memcmp(buf, cipher_bytes, sizeof(cipher_bytes)) == 0); 107 CHECK_GOTO(memcmp(buf, cipher_bytes, sizeof(cipher_bytes)) == 0);
@@ -115,6 +118,7 @@ err:
115static int 118static int
116ssl_list_to_bytes_no_scsv(SSL *s, STACK_OF(SSL_CIPHER) **ciphers) 119ssl_list_to_bytes_no_scsv(SSL *s, STACK_OF(SSL_CIPHER) **ciphers)
117{ 120{
121 CBB cbb;
118 unsigned char *buf = NULL; 122 unsigned char *buf = NULL;
119 size_t buflen, outlen; 123 size_t buflen, outlen;
120 int ret = 0; 124 int ret = 0;
@@ -129,7 +133,9 @@ ssl_list_to_bytes_no_scsv(SSL *s, STACK_OF(SSL_CIPHER) **ciphers)
129 /* Set renegotiate so it doesn't add SCSV */ 133 /* Set renegotiate so it doesn't add SCSV */
130 s->internal->renegotiate = 1; 134 s->internal->renegotiate = 1;
131 135
132 CHECK(ssl_cipher_list_to_bytes(s, *ciphers, buf, buflen, &outlen)); 136 CHECK(CBB_init_fixed(&cbb, buf, buflen));
137 CHECK(ssl_cipher_list_to_bytes(s, *ciphers, &cbb));
138 CHECK(CBB_finish(&cbb, NULL, &outlen));
133 139
134 CHECK_GOTO(outlen > 0 && outlen == buflen - 2); 140 CHECK_GOTO(outlen > 0 && outlen == buflen - 2);
135 CHECK_GOTO(memcmp(buf, cipher_bytes, sizeof(cipher_bytes)) == 0); 141 CHECK_GOTO(memcmp(buf, cipher_bytes, sizeof(cipher_bytes)) == 0);