From 60d685d196e8d594d754751e4852f01d80d8c0cc Mon Sep 17 00:00:00 2001 From: Benjamin Kaduk Date: Mon, 6 Feb 2017 11:30:16 -0600 Subject: Let ssl_get_cipher_by_char yield not-valid ciphers Now that we have made SCSVs into more of a first-class object, provide a way for the bytes-to-SSL_CIPHER conversion to actually return them. Add a flag 'all' to ssl_get_cipher_by_char to indicate that we want all the known ciphers, not just the ones valid for encryption. This will, in practice, let the caller retrieve the SCSVs. Reviewed-by: Matt Caswell Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/2279) --- ssl/ssl_ciph.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ssl/ssl_ciph.c') diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c index 2d2395c..e64e3da 100644 --- a/ssl/ssl_ciph.c +++ b/ssl/ssl_ciph.c @@ -1915,11 +1915,12 @@ int ssl_cipher_get_cert_index(const SSL_CIPHER *c) return -1; } -const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr) +const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr, + int all) { const SSL_CIPHER *c = ssl->method->get_cipher_by_char(ptr); - if (c == NULL || c->valid == 0) + if (c == NULL || (!all && c->valid == 0)) return NULL; return c; } -- cgit v1.1