From: Rudolf Polzer Date: Thu, 5 Aug 2010 07:51:07 +0000 (+0200) Subject: handle an error case X-Git-Tag: xonotic-v0.1.0preview~38^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b016b8bd800cd6171366317e3a3db7a6d5b80243;p=xonotic%2Fd0_blind_id.git handle an error case --- diff --git a/d0_bignum-gmp.c b/d0_bignum-gmp.c index 5f0babc..4e8a11b 100644 --- a/d0_bignum-gmp.c +++ b/d0_bignum-gmp.c @@ -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");