pajoye Sun, 10 Jul 2011 14:36:32 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=313110
Log: - fix bug #55169, mcrypt_create_iv always fails to gather sufficient random data Bug: https://bugs.php.net/55169 (Open) mcrypt_create_iv always fails to gather sufficient random data Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/win32/winutil.c U php/php-src/branches/PHP_5_4/win32/winutil.c U php/php-src/trunk/win32/winutil.c Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2011-07-10 14:19:51 UTC (rev 313109) +++ php/php-src/branches/PHP_5_3/NEWS 2011-07-10 14:36:32 UTC (rev 313110) @@ -15,6 +15,8 @@ - MCrypt . Change E_ERROR to E_WARNING in mcrypt_create_iv when not enough data has been fetched (Windows). (Pierre) + . Fixed bug #55169 (mcrypt_create_iv always fails to gather sufficient random + data on Windows). (Pierre) - PDO DBlib: . Fixed bug #54329 (MSSql extension memory leak). Modified: php/php-src/branches/PHP_5_3/win32/winutil.c =================================================================== --- php/php-src/branches/PHP_5_3/win32/winutil.c 2011-07-10 14:19:51 UTC (rev 313109) +++ php/php-src/branches/PHP_5_3/win32/winutil.c 2011-07-10 14:36:32 UTC (rev 313110) @@ -87,7 +87,7 @@ #endif if (has_crypto_ctx == 0) { - if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_MACHINE_KEYSET)) { + if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, 0)) { /* Could mean that the key container does not exist, let try again by asking for a new one */ if (GetLastError() == NTE_BAD_KEYSET) { @@ -97,6 +97,8 @@ has_crypto_ctx = 0; } } + } else { + has_crypto_ctx = 1; } } Modified: php/php-src/branches/PHP_5_4/win32/winutil.c =================================================================== --- php/php-src/branches/PHP_5_4/win32/winutil.c 2011-07-10 14:19:51 UTC (rev 313109) +++ php/php-src/branches/PHP_5_4/win32/winutil.c 2011-07-10 14:36:32 UTC (rev 313110) @@ -87,7 +87,7 @@ #endif if (has_crypto_ctx == 0) { - if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_MACHINE_KEYSET)) { + if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, 0)) { /* Could mean that the key container does not exist, let try again by asking for a new one */ if (GetLastError() == NTE_BAD_KEYSET) { @@ -97,6 +97,8 @@ has_crypto_ctx = 0; } } + } else { + has_crypto_ctx = 1; } } Modified: php/php-src/trunk/win32/winutil.c =================================================================== --- php/php-src/trunk/win32/winutil.c 2011-07-10 14:19:51 UTC (rev 313109) +++ php/php-src/trunk/win32/winutil.c 2011-07-10 14:36:32 UTC (rev 313110) @@ -87,7 +87,7 @@ #endif if (has_crypto_ctx == 0) { - if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_MACHINE_KEYSET)) { + if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, 0)) { /* Could mean that the key container does not exist, let try again by asking for a new one */ if (GetLastError() == NTE_BAD_KEYSET) { @@ -97,6 +97,8 @@ has_crypto_ctx = 0; } } + } else { + has_crypto_ctx = 1; } }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php