X-Git-Url: https://git.openssl.org/?a=blobdiff_plain;f=crypto%2Frand%2Frand_win.c;h=242febe270ba40320b138f6cdfa0bda9269755c0;hb=35a6db86402290a6cbe05fc615e0c435eac40aea;hp=5f71d2da2600eee32f5440bf3c6cfa3473f489ea;hpb=40e15f9d78fef1b3d4295a2b55e61a8c3556c1fe;p=openssl.git diff --git a/crypto/rand/rand_win.c b/crypto/rand/rand_win.c index 5f71d2da26..242febe270 100644 --- a/crypto/rand/rand_win.c +++ b/crypto/rand/rand_win.c @@ -287,9 +287,18 @@ int RAND_poll(void) { /* For entropy count assume only least significant * byte of each DWORD is random. - */ + */ RAND_add(&length, sizeof(length), 0); RAND_add(buf, length, length / 4.0); + + /* Close the Registry Key to allow Windows to cleanup/close + * the open handle + * Note: The 'HKEY_PERFORMANCE_DATA' key is implicitly opened + * when the RegQueryValueEx above is done. However, if + * it is not explicitly closed, it can cause disk + * partition manipulation problems. + */ + RegCloseKey(HKEY_PERFORMANCE_DATA); } if (buf) free(buf); @@ -316,7 +325,7 @@ int RAND_poll(void) if (gen(hProvider, sizeof(buf), buf) != 0) { RAND_add(buf, sizeof(buf), 0); -#ifdef DEBUG +#if 0 printf("randomness from PROV_RSA_FULL\n"); #endif } @@ -329,7 +338,7 @@ int RAND_poll(void) if (gen(hProvider, sizeof(buf), buf) != 0) { RAND_add(buf, sizeof(buf), sizeof(buf)); -#ifdef DEBUG +#if 0 printf("randomness from PROV_INTEL_SEC\n"); #endif } @@ -515,7 +524,7 @@ int RAND_poll(void) FreeLibrary(kernel); } -#ifdef DEBUG +#if 0 printf("Exiting RAND_poll\n"); #endif