]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Unify ssl3_get_cipher_by_std_name() implementation
authorBenjamin Kaduk <bkaduk@akamai.com>
Sun, 27 Sep 2020 22:01:12 +0000 (15:01 -0700)
committerBenjamin Kaduk <bkaduk@akamai.com>
Thu, 29 Oct 2020 22:29:31 +0000 (15:29 -0700)
The handling for the SCSVs was the same as for regular ciphers;
just merge them into the same table-driven handler.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(cherry picked from commit 231849bc9ca69dfd3adf40821421d8e2d804d8e8)

(Merged from https://github.com/openssl/openssl/pull/13280)

ssl/s3_lib.c

index a7ab206e796380d6e1e4aab6743805d332046b96..4511b52c9afcb5a29dc18e02d4b02543076546c9 100644 (file)
@@ -4072,9 +4072,10 @@ const SSL_CIPHER *ssl3_get_cipher_by_id(uint32_t id)
 
 const SSL_CIPHER *ssl3_get_cipher_by_std_name(const char *stdname)
 {
-    SSL_CIPHER *c = NULL, *tbl;
-    SSL_CIPHER *alltabs[] = {tls13_ciphers, ssl3_ciphers};
-    size_t i, j, tblsize[] = {TLS13_NUM_CIPHERS, SSL3_NUM_CIPHERS};
+    SSL_CIPHER *tbl;
+    SSL_CIPHER *alltabs[] = {tls13_ciphers, ssl3_ciphers, ssl3_scsvs};
+    size_t i, j, tblsize[] = {TLS13_NUM_CIPHERS, SSL3_NUM_CIPHERS,
+                              SSL3_NUM_SCSVS};
 
     /* this is not efficient, necessary to optimize this? */
     for (j = 0; j < OSSL_NELEM(alltabs); j++) {
@@ -4086,16 +4087,7 @@ const SSL_CIPHER *ssl3_get_cipher_by_std_name(const char *stdname)
             }
         }
     }
-    if (c == NULL) {
-        tbl = ssl3_scsvs;
-        for (i = 0; i < SSL3_NUM_SCSVS; i++, tbl++) {
-            if (strcmp(stdname, tbl->stdname) == 0) {
-                c = tbl;
-                break;
-            }
-        }
-    }
-    return c;
+    return NULL;
 }
 
 /*