summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2011-07-10 14:36:32 +0000
committerPierre Joye <pajoye@php.net>2011-07-10 14:36:32 +0000
commit5d5951f2473f5b0b596540631920fda2ac657160 (patch)
tree2d6560290c353f6eb837792b0552c7c6e49bb3b8 /win32
parent8ec6ada08764166ddb195096fd99b1012024033b (diff)
downloadphp-git-5d5951f2473f5b0b596540631920fda2ac657160.tar.gz
- fix bug #55169, mcrypt_create_iv always fails to gather sufficient random data
Diffstat (limited to 'win32')
-rw-r--r--win32/winutil.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/win32/winutil.c b/win32/winutil.c
index adc5d1b66b..c6ec942969 100644
--- a/win32/winutil.c
+++ b/win32/winutil.c
@@ -87,7 +87,7 @@ PHPAPI int php_win32_get_random_bytes(unsigned char *buf, size_t size) { /* {{{
#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 @@ PHPAPI int php_win32_get_random_bytes(unsigned char *buf, size_t size) { /* {{{
has_crypto_ctx = 0;
}
}
+ } else {
+ has_crypto_ctx = 1;
}
}