Skip to content

Commit ce57221

Browse files
committed
Fix GH-9064: PHP fails to build if openssl was built with no-ec
1 parent 9416186 commit ce57221

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

NEWS

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ PHP NEWS
2222
. Fixed bug GH-9535 (The behavior of mb_strcut in mbstring has been changed in
2323
PHP8.1). (Nathan Freeman)
2424

25+
- OpenSSL:
26+
. Fixed bug GH-9064 (PHP fails to build if openssl was built with --no-ec).
27+
(Jakub Zelenka)
28+
2529
- Pcntl:
2630
. Fixed bug GH-9298 (Signal handler called after rshutdown leads to crash).
2731
(Erki Aring)

ext/openssl/openssl.c

+4
Original file line numberDiff line numberDiff line change
@@ -4830,6 +4830,7 @@ static void php_openssl_copy_bn_param(
48304830
}
48314831
}
48324832

4833+
#ifdef HAVE_EVP_PKEY_EC
48334834
static zend_string *php_openssl_get_utf8_param(
48344835
EVP_PKEY *pkey, const char *param, const char *name) {
48354836
char buf[64];
@@ -4843,6 +4844,7 @@ static zend_string *php_openssl_get_utf8_param(
48434844
return NULL;
48444845
}
48454846
#endif
4847+
#endif
48464848

48474849
/* {{{ returns an array with the key details (bits, pkey, type)*/
48484850
PHP_FUNCTION(openssl_pkey_get_details)
@@ -4907,6 +4909,7 @@ PHP_FUNCTION(openssl_pkey_get_details)
49074909
php_openssl_copy_bn_param(&ary, pkey, OSSL_PKEY_PARAM_PRIV_KEY, "priv_key");
49084910
php_openssl_copy_bn_param(&ary, pkey, OSSL_PKEY_PARAM_PUB_KEY, "pub_key");
49094911
break;
4912+
#ifdef HAVE_EVP_PKEY_EC
49104913
case EVP_PKEY_EC: {
49114914
ktype = OPENSSL_KEYTYPE_EC;
49124915
array_init(&ary);
@@ -4935,6 +4938,7 @@ PHP_FUNCTION(openssl_pkey_get_details)
49354938
php_openssl_copy_bn_param(&ary, pkey, OSSL_PKEY_PARAM_PRIV_KEY, "d");
49364939
break;
49374940
}
4941+
#endif
49384942
EMPTY_SWITCH_DEFAULT_CASE();
49394943
}
49404944
#else

ext/openssl/tests/bug79589.phpt

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ openssl
55
--SKIPIF--
66
<?php
77
if (getenv("SKIP_ONLINE_TESTS")) die("skip online test");
8+
if (!defined("OPENSSL_KEYTYPE_EC")) die("skip EC disabled");
89
?>
910
--FILE--
1011
<?php

ext/openssl/tests/ecc.phpt

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ openssl_*() with OPENSSL_KEYTYPE_EC
33
--EXTENSIONS--
44
openssl
55
--SKIPIF--
6-
<?php if (!defined("OPENSSL_KEYTYPE_EC")) print "skip"; ?>
6+
<?php
7+
if (!defined("OPENSSL_KEYTYPE_EC")) die("skip EC disabled");
8+
?>
79
--FILE--
810
<?php
911
$config = __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf';

0 commit comments

Comments
 (0)