Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/random/engine_mt19937.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ PHP_METHOD(Random_Engine_Mt19937, __construct)

if (seed_is_null) {
/* MT19937 has a very large state, uses CSPRNG for seeding only */
if (php_random_bytes_silent(&seed, sizeof(zend_long)) == FAILURE) {
zend_throw_exception(spl_ce_RuntimeException, "Random number generation failed", 0);
if (php_random_bytes_throw(&seed, sizeof(zend_long)) == FAILURE) {
zend_throw_exception(spl_ce_RuntimeException, "Failed to generate a random seed", 0);
RETURN_THROWS();
}
}
Expand Down
4 changes: 2 additions & 2 deletions ext/random/engine_pcgoneseq128xslrr64.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ PHP_METHOD(Random_Engine_PcgOneseq128XslRr64, __construct)
ZEND_PARSE_PARAMETERS_END();

if (seed_is_null) {
if (php_random_bytes_silent(&state->state, sizeof(php_random_uint128_t)) == FAILURE) {
zend_throw_exception(spl_ce_RuntimeException, "Random number generation failed", 0);
if (php_random_bytes_throw(&state->state, sizeof(php_random_uint128_t)) == FAILURE) {
zend_throw_exception(spl_ce_RuntimeException, "Failed to generate a random seed", 0);
RETURN_THROWS();
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions ext/random/engine_xoshiro256starstar.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ PHP_METHOD(Random_Engine_Xoshiro256StarStar, __construct)
ZEND_PARSE_PARAMETERS_END();

if (seed_is_null) {
if (php_random_bytes_silent(&state->state, 32) == FAILURE) {
zend_throw_exception(spl_ce_RuntimeException, "Random number generation failed", 0);
if (php_random_bytes_throw(&state->state, 32) == FAILURE) {
zend_throw_exception(spl_ce_RuntimeException, "Failed to generate a random seed", 0);
RETURN_THROWS();
}
} else {
Expand Down