----------------------------------------------------------------------------- Purpose: Wrapper for OpenSSL -----------------------------------------------------------------------------
| 18 | // Purpose: Wrapper for OpenSSL |
| 19 | //----------------------------------------------------------------------------- |
| 20 | class COpenSSLWrapper |
| 21 | { |
| 22 | public: |
| 23 | static void Initialize(); |
| 24 | static void Shutdown(); |
| 25 | static bool BIsOpenSSLInitialized() { return m_nInstances > 0; } |
| 26 | static int GetContextDataIndex() { return s_nContextDataIndex; } |
| 27 | static int GetConnectionDataIndex() { return s_nConnectionDataIndex; } |
| 28 | |
| 29 | |
| 30 | // OpenSSL callback functions for threading |
| 31 | static void OpenSSLLockingCallback( int mode, int type, const char *file, int line ); |
| 32 | static unsigned long OpenSSLThreadIDCallback( void ); |
| 33 | static CRYPTO_dynlock_value* OpenSSLDynLockCreateCallback( const char* file, int line ); |
| 34 | static void OpenSSLDynLockDestroyCallback( CRYPTO_dynlock_value * l, const char *file, int line ); |
| 35 | static void OpenSSLDynLockLockCallback( int mode, CRYPTO_dynlock_value *l, const char* file, int line ); |
| 36 | |
| 37 | #ifdef _DEBUG |
| 38 | // In debug we track OpenSSL memory usage via it's internal mechanism for this |
| 39 | static void *OpenSSLMemLeakCallback( unsigned long order, const char *file, int line, int num_bytes, void * addr ); |
| 40 | static int m_nBytesLeaked; |
| 41 | #endif |
| 42 | |
| 43 | #ifdef DBGFLAG_VALIDATE |
| 44 | static void ValidateStatics( CValidator &validator, const char *pchName ); |
| 45 | #endif |
| 46 | |
| 47 | |
| 48 | private: |
| 49 | // Some statics to track how many context objects exist and to perform one time OpenSSL library initialization |
| 50 | // when needed. |
| 51 | static int m_nInstances; |
| 52 | // VOID to avoid include on engine.h, as it can lead to some conflicts in places we need to include this header |
| 53 | static void *s_pAESNIEngine; |
| 54 | static int s_nContextDataIndex; |
| 55 | static int s_nConnectionDataIndex; |
| 56 | |
| 57 | }; |
| 58 | |
| 59 | |
| 60 | #endif // OPENSSLWRAPPER_H |
nothing calls this directly
no outgoing calls
no test coverage detected