summaryrefslogtreecommitdiff
path: root/lib/gc-gnulib.c
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2008-08-19 17:02:58 +0200
committerSimon Josefsson <simon@josefsson.org>2008-08-19 17:02:58 +0200
commit3c1548f0f31e41ec9e36e349094a59ea3702e08c (patch)
tree2699f88435c2a39b2e10b7c024deb0ebd6135607 /lib/gc-gnulib.c
parent9462d43fbc0d873ee7e667ba952616d53b8585e4 (diff)
downloadgnulib-3c1548f0f31e41ec9e36e349094a59ea3702e08c.tar.gz
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.
Diffstat (limited to 'lib/gc-gnulib.c')
-rw-r--r--lib/gc-gnulib.c10
1 files changed, 9 insertions, 1 deletions
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 <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