FreeSWITCH API Documentation  1.7.0
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

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

Definition at line 53 of file switch_ssl.h.

53 { return 0; }
void switch_ssl_destroy_ssl_locks ( void  )

Definition at line 79 of file switch_core_cert.c.

References ssl_count, ssl_mutexes, and switch_mutex_destroy().

Referenced by switch_core_destroy().

80 {
81  int i;
82 
83  if (ssl_count == 1) {
84  CRYPTO_set_locking_callback(NULL);
85  for (i = 0; i < CRYPTO_num_locks(); i++) {
86  if (ssl_mutexes[i]) {
88  }
89  }
90 
91  OPENSSL_free(ssl_mutexes);
92  ssl_count--;
93  }
94 }
switch_status_t switch_mutex_destroy(switch_mutex_t *lock)
Definition: switch_apr.c:280
static int ssl_count
static switch_mutex_t ** ssl_mutexes
void switch_ssl_init_ssl_locks ( void  )

Definition at line 54 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_init().

55 {
56 
57  int i, num;
58 
59  if (ssl_count == 0) {
60  num = CRYPTO_num_locks();
61 
62  ssl_mutexes = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(switch_mutex_t*));
63  switch_assert(ssl_mutexes != NULL);
64 
66 
67  for (i = 0; i < num; i++) {
69  switch_assert(ssl_mutexes[i] != NULL);
70  }
71 
72  CRYPTO_set_id_callback(switch_ssl_ssl_thread_id);
73  CRYPTO_set_locking_callback((void (*)(int, int, const char*, int))switch_ssl_ssl_lock_callback);
74  }
75 
76  ssl_count++;
77 }
#define switch_core_new_memory_pool(p)
Create a new sub memory pool from the core's master pool.
Definition: switch_core.h:631
static int ssl_count
static unsigned long switch_ssl_ssl_thread_id(void)
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:270
struct apr_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)