diff options
| author | Pierre Joye <pajoye@php.net> | 2011-07-19 23:01:41 +0000 |
|---|---|---|
| committer | Pierre Joye <pajoye@php.net> | 2011-07-19 23:01:41 +0000 |
| commit | b03817afb5c2bc8808dd402f1d9b0d1e51401da4 (patch) | |
| tree | b7d451f36472cd5caca8adc4797d4c3f59175707 | |
| parent | 8a2736fd77b0566724011d255c0bf21d52e2b0be (diff) | |
| download | php-git-b03817afb5c2bc8808dd402f1d9b0d1e51401da4.tar.gz | |
- re apply the rng change specific to windows, long term it should be a std function but as this function was badly introduced in the 1st place, we have to fix the bad things here instead, pls do not revert again, bad idea.
| -rw-r--r-- | ext/openssl/openssl.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index f8266a381c..b41d04c3bb 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -4930,10 +4930,19 @@ 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); |
