summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2016-06-28 23:26:59 +0200
committerJoshua Colp <jcolp@digium.com>2016-11-30 08:09:21 -0500
commitb0c9f07f040dfa1713899f6b5ad1e3321bd56481 (patch)
tree5fe2c3d2270fd92a24dba36145ce8cf0a73d5691 /main
parenta33ed3327aa7530b9c9dbd98bd575f85c15ec8a4 (diff)
OpenSSL 1.1.0 support
OpenSSL 1.1.0 includes some major changes in the interface. See https://wiki.openssl.org/index.php/1.1_API_Changes . Status: Right now there are still a few deprecation notes with OpenSSL 1.1.0. But it's a start. Changes: * CRYPTO_LOCK is no longer available. Replace it with its value for now. I don't completely understand what it is used for there. * Remove several functions from libasteriskssl that seem to no longer be needed. * Structures have become opaque and are accesses with accessors. * ERR_remove_thread_state() no longer needed. * SSLv2 code now could no longer be used in 1.1. ASTERISK-26109 #close Change-Id: I5e29d477d486ca29b6aae0dc2f5dff960c1cb82b
Diffstat (limited to 'main')
-rw-r--r--main/libasteriskssl.c4
-rw-r--r--main/tcptls.c8
2 files changed, 10 insertions, 2 deletions
diff --git a/main/libasteriskssl.c b/main/libasteriskssl.c
index b3267014b..c4d4c56f4 100644
--- a/main/libasteriskssl.c
+++ b/main/libasteriskssl.c
@@ -67,13 +67,14 @@ static void ssl_lock(int mode, int n, const char *file, int line)
return;
}
- if (mode & CRYPTO_LOCK) {
+ if (mode & 0x1) {
ast_mutex_lock(&ssl_locks[n]);
} else {
ast_mutex_unlock(&ssl_locks[n]);
}
}
+#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < 0x10100000L
int SSL_library_init(void)
{
#if defined(AST_DEVMODE)
@@ -115,6 +116,7 @@ void ERR_free_strings(void)
{
/* we can't allow this to be called, ever */
}
+#endif /* !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < 0x10100000L */
#endif /* HAVE_OPENSSL */
diff --git a/main/tcptls.c b/main/tcptls.c
index bccb03d85..8ca89c8bd 100644
--- a/main/tcptls.c
+++ b/main/tcptls.c
@@ -398,13 +398,19 @@ static int tcptls_stream_close(void *cookie)
SSL_get_error(stream->ssl, res));
}
+#if defined(OPENSSL_API_COMPAT) && OPENSSL_API_COMPAT >= 0x10100000L
+ if (!SSL_is_server(stream->ssl)) {
+#else
if (!stream->ssl->server) {
+#endif
/* For client threads, ensure that the error stack is cleared */
+#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < 0x10100000L
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
ERR_remove_thread_state(NULL);
#else
ERR_remove_state(0);
#endif /* OPENSSL_VERSION_NUMBER >= 0x10000000L */
+#endif /* !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < 0x10100000L */
}
SSL_free(stream->ssl);
@@ -813,7 +819,7 @@ static int __ssl_setup(struct ast_tls_config *cfg, int client)
}
if (client) {
-#ifndef OPENSSL_NO_SSL2
+#if !defined(OPENSSL_NO_SSL2) && (OPENSSL_VERSION_NUMBER < 0x10100000L)
if (ast_test_flag(&cfg->flags, AST_SSL_SSLV2_CLIENT)) {
ast_log(LOG_WARNING, "Usage of SSLv2 is discouraged due to known vulnerabilities. Please use 'tlsv1' or leave the TLS method unspecified!\n");
cfg->ssl_ctx = SSL_CTX_new(SSLv2_client_method());