summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2016-12-04 14:33:04 +0000
committerjsing <>2016-12-04 14:33:04 +0000
commit86cc696af289e97b488987ddb9c9567f6e32a32c (patch)
tree336f72caab80d59741cf1ff46bf1ad6a8d6cd35e /src
parent782e6af2c8cf001e1a3eef1d0acb0d16317e4464 (diff)
downloadopenbsd-86cc696af289e97b488987ddb9c9567f6e32a32c.tar.gz
openbsd-86cc696af289e97b488987ddb9c9567f6e32a32c.tar.bz2
openbsd-86cc696af289e97b488987ddb9c9567f6e32a32c.zip
Update regress test to handle change to ssl_cipher_list_to_bytes().
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libssl/unit/cipher_list.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/regress/lib/libssl/unit/cipher_list.c b/src/regress/lib/libssl/unit/cipher_list.c
index 43161069eb..a9ae637d05 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.3 2015/07/01 07:21:10 bcook Exp $ */ 1/* $OpenBSD: cipher_list.c,v 1.4 2016/12/04 14:33:04 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>
@@ -64,7 +64,7 @@ static uint16_t cipher_values[] = {
64extern STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, 64extern STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,
65 const unsigned char *p, int num); 65 const unsigned char *p, int num);
66extern int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, 66extern int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk,
67 unsigned char *p); 67 unsigned char *p, size_t len, size_t *outlen);
68 68
69static int 69static int
70ssl_bytes_to_list_alloc(SSL *s, STACK_OF(SSL_CIPHER) **ciphers) 70ssl_bytes_to_list_alloc(SSL *s, STACK_OF(SSL_CIPHER) **ciphers)
@@ -91,8 +91,7 @@ static int
91ssl_list_to_bytes_scsv(SSL *s, STACK_OF(SSL_CIPHER) **ciphers) 91ssl_list_to_bytes_scsv(SSL *s, STACK_OF(SSL_CIPHER) **ciphers)
92{ 92{
93 unsigned char *buf = NULL; 93 unsigned char *buf = NULL;
94 size_t buflen; 94 size_t buflen, outlen;
95 int len;
96 int ret = 0; 95 int ret = 0;
97 96
98 /* Space for cipher bytes, plus reneg SCSV and two spare bytes. */ 97 /* Space for cipher bytes, plus reneg SCSV and two spare bytes. */
@@ -100,8 +99,9 @@ ssl_list_to_bytes_scsv(SSL *s, STACK_OF(SSL_CIPHER) **ciphers)
100 buflen = sizeof(cipher_bytes) + 2 + 2; 99 buflen = sizeof(cipher_bytes) + 2 + 2;
101 CHECK((buf = calloc(1, buflen)) != NULL); 100 CHECK((buf = calloc(1, buflen)) != NULL);
102 101
103 len = ssl_cipher_list_to_bytes(s, *ciphers, buf); 102 CHECK(ssl_cipher_list_to_bytes(s, *ciphers, buf, buflen, &outlen));
104 CHECK_GOTO(len > 0 && (size_t)len == buflen - 2); 103
104 CHECK_GOTO(outlen > 0 && outlen == buflen - 2);
105 CHECK_GOTO(memcmp(buf, cipher_bytes, sizeof(cipher_bytes)) == 0); 105 CHECK_GOTO(memcmp(buf, cipher_bytes, sizeof(cipher_bytes)) == 0);
106 CHECK_GOTO(buf[buflen - 4] == 0x00 && buf[buflen - 3] == 0xff); 106 CHECK_GOTO(buf[buflen - 4] == 0x00 && buf[buflen - 3] == 0xff);
107 CHECK_GOTO(buf[buflen - 2] == 0x00 && buf[buflen - 1] == 0x00); 107 CHECK_GOTO(buf[buflen - 2] == 0x00 && buf[buflen - 1] == 0x00);
@@ -117,8 +117,7 @@ static int
117ssl_list_to_bytes_no_scsv(SSL *s, STACK_OF(SSL_CIPHER) **ciphers) 117ssl_list_to_bytes_no_scsv(SSL *s, STACK_OF(SSL_CIPHER) **ciphers)
118{ 118{
119 unsigned char *buf = NULL; 119 unsigned char *buf = NULL;
120 size_t buflen; 120 size_t buflen, outlen;
121 int len;
122 int ret = 0; 121 int ret = 0;
123 122
124 /* Space for cipher bytes and two spare bytes */ 123 /* Space for cipher bytes and two spare bytes */
@@ -131,8 +130,9 @@ ssl_list_to_bytes_no_scsv(SSL *s, STACK_OF(SSL_CIPHER) **ciphers)
131 /* Set renegotiate so it doesn't add SCSV */ 130 /* Set renegotiate so it doesn't add SCSV */
132 s->renegotiate = 1; 131 s->renegotiate = 1;
133 132
134 len = ssl_cipher_list_to_bytes(s, *ciphers, buf); 133 CHECK(ssl_cipher_list_to_bytes(s, *ciphers, buf, buflen, &outlen));
135 CHECK_GOTO(len > 0 && (size_t)len == buflen - 2); 134
135 CHECK_GOTO(outlen > 0 && outlen == buflen - 2);
136 CHECK_GOTO(memcmp(buf, cipher_bytes, sizeof(cipher_bytes)) == 0); 136 CHECK_GOTO(memcmp(buf, cipher_bytes, sizeof(cipher_bytes)) == 0);
137 CHECK_GOTO(buf[buflen - 2] == 0xfe && buf[buflen - 1] == 0xab); 137 CHECK_GOTO(buf[buflen - 2] == 0xfe && buf[buflen - 1] == 0xab);
138 138
@@ -203,5 +203,6 @@ err:
203 203
204 if (!rv) 204 if (!rv)
205 printf("PASS %s\n", __FILE__); 205 printf("PASS %s\n", __FILE__);
206
206 return rv; 207 return rv;
207} 208}