bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gc-gnulib: Windows initialization fixes


From: Simon Josefsson
Subject: gc-gnulib: Windows initialization fixes
Date: Tue, 19 Aug 2008 17:04:06 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

Pushed.

>From 3c1548f0f31e41ec9e36e349094a59ea3702e08c Mon Sep 17 00:00:00 2001
From: Simon Josefsson <address@hidden>
Date: Tue, 19 Aug 2008 17:02:58 +0200
Subject: [PATCH] Windows initialization fixes, tiny change from Adam Strzelecki 
<address@hidden>.
 lib/gc-gnulib.c: Use CRYPT_VERIFY_CONTEXT.  Try to use Intel CSP
 if present, for intel RND.  Return error on failures.

---
 ChangeLog       |    5 +++++
 lib/gc-gnulib.c |   10 +++++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5e303c7..0b064bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-19  Adam Strzelecki <address@hidden>  (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  <address@hidden>
 
        gitlog-to-changelog: give better diagnostic for failed pipe-open
diff --git a/lib/gc-gnulib.c b/lib/gc-gnulib.c
index fabc663..98214ed 100644
--- 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 @@ 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
 
-- 
1.5.6.3





reply via email to

[Prev in Thread] Current Thread [Next in Thread]