| 104 | { |
| 105 | public: |
| 106 | CInit() |
| 107 | { |
| 108 | // Init OpenSSL library multithreading support |
| 109 | ppmutexOpenSSL.reset(new CCriticalSection[CRYPTO_num_locks()]); |
| 110 | CRYPTO_set_locking_callback(locking_callback); |
| 111 | |
| 112 | // OpenSSL can optionally load a config file which lists optional loadable modules and engines. |
| 113 | // We don't use them so we don't require the config. However some of our libs may call functions |
| 114 | // which attempt to load the config file, possibly resulting in an exit() or crash if it is missing |
| 115 | // or corrupt. Explicitly tell OpenSSL not to try to load the file. The result for our libs will be |
| 116 | // that the config appears to have been loaded and there are no modules/engines available. |
| 117 | OPENSSL_no_config(); |
| 118 | |
| 119 | #ifdef WIN32 |
| 120 | // Seed OpenSSL PRNG with current contents of the screen |
| 121 | RAND_screen(); |
| 122 | #endif |
| 123 | |
| 124 | // Seed OpenSSL PRNG with performance counter |
| 125 | RandAddSeed(); |
| 126 | } |
| 127 | ~CInit() |
| 128 | { |
| 129 | // Securely erase the memory used by the PRNG |
nothing calls this directly
no test coverage detected