diff options
| author | doug <> | 2015-06-28 00:08:27 +0000 |
|---|---|---|
| committer | doug <> | 2015-06-28 00:08:27 +0000 |
| commit | 1618490a96ac0f443d379bc3d4dcf04769edd0ce (patch) | |
| tree | d16b139f0e8b37e46fb1c729c4b18620699b2549 /src/regress/lib/libssl/unit | |
| parent | a37b07aa0776c4c4f84a698161d022b845148dde (diff) | |
| download | openbsd-1618490a96ac0f443d379bc3d4dcf04769edd0ce.tar.gz openbsd-1618490a96ac0f443d379bc3d4dcf04769edd0ce.tar.bz2 openbsd-1618490a96ac0f443d379bc3d4dcf04769edd0ce.zip | |
Convert ssl_bytes_to_cipher_list to CBS.
Link in the new 'unit' regress and expand the invalid tests to include
some that would fail before the CBS conversion.
input + ok miod@ jsing@
Diffstat (limited to 'src/regress/lib/libssl/unit')
| -rw-r--r-- | src/regress/lib/libssl/unit/cipher_list.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/regress/lib/libssl/unit/cipher_list.c b/src/regress/lib/libssl/unit/cipher_list.c index b513007771..1c829f369c 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.1 2015/06/27 23:35:52 doug Exp $ */ | 1 | /* $OpenBSD: cipher_list.c,v 1.2 2015/06/28 00:08:27 doug 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> |
| @@ -146,6 +146,8 @@ err: | |||
| 146 | static int | 146 | static int |
| 147 | ssl_bytes_to_list_invalid(SSL *s, STACK_OF(SSL_CIPHER) **ciphers) | 147 | ssl_bytes_to_list_invalid(SSL *s, STACK_OF(SSL_CIPHER) **ciphers) |
| 148 | { | 148 | { |
| 149 | uint8_t empty_cipher_bytes[] = { }; | ||
| 150 | |||
| 149 | sk_SSL_CIPHER_free(*ciphers); | 151 | sk_SSL_CIPHER_free(*ciphers); |
| 150 | 152 | ||
| 151 | /* Invalid length: CipherSuite is 2 bytes so it must be even */ | 153 | /* Invalid length: CipherSuite is 2 bytes so it must be even */ |
| @@ -153,6 +155,19 @@ ssl_bytes_to_list_invalid(SSL *s, STACK_OF(SSL_CIPHER) **ciphers) | |||
| 153 | sizeof(cipher_bytes) - 1); | 155 | sizeof(cipher_bytes) - 1); |
| 154 | CHECK(*ciphers == NULL); | 156 | CHECK(*ciphers == NULL); |
| 155 | 157 | ||
| 158 | /* Invalid length: cipher_suites must be at least 2 */ | ||
| 159 | *ciphers = ssl_bytes_to_cipher_list(s, empty_cipher_bytes, | ||
| 160 | sizeof(empty_cipher_bytes)); | ||
| 161 | CHECK(*ciphers == NULL); | ||
| 162 | |||
| 163 | /* Invalid length: cipher_suites must be at most 2^16-2 */ | ||
| 164 | *ciphers = ssl_bytes_to_cipher_list(s, cipher_bytes, 0x10000); | ||
| 165 | CHECK(*ciphers == NULL); | ||
| 166 | |||
| 167 | /* Invalid len: prototype is signed, but it shouldn't accept len < 0 */ | ||
| 168 | *ciphers = ssl_bytes_to_cipher_list(s, cipher_bytes, -2); | ||
| 169 | CHECK(*ciphers == NULL); | ||
| 170 | |||
| 156 | return 1; | 171 | return 1; |
| 157 | } | 172 | } |
| 158 | 173 | ||
