]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
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)
committerBenjamin Kaduk <bkaduk@akamai.com>
Thu, 29 Oct 2020 22:29:27 +0000 (15:29 -0700)
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>
(cherry picked from commit d93bded6aa2852e681de2ed76fb43c415687af68)

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/13280)

ssl/s3_lib.c

index a987604bcd0e672ae9e3fee27950a5497f701fe7..a7ab206e796380d6e1e4aab6743805d332046b96 100644 (file)
@@ -4082,8 +4082,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;
             }
         }
     }