MCPcopy Create free account
hub / github.com/ValveSoftware/GameNetworkingSockets / Initialize

Method Initialize

src/common/opensslwrapper.cpp:62–84  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Purpose: Initialize OpenSSL, may call multiple times and will ref count, call COpenSSLWrapper::Shutdown() a matching number of times. -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

60// call COpenSSLWrapper::Shutdown() a matching number of times.
61//-----------------------------------------------------------------------------
62void COpenSSLWrapper::Initialize()
63{
64 int iStatus;
65
66 // If this is the first instance then we need to do some one time initialization of the OpenSSL library
67 if ( m_nInstances++ == 0 )
68 {
69 s_pMutexArray = new std::recursive_mutex[CRYPTO_num_locks()];
70 CRYPTO_set_locking_callback( COpenSSLWrapper::OpenSSLLockingCallback );
71 CRYPTO_set_id_callback( COpenSSLWrapper::OpenSSLThreadIDCallback );
72
73 CRYPTO_set_dynlock_create_callback( COpenSSLWrapper::OpenSSLDynLockCreateCallback );
74 CRYPTO_set_dynlock_destroy_callback( COpenSSLWrapper::OpenSSLDynLockDestroyCallback );
75 CRYPTO_set_dynlock_lock_callback( COpenSSLWrapper::OpenSSLDynLockLockCallback );
76
77 #ifdef OPENSSL_CUSTOM_RAND
78 RAND_set_rand_method( &RAND_CryptoGenRandom );
79 #endif
80
81 iStatus = RAND_status();
82 AssertMsg( iStatus == 1, "OpenSSL random number system reports not enough entropy" );
83 }
84}
85
86
87//-----------------------------------------------------------------------------

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected