From ace1aaedae16f4098783ed4a8c5602142650126c Mon Sep 17 00:00:00 2001 From: jca Date: Sun, 24 Mar 2024 13:56:35 +0000 Subject: [PATCH] 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@ --- lib/libcrypto/evp/evp_names.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; -- 2.20.1