From: jca Date: Sun, 24 Mar 2024 13:56:35 +0000 (+0000) Subject: Restore EVP_get_cipherbyname(NULL)/EVP_get_digestbyname(NULL) handling X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ace1aaedae16f4098783ed4a8c5602142650126c;p=openbsd Restore EVP_get_cipherbyname(NULL)/EVP_get_digestbyname(NULL) handling The previous implementation used the now defunct OBJ_NAME_get() which bailed out when passed a NULL argument. Difference spotted by the regress tests in ports/net/openvpn (regular openvpn use is fine but openvpn --show-ciphers/--show-digests crashes). ok tb@ --- diff --git a/lib/libcrypto/evp/evp_names.c b/lib/libcrypto/evp/evp_names.c index 1b976ca05fe..d1e21d27934 100644 --- a/lib/libcrypto/evp/evp_names.c +++ b/lib/libcrypto/evp/evp_names.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evp_names.c,v 1.14 2024/03/24 06:15:59 tb Exp $ */ +/* $OpenBSD: evp_names.c,v 1.15 2024/03/24 13:56:35 jca Exp $ */ /* * Copyright (c) 2023 Theo Buehler * @@ -1643,6 +1643,9 @@ EVP_get_cipherbyname(const char *name) if (!OPENSSL_init_crypto(0, NULL)) return NULL; + if (name == NULL) + return NULL; + if ((cipher = bsearch(name, cipher_names, N_CIPHER_NAMES, sizeof(*cipher), cipher_cmp)) == NULL) return NULL; @@ -1664,6 +1667,9 @@ EVP_get_digestbyname(const char *name) if (!OPENSSL_init_crypto(0, NULL)) return NULL; + if (name == NULL) + return NULL; + if ((digest = bsearch(name, digest_names, N_DIGEST_NAMES, sizeof(*digest), digest_cmp)) == NULL) return NULL;