RTS API Documentation  1.10.11
Functions
switch_ssl.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static int switch_core_cert_extract_fingerprint (void *x509, dtls_fingerprint_t *fp)
 
void switch_ssl_destroy_ssl_locks (void)
 
void switch_ssl_init_ssl_locks (void)
 

Function Documentation

◆ switch_core_cert_extract_fingerprint()

static int switch_core_cert_extract_fingerprint ( void *  x509,
dtls_fingerprint_t fp 
)
inlinestatic

Definition at line 54 of file switch_ssl.h.

References SWITCH_DECLARE, switch_ssl_destroy_ssl_locks(), and switch_ssl_init_ssl_locks().

54 { return 0; }

◆ switch_ssl_destroy_ssl_locks()

void switch_ssl_destroy_ssl_locks ( void  )

Definition at line 85 of file switch_core_cert.c.

References ssl_count, ssl_mutexes, ssl_pool, switch_core_destroy_memory_pool, and switch_mutex_destroy().

Referenced by switch_core_cert_extract_fingerprint(), and switch_core_destroy().

86 {
87  int i;
88 
89  if (ssl_count == 1) {
90  CRYPTO_set_locking_callback(NULL);
91  for (i = 0; i < CRYPTO_num_locks(); i++) {
92  if (ssl_mutexes[i]) {
94  }
95  }
96 
97  OPENSSL_free(ssl_mutexes);
98  ssl_count--;
99  }
100 
101  if (ssl_pool) {
103  }
104 }
switch_status_t switch_mutex_destroy(switch_mutex_t *lock)
Definition: switch_apr.c:303
static int ssl_count
#define switch_core_destroy_memory_pool(p)
Returns a subpool back to the main pool.
Definition: switch_core.h:642
static switch_mutex_t ** ssl_mutexes
static switch_memory_pool_t * ssl_pool

◆ switch_ssl_init_ssl_locks()

void switch_ssl_init_ssl_locks ( void  )

Definition at line 58 of file switch_core_cert.c.

References ssl_count, ssl_mutexes, ssl_pool, switch_assert, switch_core_new_memory_pool, switch_mutex_init(), SWITCH_MUTEX_NESTED, switch_ssl_ssl_lock_callback(), and switch_ssl_ssl_thread_id().

Referenced by switch_core_cert_extract_fingerprint(), and switch_core_init().

59 {
60 
61  int i, num;
62 
63  if (ssl_count == 0) {
64  num = CRYPTO_num_locks();
65 
66  ssl_mutexes = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(switch_mutex_t*));
67  switch_assert(ssl_mutexes != NULL);
68 
70 
71  for (i = 0; i < num; i++) {
73  switch_assert(ssl_mutexes[i] != NULL);
74  }
75 
76 #if OPENSSL_VERSION_NUMBER <= 0x10100000
77  CRYPTO_THREADID_set_callback(switch_ssl_ssl_thread_id);
78  CRYPTO_set_locking_callback((void (*)(int, int, const char*, int))switch_ssl_ssl_lock_callback);
79 #endif
80  }
81 
82  ssl_count++;
83 }
#define switch_core_new_memory_pool(p)
Create a new sub memory pool from the core&#39;s master pool.
Definition: switch_core.h:633
static void switch_ssl_ssl_thread_id(CRYPTO_THREADID *id)
static int ssl_count
static switch_mutex_t ** ssl_mutexes
#define SWITCH_MUTEX_NESTED
Definition: switch_apr.h:318
switch_status_t switch_mutex_init(switch_mutex_t **lock, unsigned int flags, switch_memory_pool_t *pool)
Definition: switch_apr.c:293
struct fspr_thread_mutex_t switch_mutex_t
Definition: switch_apr.h:314
static void switch_ssl_ssl_lock_callback(int mode, int type, char *file, int line)
static switch_memory_pool_t * ssl_pool
#define switch_assert(expr)