Skip to content

Commit 5d16735

Browse files
ColtonWilleypadelsbach
authored andcommitted
Fix up openssl replace default for re-entrant behavior
1 parent b201c3e commit 5d16735

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

patches/openssl3-replace-default.patch

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ diff --git a/crypto/provider_predefined.c b/crypto/provider_predefined.c
22
index 068e0b7..e9ae469 100644
33
--- a/crypto/provider_predefined.c
44
+++ b/crypto/provider_predefined.c
5-
@@ -5,28 +5,67 @@
5+
@@ -5,28 +5,69 @@
66
* this file except in compliance with the License. You can obtain a copy
77
* in the file LICENSE in the source distribution or at
88
* https://www.openssl.org/source/license.html
@@ -32,23 +32,25 @@ index 068e0b7..e9ae469 100644
3232
+ int ret = 0;
3333
+ OSSL_provider_init_fn *wolfssl_provider_init_fn = NULL;
3434
+
35-
+ d = DSO_new();
3635
+ if (!d) {
37-
+ fprintf(stderr, "DSO_new() failed\n");
38-
+ return 1;
39-
+ }
36+
+ d = DSO_new();
37+
+ if (!d) {
38+
+ fprintf(stderr, "DSO_new() failed\n");
39+
+ return 0;
40+
+ }
4041
+
41-
+ if (!DSO_load(d, "wolfprov", NULL, 0)) {
42-
+ fprintf(stderr, "Could not load libwolfprov.so. Is the libwolfprov package installed?\n");
43-
+ DSO_free(d);
44-
+ return 1;
42+
+ if (!DSO_load(d, "wolfprov", NULL, 0)) {
43+
+ fprintf(stderr, "Could not load libwolfprov.so. Is the libwolfprov package installed?\n");
44+
+ DSO_free(d);
45+
+ d = NULL;
46+
+ return 0;
47+
+ }
4548
+ }
4649
+
4750
+ wolfssl_provider_init_fn = (OSSL_provider_init_fn*)DSO_bind_func(d, "wolfssl_provider_init");
4851
+ if (!wolfssl_provider_init_fn) {
4952
+ fprintf(stderr, "Failed to find wolfssl_provider_init symbol\n");
50-
+ DSO_free(d);
51-
+ return 1;
53+
+ return 0;
5254
+ }
5355
+
5456
+ // Intentionally preserve the DSO 'd' here, since it needs to stay loaded

0 commit comments

Comments
 (0)