]> git.rm.cloudns.org Git - xonotic/d0_blind_id.git/commitdiff
handle an error case
authorRudolf Polzer <divverent@alientrap.org>
Thu, 5 Aug 2010 07:51:07 +0000 (09:51 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Thu, 5 Aug 2010 07:51:07 +0000 (09:51 +0200)
d0_bignum-gmp.c

index 5f0babc088f82423946ab22e4d8142cb67760be6..4e8a11b68ab47b6322a879fd6c3ea2c58ca08d84 100644 (file)
@@ -54,9 +54,18 @@ void d0_bignum_INITIALIZE(void)
                {
                        if(!CryptGenRandom(hCryptProv, sizeof(buf), (PBYTE) &buf[0]))
                                fprintf(stderr, "WARNING: could not initialize random number generator (CryptGenRandom failed)\n");
+                       CryptReleaseContext(hCryptProv, 0);
                }
                else
+               {
+                       if(CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_NEWKEYSET))
+                       {
+                               if(!CryptGenRandom(hCryptProv, sizeof(buf), (PBYTE) &buf[0]))
+                                       fprintf(stderr, "WARNING: could not initialize random number generator (CryptGenRandom failed)\n");
+                               CryptReleaseContext(hCryptProv, 0);
+                       }
                        fprintf(stderr, "WARNING: could not initialize random number generator (CryptAcquireContext failed)\n");
+               }
        }
 #else
        f = fopen("/dev/urandom", "rb");