summaryrefslogtreecommitdiffstats
path: root/upstream.patch
blob: a1d65ba716061bc62ac253aedb51441fe349ae43 (plain)
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
From 1ef65c1cf030ac5173fb388795f82e3d14a70c6b Mon Sep 17 00:00:00 2001
From: Jakub Zelenka <bukka@php.net>
Date: Mon, 17 Oct 2022 20:38:40 +0100
Subject: [PATCH] Clean up OpenSSL engine list when OpenSSL 1.0.2 used

Attempt to fix GH-8620.
---
 NEWS                  | 4 ++++
 ext/openssl/openssl.c | 9 +++++++++
 2 files changed, 13 insertions(+)

diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 81cef7edbfca..0f937f8c6de0 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -61,6 +61,10 @@
 #include <openssl/param_build.h>
 #endif
 
+#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(OPENSSL_NO_ENGINE)
+#include <openssl/engine.h>
+#endif
+
 /* Common */
 #include <time.h>
 
@@ -1312,6 +1316,11 @@ PHP_MSHUTDOWN_FUNCTION(openssl)
 #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
 	EVP_cleanup();
 
+#ifndef OPENSSL_NO_ENGINE
+	/* Free engine list initialized by OPENSSL_config */
+	ENGINE_cleanup();
+#endif
+
 	/* prevent accessing locking callback from unloaded extension */
 	CRYPTO_set_locking_callback(NULL);
 	/* free allocated error strings */