From 471080a8a794fa50624c5623e942762c8f568874 Mon Sep 17 00:00:00 2001 From: jca <> Date: Sun, 24 Mar 2024 13:56:35 +0000 Subject: 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@ --- src/lib/libcrypto/evp/evp_names.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/libcrypto/evp/evp_names.c b/src/lib/libcrypto/evp/evp_names.c index 1b976ca05f..d1e21d2793 100644 --- a/src/lib/libcrypto/evp/evp_names.c +++ b/src/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; -- cgit v1.2.3-55-g6feb