| 128 | { |
| 129 | public: |
| 130 | CInit() |
| 131 | { |
| 132 | // Init OpenSSL library multithreading support |
| 133 | ppmutexOpenSSL = (CCriticalSection**)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(CCriticalSection*)); |
| 134 | for (int i = 0; i < CRYPTO_num_locks(); i++) |
| 135 | ppmutexOpenSSL[i] = new CCriticalSection(); |
| 136 | CRYPTO_set_locking_callback(locking_callback); |
| 137 | |
| 138 | // OpenSSL can optionally load a config file which lists optional loadable modules and engines. |
| 139 | // We don't use them so we don't require the config. However some of our libs may call functions |
| 140 | // which attempt to load the config file, possibly resulting in an exit() or crash if it is missing |
| 141 | // or corrupt. Explicitly tell OpenSSL not to try to load the file. The result for our libs will be |
| 142 | // that the config appears to have been loaded and there are no modules/engines available. |
| 143 | OPENSSL_no_config(); |
| 144 | |
| 145 | #ifdef WIN32 |
| 146 | // Seed OpenSSL PRNG with current contents of the screen |
| 147 | RAND_screen(); |
| 148 | #endif |
| 149 | |
| 150 | // Seed OpenSSL PRNG with performance counter |
| 151 | RandAddSeed(); |
| 152 | } |
| 153 | ~CInit() |
| 154 | { |
| 155 | // Securely erase the memory used by the PRNG |
nothing calls this directly
no test coverage detected