From d93bded6aa2852e681de2ed76fb43c415687af68 Mon Sep 17 00:00:00 2001 From: hklaas <71921312+hklaas@users.noreply.github.com> Date: Sat, 26 Sep 2020 10:54:13 +0100 Subject: [PATCH] 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 (Merged from https://github.com/openssl/openssl/pull/13000) --- ssl/s3_lib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index 88bab0edc4..94c2d8c2ce 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -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; } } } -- 2.39.5