changeset 10342:ba4baf9b29e2

Windows initialization fixes, tiny change from Adam Strzelecki <ono@java.pl>. lib/gc-gnulib.c: Use CRYPT_VERIFY_CONTEXT. Try to use Intel CSP if present, for intel RND. Return error on failures.
author Simon Josefsson <simon@josefsson.org>
date Tue, 19 Aug 2008 17:02:58 +0200
parents 973c3d3ff40f
children 267a3a1ea894
files ChangeLog lib/gc-gnulib.c
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-19  Adam Strzelecki <ono@java.pl>  (tiny change)
+
+	* lib/gc-gnulib.c: Use CRYPT_VERIFY_CONTEXT.  Try to use Intel CSP
+	if present, for intel RND.  Return error on failures.
+
 2008-08-18  Ben Pfaff  <blp@gnu.org>
 
 	gitlog-to-changelog: give better diagnostic for failed pipe-open
--- a/lib/gc-gnulib.c
+++ b/lib/gc-gnulib.c
@@ -78,6 +78,12 @@
 #  include <windows.h>
 #  include <wincrypt.h>
 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 @@
 # 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