pajoye Tue, 19 Jul 2011 23:01:41 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=313457
Log:
- 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.
Changed paths:
U php/php-src/branches/PHP_5_4/ext/openssl/openssl.c
U php/php-src/trunk/ext/openssl/openssl.c
Modified: php/php-src/branches/PHP_5_4/ext/openssl/openssl.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/openssl/openssl.c 2011-07-19 22:38:04 UTC
(rev 313456)
+++ php/php-src/branches/PHP_5_4/ext/openssl/openssl.c 2011-07-19 23:01:41 UTC
(rev 313457)
@@ -4930,10 +4930,19 @@
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);
Modified: php/php-src/trunk/ext/openssl/openssl.c
===================================================================
--- php/php-src/trunk/ext/openssl/openssl.c 2011-07-19 22:38:04 UTC (rev
313456)
+++ php/php-src/trunk/ext/openssl/openssl.c 2011-07-19 23:01:41 UTC (rev
313457)
@@ -4926,10 +4926,19 @@
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);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php