Skip to content
Closed
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
15 changes: 6 additions & 9 deletions ext/openssl/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -7939,11 +7939,10 @@ PHP_OPENSSL_API zend_string* php_openssl_random_pseudo_bytes(zend_long buffer_le
PHP_OPENSSL_CHECK_LONG_TO_INT_NULL_RETURN(buffer_length, length);
PHP_OPENSSL_RAND_ADD_TIME();
if (RAND_bytes((unsigned char*)ZSTR_VAL(buffer), (int)buffer_length) <= 0) {
php_openssl_store_errors();
zend_string_release_ex(buffer, 0);
zend_throw_exception(zend_ce_exception, "Error reading from source device", 0);
return NULL;
} else {
php_openssl_store_errors();
}

return buffer;
Expand All @@ -7960,17 +7959,15 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
RETURN_THROWS();
}

if (zstrong_result_returned) {
ZEND_TRY_ASSIGN_REF_FALSE(zstrong_result_returned);
}

if ((buffer = php_openssl_random_pseudo_bytes(buffer_length))) {
ZSTR_VAL(buffer)[buffer_length] = 0;
RETVAL_NEW_STR(buffer);
}

if (zstrong_result_returned) {
ZEND_TRY_ASSIGN_REF_TRUE(zstrong_result_returned);
if (zstrong_result_returned) {
ZEND_TRY_ASSIGN_REF_TRUE(zstrong_result_returned);
}
} else if (zstrong_result_returned) {
ZEND_TRY_ASSIGN_REF_FALSE(zstrong_result_returned);
}
}
/* }}} */
Loading