aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Buehler <tb@openbsd.org>2024-03-25 17:36:13 +1100
committerBrent Cook <busterb@gmail.com>2024-03-25 02:57:11 -0500
commit3822a71b2eecc16ecc64696f0b3b320845e65b58 (patch)
tree5643e16e5ac8b6f5eb527adf9558b50b9e3792c4
parentcb3775c392029f9f8c28c97bd4e6c764e762e993 (diff)
downloadportable-3822a71b2eecc16ecc64696f0b3b320845e65b58.tar.gz
portable-3822a71b2eecc16ecc64696f0b3b320845e65b58.tar.bz2
portable-3822a71b2eecc16ecc64696f0b3b320845e65b58.zip
Backport jca's byname fix
-rw-r--r--patches/byname.patch65
1 files changed, 65 insertions, 0 deletions
diff --git a/patches/byname.patch b/patches/byname.patch
new file mode 100644
index 0000000..ee1cd81
--- /dev/null
+++ b/patches/byname.patch
@@ -0,0 +1,65 @@
1Backport fix for behavior change for EVP_get_{cipher,digest}byname()
2https://github.com/openbsd/src/commit/ace1aaedae16f4098783ed4a8c5602142650126c
3
4--- crypto/evp/evp_names.c.orig Mon Mar 25 17:27:41 2024
5+++ crypto/evp/evp_names.c Mon Mar 25 17:30:27 2024
6@@ -1852,6 +1852,9 @@ EVP_get_cipherbyname(const char *name)
7 if (!OPENSSL_init_crypto(0, NULL))
8 return NULL;
9
10+ if (name == NULL)
11+ return NULL;
12+
13 if ((cipher = bsearch(name, cipher_names, N_CIPHER_NAMES,
14 sizeof(*cipher), cipher_cmp)) == NULL)
15 return NULL;
16@@ -1871,6 +1874,9 @@ EVP_get_digestbyname(const char *name)
17 const struct digest_name *digest;
18
19 if (!OPENSSL_init_crypto(0, NULL))
20+ return NULL;
21+
22+ if (name == NULL)
23 return NULL;
24
25 if ((digest = bsearch(name, digest_names, N_DIGEST_NAMES,
26--- tests/evp_test.c.orig Mon Mar 25 17:27:41 2024
27+++ tests/evp_test.c Mon Mar 25 17:31:32 2024
28@@ -737,6 +737,28 @@ obj_name_do_all_test(void)
29 return failure;
30 }
31
32+static int
33+evp_get_cipherbyname_test(void)
34+{
35+ int failure = 0;
36+
37+ /* Should handle NULL gracefully */
38+ failure |= EVP_get_cipherbyname(NULL) != NULL;
39+
40+ return failure;
41+}
42+
43+static int
44+evp_get_digestbyname_test(void)
45+{
46+ int failure = 0;
47+
48+ /* Should handle NULL gracefully */
49+ failure |= EVP_get_digestbyname(NULL) != NULL;
50+
51+ return failure;
52+}
53+
54 int
55 main(int argc, char **argv)
56 {
57@@ -748,6 +770,8 @@ main(int argc, char **argv)
58 failed |= evp_do_all_test();
59 failed |= evp_aliases_test();
60 failed |= obj_name_do_all_test();
61+ failed |= evp_get_cipherbyname_test();
62+ failed |= evp_get_digestbyname_test();
63
64 OPENSSL_cleanup();
65