diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2017-10-10 16:52:18 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2017-10-10 16:52:18 +0000 |
commit | 49481cd9c59f10a453d5d40eb8f51451c30506d9 (patch) | |
tree | 2065ab6834eb906d225942d7d49996f397c9318c /regress/lib/libssl/unit | |
parent | 8307449bc68b434dff2fd4fe606fff6b4e3ab923 (diff) |
Revise regress now that ssl_bytes_to_cipher_list() takes a CBS.
Diffstat (limited to 'regress/lib/libssl/unit')
-rw-r--r-- | regress/lib/libssl/unit/cipher_list.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/regress/lib/libssl/unit/cipher_list.c b/regress/lib/libssl/unit/cipher_list.c index c4b42764a06..7a7ca377081 100644 --- a/regress/lib/libssl/unit/cipher_list.c +++ b/regress/lib/libssl/unit/cipher_list.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cipher_list.c,v 1.6 2017/08/28 17:32:04 jsing Exp $ */ +/* $OpenBSD: cipher_list.c,v 1.7 2017/10/10 16:52:17 jsing Exp $ */ /* * Copyright (c) 2015 Doug Hogan <doug@openbsd.org> * Copyright (c) 2015 Joel Sing <jsing@openbsd.org> @@ -63,20 +63,17 @@ static uint16_t cipher_values[] = { #define N_CIPHERS (sizeof(cipher_bytes) / 2) -extern STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, - const unsigned char *p, int num); -extern int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, - unsigned char *p, size_t len, size_t *outlen); - static int ssl_bytes_to_list_alloc(SSL *s, STACK_OF(SSL_CIPHER) **ciphers) { SSL_CIPHER *cipher; uint16_t value; + CBS cbs; int i; - *ciphers = ssl_bytes_to_cipher_list(s, cipher_bytes, - sizeof(cipher_bytes)); + CBS_init(&cbs, cipher_bytes, sizeof(cipher_bytes)); + + *ciphers = ssl_bytes_to_cipher_list(s, &cbs); CHECK(*ciphers != NULL); CHECK(sk_SSL_CIPHER_num(*ciphers) == N_CIPHERS); for (i = 0; i < sk_SSL_CIPHER_num(*ciphers); i++) { @@ -149,25 +146,18 @@ static int ssl_bytes_to_list_invalid(SSL *s, STACK_OF(SSL_CIPHER) **ciphers) { uint8_t empty_cipher_bytes[] = {0}; + CBS cbs; sk_SSL_CIPHER_free(*ciphers); /* Invalid length: CipherSuite is 2 bytes so it must be even */ - *ciphers = ssl_bytes_to_cipher_list(s, cipher_bytes, - sizeof(cipher_bytes) - 1); + CBS_init(&cbs, cipher_bytes, sizeof(cipher_bytes) - 1); + *ciphers = ssl_bytes_to_cipher_list(s, &cbs); CHECK(*ciphers == NULL); /* Invalid length: cipher_suites must be at least 2 */ - *ciphers = ssl_bytes_to_cipher_list(s, empty_cipher_bytes, - sizeof(empty_cipher_bytes)); - CHECK(*ciphers == NULL); - - /* Invalid length: cipher_suites must be at most 2^16-2 */ - *ciphers = ssl_bytes_to_cipher_list(s, cipher_bytes, 0x10000); - CHECK(*ciphers == NULL); - - /* Invalid len: prototype is signed, but it shouldn't accept len < 0 */ - *ciphers = ssl_bytes_to_cipher_list(s, cipher_bytes, -2); + CBS_init(&cbs, empty_cipher_bytes, sizeof(empty_cipher_bytes)); + *ciphers = ssl_bytes_to_cipher_list(s, &cbs); CHECK(*ciphers == NULL); return 1; |