diff options
Diffstat (limited to 'src/regress/lib')
| -rw-r--r-- | src/regress/lib/libssl/Makefile | 5 | ||||
| -rw-r--r-- | src/regress/lib/libssl/unit/cipher_list.c | 17 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/regress/lib/libssl/Makefile b/src/regress/lib/libssl/Makefile index 4d64dc3966..7c2d92e340 100644 --- a/src/regress/lib/libssl/Makefile +++ b/src/regress/lib/libssl/Makefile | |||
| @@ -1,10 +1,11 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.21 2015/02/06 09:36:16 doug Exp $ | 1 | # $OpenBSD: Makefile,v 1.22 2015/06/28 00:08:27 doug Exp $ |
| 2 | 2 | ||
| 3 | SUBDIR= \ | 3 | SUBDIR= \ |
| 4 | asn1 \ | 4 | asn1 \ |
| 5 | bytestring \ | 5 | bytestring \ |
| 6 | ciphers \ | 6 | ciphers \ |
| 7 | ssl | 7 | ssl \ |
| 8 | unit | ||
| 8 | 9 | ||
| 9 | install: | 10 | install: |
| 10 | 11 | ||
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 | ||
