From: hklaas <71921312+hklaas@users.noreply.github.com> Date: Sat, 26 Sep 2020 09:54:13 +0000 (+0100) Subject: optimise ssl3_get_cipher_by_std_name() X-Git-Tag: OpenSSL_1_1_1i~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5242203692812a57b2012083822f0c818ca55c1;p=thirdparty%2Fopenssl.git optimise ssl3_get_cipher_by_std_name() 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 Reviewed-by: Dmitry Belyavskiy (cherry picked from commit d93bded6aa2852e681de2ed76fb43c415687af68) Reviewed-by: Ben Kaduk (Merged from https://github.com/openssl/openssl/pull/13280) --- diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index a987604bcd0..a7ab206e796 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -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; } } }