summaryrefslogtreecommitdiff
path: root/tlscommon.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2016-03-06 23:18:21 +0100
committerLinus Nordberg <linus@nordu.net>2016-03-11 16:19:21 +0100
commit24cc012a218dceae88b19e696c014623ed04cc3f (patch)
tree1088b63e21bf728f13f0ac0e5aed659a8903f247 /tlscommon.c
parent3e3123b55ee484f7a67f8dc4b74f58836b5ffb78 (diff)
Use DTLS_method() for new SSL context if it exists.
Effectively turning on support for DTLS 1.2 when OpenSSL version 1.0.2 or higher.
Diffstat (limited to 'tlscommon.c')
-rw-r--r--tlscommon.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tlscommon.c b/tlscommon.c
index 9af5d81..3d27a35 100644
--- a/tlscommon.c
+++ b/tlscommon.c
@@ -217,7 +217,12 @@ static SSL_CTX *tlscreatectx(uint8_t type, struct tls *conf) {
#endif
#ifdef RADPROT_DTLS
case RAD_DTLS:
+#if OPENSSL_VERSION_NUMBER >= 0x10002000
+ /* DTLS_method() seems to have been introduced in OpenSSL 1.0.2. */
+ ctx = SSL_CTX_new(DTLS_method());
+#else
ctx = SSL_CTX_new(DTLSv1_method());
+#endif
#ifdef DEBUG
SSL_CTX_set_info_callback(ctx, ssl_info_callback);
#endif