summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjca <>2024-03-24 13:56:35 +0000
committerjca <>2024-03-24 13:56:35 +0000
commit471080a8a794fa50624c5623e942762c8f568874 (patch)
tree79a6d86fa4e0e3b1429824f5fce97b1225465286
parent5176ab31ca58949fc78b5b06b23adf63a83b9c44 (diff)
downloadopenbsd-471080a8a794fa50624c5623e942762c8f568874.tar.gz
openbsd-471080a8a794fa50624c5623e942762c8f568874.tar.bz2
openbsd-471080a8a794fa50624c5623e942762c8f568874.zip
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@
-rw-r--r--src/lib/libcrypto/evp/evp_names.c8
1 files changed, 7 insertions, 1 deletions
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 @@
1/* $OpenBSD: evp_names.c,v 1.14 2024/03/24 06:15:59 tb Exp $ */ 1/* $OpenBSD: evp_names.c,v 1.15 2024/03/24 13:56:35 jca Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
4 * 4 *
@@ -1643,6 +1643,9 @@ EVP_get_cipherbyname(const char *name)
1643 if (!OPENSSL_init_crypto(0, NULL)) 1643 if (!OPENSSL_init_crypto(0, NULL))
1644 return NULL; 1644 return NULL;
1645 1645
1646 if (name == NULL)
1647 return NULL;
1648
1646 if ((cipher = bsearch(name, cipher_names, N_CIPHER_NAMES, 1649 if ((cipher = bsearch(name, cipher_names, N_CIPHER_NAMES,
1647 sizeof(*cipher), cipher_cmp)) == NULL) 1650 sizeof(*cipher), cipher_cmp)) == NULL)
1648 return NULL; 1651 return NULL;
@@ -1664,6 +1667,9 @@ EVP_get_digestbyname(const char *name)
1664 if (!OPENSSL_init_crypto(0, NULL)) 1667 if (!OPENSSL_init_crypto(0, NULL))
1665 return NULL; 1668 return NULL;
1666 1669
1670 if (name == NULL)
1671 return NULL;
1672
1667 if ((digest = bsearch(name, digest_names, N_DIGEST_NAMES, 1673 if ((digest = bsearch(name, digest_names, N_DIGEST_NAMES,
1668 sizeof(*digest), digest_cmp)) == NULL) 1674 sizeof(*digest), digest_cmp)) == NULL)
1669 return NULL; 1675 return NULL;