reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
OpenSSLInit.cxx
Go to the documentation of this file.
1#if defined(HAVE_CONFIG_H)
2 #include "config.h"
3#endif
4
5#include "rutil/Logger.hxx"
6#include "rutil/ResipAssert.h"
7
8#ifdef USE_SSL
9
11
12#include <openssl/opensslv.h>
13#if OPENSSL_VERSION_NUMBER < 0x1010100fL
14#error resip requires OpenSSL 1.1.1 or later
15#endif
16
17#include <openssl/rand.h>
18#include <openssl/err.h>
19#include <openssl/crypto.h>
20#include <openssl/ssl.h>
21
22#define RESIPROCATE_SUBSYSTEM Subsystem::SIP
23
24using namespace resip;
25using namespace std;
26
27#include <iostream>
28
29static bool invokeOpenSSLInit = OpenSSLInit::init(); //.dcm. - only in hxx
30volatile bool OpenSSLInit::mInitialized = false;
31
32bool
34{
35 static OpenSSLInit instance;
36 return true;
37}
38
39OpenSSLInit::OpenSSLInit()
40{
41/* The OpenSSL memory leak checking has been deprecated since
42 OpenSSL v3.0. OpenSSL developers recommend that we rely
43 on modern compilers to provide the same functionality. */
44#if defined(LIBRESSL_VERSION_NUMBER)
45 CRYPTO_malloc_debug_init();
46 CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
47#elif (OPENSSL_VERSION_NUMBER < 0x30000000L)
48 CRYPTO_set_mem_debug(1);
49#endif
50
51#if (OPENSSL_VERSION_NUMBER < 0x30000000L) || defined(LIBRESSL_VERSION_NUMBER)
52 CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
53#endif
54
55 resip_assert(EVP_des_ede3_cbc());
56 mInitialized = true;
57}
58
59OpenSSLInit::~OpenSSLInit()
60{
61 mInitialized = false;
62
63// CRYPTO_mem_leaks_fp(stderr);
64}
65
66#endif
static bool invokeOpenSSLInit
#define resip_assert(x)
This file needs to work for both C and C++ code.
static bool init()
dcm! – add UnusedChecking(_enum) below;