ast_free(args->tls_cfg->cipher);
ast_free(args->tls_cfg->cafile);
ast_free(args->tls_cfg->capath);
+
+ ast_ssl_teardown(args->tls_cfg);
}
ast_free(args->tls_cfg);
ast_free((char *) args->name);
void (*real_CRYPTO_set_locking_callback)(void (*)(int, int, const char *, int));
void (*real_SSL_load_error_strings)(void);
void (*real_ERR_load_SSL_strings)(void);
- void (*real_ERR_load_crypto_strings)(void);
void (*real_ERR_load_BIO_strings)(void);
const char *errstr;
get_OpenSSL_function(ERR_load_SSL_strings);
real_ERR_load_SSL_strings();
- get_OpenSSL_function(ERR_load_crypto_strings);
- real_ERR_load_crypto_strings();
-
get_OpenSSL_function(ERR_load_BIO_strings);
real_ERR_load_BIO_strings();
-#if 0
- /* currently this is just another call to SSL_library_init, so we don't call it */
- OpenSSL_add_all_algorithms();
-#endif
-
startup_complete = 1;
#endif /* HAVE_OPENSSL */
{
int cookie_fd = SSL_get_fd(cookie);
int ret;
+
if (cookie_fd > -1) {
/*
* According to the TLS standard, it is acceptable for an application to only send its shutdown
if ((ret = SSL_shutdown(cookie)) < 0) {
ast_log(LOG_ERROR, "SSL_shutdown() failed: %d\n", SSL_get_error(cookie, ret));
}
+
+ if (!((SSL*)cookie)->server) {
+ /* For client threads, ensure that the error stack is cleared */
+ ERR_remove_state(0);
+ }
+
SSL_free(cookie);
/* adding shutdown(2) here has no added benefit */
if (close(cookie_fd)) {
return 0;
}
- SSL_load_error_strings();
- SSLeay_add_ssl_algorithms();
-
/* Get rid of an old SSL_CTX since we're about to
* allocate a new one
*/
if (!client) {
/* Clients don't need a certificate, but if its setup we can use it */
ast_verb(0, "SSL error loading cert file. <%s>\n", cfg->certfile);
- sleep(2);
cfg->enabled = 0;
SSL_CTX_free(cfg->ssl_ctx);
cfg->ssl_ctx = NULL;
if (!client) {
/* Clients don't need a private key, but if its setup we can use it */
ast_verb(0, "SSL error loading private key file. <%s>\n", tmpprivate);
- sleep(2);
cfg->enabled = 0;
SSL_CTX_free(cfg->ssl_ctx);
cfg->ssl_ctx = NULL;
if (SSL_CTX_set_cipher_list(cfg->ssl_ctx, cfg->cipher) == 0 ) {
if (!client) {
ast_verb(0, "SSL cipher error <%s>\n", cfg->cipher);
- sleep(2);
cfg->enabled = 0;
SSL_CTX_free(cfg->ssl_ctx);
cfg->ssl_ctx = NULL;