]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Do not error when md_kt_size() is called with mdname="none"
authorSelva Nair <selva.nair@gmail.com>
Fri, 21 Jan 2022 18:57:52 +0000 (13:57 -0500)
committerGert Doering <gert@greenie.muc.de>
Wed, 26 Jan 2022 13:36:40 +0000 (14:36 +0100)
An easy way to trigger this error is to run an otherwise working setup
(at say verb = 4) with increased verbosity of verb >= 7 and using a GCM
cipher (e.g., AES-256-GCM). It will cause a fatal exit while printing the
cipher and hmac in key2_print().

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20220121185752.14138-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23631.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/crypto_openssl.c

index 5f8c575ec641245344d20273c42cb49f499cfe2f..a725306ccff82ec3006608be974736ffba67724a 100644 (file)
@@ -1073,6 +1073,10 @@ md_kt_name(const char *mdname)
 unsigned char
 md_kt_size(const char *mdname)
 {
+    if (!strcmp("none", mdname))
+    {
+        return 0;
+    }
     evp_md_type *kt = md_get(mdname);
     unsigned char size =  (unsigned char)EVP_MD_size(kt);
     EVP_MD_free(kt);