xref: /PHP-7.4/ext/openssl/tests/bug80747.phpt (revision ae0585c9)
1--TEST--
2Bug #80747: Providing RSA key size < 512 generates key that crash PHP
3--FILE--
4--SKIPIF--
5<?php
6if (!extension_loaded("openssl")) die("skip openssl not loaded");
7if (OPENSSL_VERSION_NUMBER < 0x10100000) die("skip OpenSSL >= v1.1.0 required");
8?>
9--FILE--
10<?php
11
12$conf = array(
13    'config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf',
14    'private_key_bits' => 511,
15);
16var_dump(openssl_pkey_new($conf));
17while ($e = openssl_error_string()) {
18    echo $e, "\n";
19}
20
21?>
22--EXPECTF--
23bool(false)
24error:%s:key size too small
25