Merge pull request #4401

cf04d83 add OpenSSL RAND_cleanup() on OpenSSL shutdown (Philip Kaufmann)
This commit is contained in:
Wladimir J. van der Laan 2014-07-07 10:32:24 +02:00
commit 1132cdbff3
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
1 changed files with 4 additions and 2 deletions

View File

@ -121,15 +121,17 @@ public:
CRYPTO_set_locking_callback(locking_callback); CRYPTO_set_locking_callback(locking_callback);
#ifdef WIN32 #ifdef WIN32
// Seed random number generator with screen scrape and other hardware sources // Seed OpenSSL PRNG with current contents of the screen
RAND_screen(); RAND_screen();
#endif #endif
// Seed random number generator with performance counter // Seed OpenSSL PRNG with performance counter
RandAddSeed(); RandAddSeed();
} }
~CInit() ~CInit()
{ {
// Securely erase the memory used by the PRNG
RAND_cleanup();
// Shutdown OpenSSL library multithreading support // Shutdown OpenSSL library multithreading support
CRYPTO_set_locking_callback(NULL); CRYPTO_set_locking_callback(NULL);
for (int i = 0; i < CRYPTO_num_locks(); i++) for (int i = 0; i < CRYPTO_num_locks(); i++)