31#include <openssl/opensslv.h>     
   34#if defined(HAVE_OPENSSL) && \ 
   35    (defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10100000L) 
   38#include <openssl/crypto.h>       
   39#include <openssl/err.h>          
   40#include <openssl/ssl.h>          
   41#if OPENSSL_VERSION_NUMBER < 0x10000000L 
   49#define get_OpenSSL_function(func) do { real_##func = dlsym(RTLD_NEXT, __stringify(func)); } while(0) 
   51static int startup_complete;
 
   55static int ssl_num_locks;
 
   57#if OPENSSL_VERSION_NUMBER < 0x10000000L 
   58static unsigned long ssl_threadid(
void)
 
   60    return (
unsigned long) pthread_self();
 
   64static void ssl_lock(
int mode, 
int n, 
const char *file, 
int line)
 
   66    if (n < 0 || n >= ssl_num_locks) {
 
   68                "ssl_num_locks '%d' - n '%d'\n",
 
   80int SSL_library_init(
void)
 
   82#if defined(AST_DEVMODE) 
   83    if (startup_complete) {
 
   84        ast_debug(1, 
"Called after startup... ignoring!\n");
 
   90void SSL_load_error_strings(
void)
 
   92#if defined(AST_DEVMODE) 
   93    if (startup_complete) {
 
   94        ast_debug(1, 
"Called after startup... ignoring!\n");
 
   99#if OPENSSL_VERSION_NUMBER < 0x10000000L 
  100void CRYPTO_set_id_callback(
unsigned long (*func)(
void))
 
  102#if defined(AST_DEVMODE) 
  103    if (startup_complete) {
 
  104        ast_debug(1, 
"Called after startup... ignoring!\n");
 
  110void CRYPTO_set_locking_callback(
void (*func)(
int mode,
int type, 
const char *file, 
int line))
 
  112#if defined(AST_DEVMODE) 
  113    if (startup_complete) {
 
  114        ast_debug(1, 
"Called after startup... ignoring!\n");
 
  119void ERR_free_strings(
void)
 
  133    int (*real_SSL_library_init)(void);
 
  134#if OPENSSL_VERSION_NUMBER < 0x10000000L 
  135    void (*real_CRYPTO_set_id_callback)(
unsigned long (*)(void));
 
  137    void (*real_CRYPTO_set_locking_callback)(void (*)(int, int, 
const char *, int));
 
  138    void (*real_SSL_load_error_strings)(void);
 
  143    get_OpenSSL_function(SSL_library_init);
 
  144    if ((errstr = dlerror()) != 
NULL) {
 
  145        ast_debug(1, 
"unable to get real address of SSL_library_init: %s\n", errstr);
 
  151        real_SSL_library_init();
 
  156#if OPENSSL_VERSION_NUMBER < 0x10000000L 
  158    get_OpenSSL_function(CRYPTO_set_id_callback);
 
  159    if ((errstr = dlerror()) != 
NULL) {
 
  160        ast_debug(1, 
"unable to get real address of CRYPTO_set_id_callback: %s\n", errstr);
 
  166        real_CRYPTO_set_id_callback(ssl_threadid);
 
  171    get_OpenSSL_function(CRYPTO_set_locking_callback);
 
  172    if ((errstr = dlerror()) != 
NULL) {
 
  173        ast_debug(1, 
"unable to get real address of CRYPTO_set_locking_callback: %s\n", errstr);
 
  179        ssl_num_locks = CRYPTO_num_locks();
 
  180        if (!(ssl_locks = 
ast_calloc(ssl_num_locks, 
sizeof(ssl_locks[0])))) {
 
  183        for (i = 0; i < ssl_num_locks; i++) {
 
  186        real_CRYPTO_set_locking_callback(ssl_lock);
 
  195    get_OpenSSL_function(SSL_load_error_strings);
 
  196    real_SSL_load_error_strings();
 
  198    startup_complete = 1;
 
Prototypes for public functions only of internal interest,.
Asterisk main include file. File version handling, generic pbx functions.
#define ast_calloc(num, len)
A wrapper for calloc()
Support for logging to various files, console and syslog Configuration in file logger....
#define ast_debug(level,...)
Log a DEBUG message.
Asterisk locking-related definitions:
#define ast_mutex_init(pmutex)
#define ast_mutex_unlock(a)
#define ast_mutex_lock(a)
Structure for mutex and tracking information.