diff -rub boost_1_53_0.org/libs/random/src/random_device.cpp boost_1_53_0/libs/random/src/random_device.cpp --- boost_1_53_0.org/libs/random/src/random_device.cpp Tue Apr 5 21:27:52 2011 +++ boost_1_53_0/libs/random/src/random_device.cpp Wed Apr 10 12:33:51 2013 @@ -68,17 +68,23 @@ char buffer[80]; DWORD type; DWORD len; + bool found (false); - // Find the type of the provider + // Find the type of a specific provider for(DWORD i = 0; ; ++i) { len = sizeof(buffer); if(!CryptEnumProvidersA(i, NULL, 0, &type, buffer, &len)) { - error("Could not find provider name"); + if (GetLastError() == ERROR_NO_MORE_ITEMS) break; + continue; } if(buffer == provider) { + found = true; break; } } + if (!found) { + error("Could not find provider name"); + } if(!CryptAcquireContextA(&hProv, NULL, provider.c_str(), type, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {