mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Fix GH-19369: openssl_sign() - support for alias digest algs broken
Closes GH-19436
This commit is contained in:
parent
bc475ada13
commit
c8d7318daf
3 changed files with 34 additions and 0 deletions
4
NEWS
4
NEWS
|
@ -20,6 +20,10 @@ PHP NEWS
|
|||
- MySQLi:
|
||||
. The mysqli_execute() alias function has been deprecated. (timwolla)
|
||||
|
||||
- OpenSSL:
|
||||
. Fixed bug GH-19369 (8.5 | Regression in openssl_sign() - support for alias
|
||||
algorithms appears to be broken). (Jakub Zelenka)
|
||||
|
||||
- PDO:
|
||||
. The "uri:" DSN scheme has been deprecated due to security concerns with
|
||||
DSNs coming from remote URIs. (timwolla)
|
||||
|
|
|
@ -713,6 +713,12 @@ zend_string *php_openssl_dh_compute_key(EVP_PKEY *pkey, char *pub_str, size_t pu
|
|||
|
||||
const EVP_MD *php_openssl_get_evp_md_by_name(const char *name)
|
||||
{
|
||||
const EVP_MD *dp = (const EVP_MD *) OBJ_NAME_get(name, OBJ_NAME_TYPE_MD_METH);
|
||||
|
||||
if (dp != NULL) {
|
||||
return dp;
|
||||
}
|
||||
|
||||
return EVP_MD_fetch(PHP_OPENSSL_LIBCTX, name, PHP_OPENSSL_PROPQ);
|
||||
}
|
||||
|
||||
|
|
24
ext/openssl/tests/gh19369.phpt
Normal file
24
ext/openssl/tests/gh19369.phpt
Normal file
|
@ -0,0 +1,24 @@
|
|||
--TEST--
|
||||
GH-19369: openssl_sign with alias algorithms
|
||||
--EXTENSIONS--
|
||||
openssl
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!in_array('sha256WithRSAEncryption', openssl_get_md_methods(true))) {
|
||||
die('skip sha256WithRSAEncryption alias not present');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$digests = openssl_get_md_methods();
|
||||
$digests_and_aliases = openssl_get_md_methods(true);
|
||||
$digest_aliases = array_diff($digests_and_aliases, $digests);
|
||||
|
||||
$data = "Testing openssl_sign() with alias algorithm";
|
||||
$privkey = "file://" . __DIR__ . "/private_rsa_1024.key";
|
||||
|
||||
var_dump(openssl_sign($data, $sign, $privkey, 'sha256WithRSAEncryption'));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
Loading…
Add table
Add a link
Reference in a new issue