#include "init.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace { struct TInitSsl { struct TOpensslLocks { inline TOpensslLocks() : Mutexes(CRYPTO_num_locks()) { for (auto& mpref : Mutexes) { mpref.Reset(new TMutex()); } } inline void LockOP(int mode, int n) { auto& mutex = *Mutexes.at(n); if (mode & CRYPTO_LOCK) { mutex.Acquire(); } else { mutex.Release(); } } TVector> Mutexes; }; inline TInitSsl() { OPENSSL_init_crypto(OPENSSL_INIT_NO_ATEXIT, nullptr); } inline ~TInitSsl() { OPENSSL_cleanup(); } static void LockingFunction(int mode, int n, const char* /*file*/, int /*line*/) { Singleton()->LockOP(mode, n); } static unsigned long ThreadIdFunction() { return TThread::CurrentThreadId(); } }; } void InitOpenSSL() { (void)SingletonWithPriority(); }