xref: /php-src/ext/openssl/tests/bug73711.phpt (revision 500b28ad)
1--TEST--
2Bug #73711: Segfault in openssl_pkey_new when generating DSA or DH key
3--EXTENSIONS--
4openssl
5--SKIPIF--
6<?php
7if (!defined("OPENSSL_KEYTYPE_DSA")) die("skip DSA disabled");
8?>
9--FILE--
10<?php
11$config = __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf';
12var_dump(openssl_pkey_new([
13    "private_key_type" => OPENSSL_KEYTYPE_DSA,
14    "private_key_bits" => 1024,
15    'config' => $config,
16]));
17var_dump(openssl_pkey_new([
18    "private_key_type" => OPENSSL_KEYTYPE_DH,
19    "private_key_bits" => 512,
20    'config' => $config,
21]));
22echo "DONE";
23?>
24--EXPECTF--
25object(OpenSSLAsymmetricKey)#%d (0) {
26}
27object(OpenSSLAsymmetricKey)#%d (0) {
28}
29DONE
30