summaryrefslogtreecommitdiff
path: root/security/xmlsec1/files/patch-src-openssl-app.c
blob: e20b9da3e1cab9c41f90881fe734f4b4e8d0bf88 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--- src/openssl/app.c.orig	2023-10-30 22:27:05 UTC
+++ src/openssl/app.c
@@ -59,6 +59,29 @@
 #include "../cast_helpers.h"
 #include "private.h"
 
+#if defined(XMLSEC_OPENSSL_API_110) && defined(LIBRESSL_VERSION_NUMBER)
+static UI_METHOD *
+ui_null_create(void)
+{
+	return (UI_create_method("OpenSSL NULL UI"));
+}
+static void
+ui_null_destroy(UI_METHOD *ui)
+{
+	UI_destroy_method(ui);
+}
+#else
+static const UI_METHOD *
+ui_null_create(void)
+{
+	return (UI_null());
+}
+static void
+ui_null_destroy(const UI_METHOD *ui)
+{
+}
+#endif
+
 static int      xmlSecOpenSSLDefaultPasswordCallback    (char *buf,
                                                          int bufsiz,
                                                          int verify,
@@ -490,6 +513,11 @@ xmlSecOpenSSLAppEngineKeyLoad(const char *engineName, 
     EVP_PKEY* pKey = NULL;
     int engineInit = 0;
     int ret;
+#if defined(XMLSEC_OPENSSL_API_110) && defined(LIBRESSL_VERSION_NUMBER)
+    UI_METHOD *ui_null = ui_null_create();
+#else
+    const UI_METHOD *ui_null = ui_null_create();
+#endif
 
     xmlSecAssert2(engineName != NULL, NULL);
     xmlSecAssert2(engineKeyId != NULL, NULL);
@@ -538,7 +566,7 @@ xmlSecOpenSSLAppEngineKeyLoad(const char *engineName, 
         }
     }
 
-    if(ENGINE_ctrl_cmd(engine, "SET_USER_INTERFACE", 0, (void *)UI_null(), 0, 1) < 0) {
+    if(ENGINE_ctrl_cmd(engine, "SET_USER_INTERFACE", 0, (void *)ui_null, 0, 1) < 0) {
         xmlSecOpenSSLError("ENGINE_ctrl_cmd_string(SET_USER_INTERFACE)", NULL);
         goto done;
     }
@@ -601,6 +629,7 @@ done:
     data = NULL;
 
 done:
+    ui_null_destroy(ui_null);
     /* cleanup */
     if(pKey != NULL) {
         EVP_PKEY_free(pKey);