diff options
| author | jca <> | 2024-03-24 13:56:35 +0000 |
|---|---|---|
| committer | jca <> | 2024-03-24 13:56:35 +0000 |
| commit | ff5cf89c963e0eedd67cb5e2626ba9a2a06c57ce (patch) | |
| tree | 79a6d86fa4e0e3b1429824f5fce97b1225465286 /src | |
| parent | 0f167a53fa3e19b7e6bb0620e16c6d11f07f10ca (diff) | |
| download | openbsd-ff5cf89c963e0eedd67cb5e2626ba9a2a06c57ce.tar.gz openbsd-ff5cf89c963e0eedd67cb5e2626ba9a2a06c57ce.tar.bz2 openbsd-ff5cf89c963e0eedd67cb5e2626ba9a2a06c57ce.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@
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/evp/evp_names.c | 8 |
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; |
