mirror of
https://github.com/php/php-src.git
synced 2024-12-26 02:10:46 +08:00
74c0e580ef
CSPRNG implementations should always fail closed. Now openssl_random_pseudo_bytes() will fail closed by throwing an `\Exception` in fail conditions. RFC: https://wiki.php.net/rfc/improve-openssl-random-pseudo-bytes
21 lines
371 B
PHP
21 lines
371 B
PHP
--TEST--
|
|
openssl_random_pseudo_bytes() tests
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("openssl")) print "skip"; ?>
|
|
--FILE--
|
|
<?php
|
|
for ($i = 1; $i < 10; $i++) {
|
|
var_dump(bin2hex(openssl_random_pseudo_bytes($i)));
|
|
}
|
|
?>
|
|
--EXPECTF--
|
|
string(2) "%s"
|
|
string(4) "%s"
|
|
string(6) "%s"
|
|
string(8) "%s"
|
|
string(10) "%s"
|
|
string(12) "%s"
|
|
string(14) "%s"
|
|
string(16) "%s"
|
|
string(18) "%s"
|