Skip to content

Commit 59afb44

Browse files
committed
Implement GH-13514 PASSWORD_ARGON2 from OpenSSL 3.2
1 parent 0966f1f commit 59afb44

9 files changed

+670
-4
lines changed

ext/openssl/config0.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ PHP_ARG_WITH([system-ciphers],
1111
[no])
1212

1313
if test "$PHP_OPENSSL" != "no"; then
14-
PHP_NEW_EXTENSION(openssl, openssl.c xp_ssl.c, $ext_shared)
14+
PHP_NEW_EXTENSION(openssl, openssl.c openssl_pwhash.c xp_ssl.c, $ext_shared)
1515
PHP_SUBST(OPENSSL_SHARED_LIBADD)
1616
PHP_SETUP_OPENSSL(OPENSSL_SHARED_LIBADD,
1717
[

ext/openssl/openssl.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,20 @@ static void php_openssl_pkey_free_obj(zend_object *object)
263263
zend_object_std_dtor(&key_object->std);
264264
}
265265

266+
#if PHP_OPENSSL_API_VERSION >= 0x30200
267+
static const zend_module_dep openssl_deps[] = {
268+
ZEND_MOD_REQUIRED("standard")
269+
ZEND_MOD_END
270+
};
271+
#endif
266272
/* {{{ openssl_module_entry */
267273
zend_module_entry openssl_module_entry = {
274+
#if PHP_OPENSSL_API_VERSION >= 0x30200
275+
STANDARD_MODULE_HEADER_EX, NULL,
276+
openssl_deps,
277+
#else
268278
STANDARD_MODULE_HEADER,
279+
#endif
269280
"openssl",
270281
ext_functions,
271282
PHP_MINIT(openssl),
@@ -1319,6 +1330,12 @@ PHP_MINIT_FUNCTION(openssl)
13191330

13201331
REGISTER_INI_ENTRIES();
13211332

1333+
#if PHP_OPENSSL_API_VERSION >= 0x30200
1334+
if (FAILURE == PHP_MINIT(openssl_pwhash)(INIT_FUNC_ARGS_PASSTHRU)) {
1335+
return FAILURE;
1336+
}
1337+
#endif
1338+
13221339
return SUCCESS;
13231340
}
13241341
/* }}} */
@@ -1391,6 +1408,11 @@ PHP_MSHUTDOWN_FUNCTION(openssl)
13911408
php_stream_xport_unregister("tlsv1.2");
13921409
php_stream_xport_unregister("tlsv1.3");
13931410

1411+
#if PHP_OPENSSL_API_VERSION >= 0x30200
1412+
if (FAILURE == PHP_MSHUTDOWN(openssl_pwhash)(SHUTDOWN_FUNC_ARGS_PASSTHRU)) {
1413+
return FAILURE;
1414+
}
1415+
#endif
13941416
/* reinstate the default tcp handler */
13951417
php_stream_xport_register("tcp", php_stream_generic_socket_factory);
13961418

0 commit comments

Comments
 (0)