1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 15:08:16 +02:00

Merge branch 'PHP-8.0'

* PHP-8.0:
  Fixed bug #80747
This commit is contained in:
Nikita Popov
2021-02-15 15:34:54 +01:00
2 changed files with 21 additions and 0 deletions
+2
View File
@@ -3665,6 +3665,8 @@ static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req
PHP_OPENSSL_RAND_ADD_TIME();
if (rsaparam == NULL || !RSA_generate_key_ex(rsaparam, req->priv_key_bits, bne, NULL)) {
php_openssl_store_errors();
RSA_free(rsaparam);
rsaparam = NULL;
}
BN_free(bne);
if (rsaparam && EVP_PKEY_assign_RSA(req->priv_key, rsaparam)) {
+19
View File
@@ -0,0 +1,19 @@
--TEST--
Bug #80747: Providing RSA key size < 512 generates key that crash PHP
--FILE--
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
?>
--FILE--
<?php
$conf = array(
'config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf',
'private_key_bits' => 511,
);
var_dump(openssl_pkey_new($conf));
?>
--EXPECT--
bool(false)