optimise ssl3_get_cipher_by_std_name()
authorhklaas <71921312+hklaas@users.noreply.github.com>
Sat, 26 Sep 2020 09:54:13 +0000 (10:54 +0100)
committerDmitry Belyavskiy <beldmit@gmail.com>
Sun, 27 Sep 2020 18:09:54 +0000 (21:09 +0300)
Return immediately on matched cipher. Without this patch the code only breaks out of the inner for loop, meaning for a matched TLS13 cipher the code will still loop through 160ish SSL3 ciphers.

CLA: trivial

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13000)

ssl/s3_lib.c

index 88bab0edc410d13db0af52094411ee344a2eaea6..94c2d8c2cee3b591ab70fe274ff63afb1f65ec7c 100644 (file)
@@ -4132,8 +4132,7 @@ const SSL_CIPHER *ssl3_get_cipher_by_std_name(const char *stdname)
             if (tbl->stdname == NULL)
                 continue;
             if (strcmp(stdname, tbl->stdname) == 0) {
-                c = tbl;
-                break;
+                return tbl;
             }
         }
     }