From 3c1548f0f31e41ec9e36e349094a59ea3702e08c Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Tue, 19 Aug 2008 17:02:58 +0200 Subject: Windows initialization fixes, tiny change from Adam Strzelecki . lib/gc-gnulib.c: Use CRYPT_VERIFY_CONTEXT. Try to use Intel CSP if present, for intel RND. Return error on failures. --- lib/gc-gnulib.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/gc-gnulib.c') diff --git a/lib/gc-gnulib.c b/lib/gc-gnulib.c index fabc663bca..98214ed15e 100644 --- a/lib/gc-gnulib.c +++ b/lib/gc-gnulib.c @@ -78,6 +78,12 @@ # include # include HCRYPTPROV g_hProv = 0; +# ifndef PROV_INTEL_SEC +# define PROV_INTEL_SEC 22 +# endif +# ifndef CRYPT_VERIFY_CONTEXT +# define CRYPT_VERIFY_CONTEXT 0xF0000000 +# endif # endif #endif @@ -88,7 +94,9 @@ gc_init (void) # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ if(g_hProv) CryptReleaseContext(g_hProv, 0); - CryptAcquireContext(&g_hProv, NULL, NULL, PROV_RSA_FULL, 0); + if(!CryptAcquireContext(&g_hProv, NULL, NULL, PROV_INTEL_SEC, CRYPT_VERIFY_CONTEXT)) + if(!CryptAcquireContext(&g_hProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFY_CONTEXT)) + return GC_RANDOM_ERROR; # endif #endif -- cgit v1.2.1