Revert change to use a special Windows version of openssl_random_pseudo_bytes().

Lets discuss this on internals first. We're advertising something from the OpenSSL library 
and then subverting it with another Windows OS call.

What are the implications of this? Should we make this available in ext/standard/ instead?
This commit is contained in:
Scott MacVicar 2011-07-19 22:29:55 +00:00
parent 3d10c57cd6
commit 25fb19764a

View File

@ -4926,19 +4926,10 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
buffer = emalloc(buffer_length + 1);
#ifdef PHP_WIN32
strong_result = 1;
/* random/urandom equivalent on Windows */
if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == FAILURE){
efree(buffer);
RETURN_FALSE;
}
#else
if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < 0) {
efree(buffer);
RETURN_FALSE;
}
#endif
buffer[buffer_length] = 0;
RETVAL_STRINGL((char *)buffer, buffer_length, 0);