Blame SOURCES/IO-Socket-SSL-2.059-Fix-building-on-systems-without-TLSv1.3-support.patch

6309f8
From 12ff43c81b10446bd74cc719f0a6913040598c58 Mon Sep 17 00:00:00 2001
6309f8
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
6309f8
Date: Tue, 21 Aug 2018 16:34:39 +0200
6309f8
Subject: [PATCH] Fix building on systems without TLSv1.3 support
6309f8
MIME-Version: 1.0
6309f8
Content-Type: text/plain; charset=UTF-8
6309f8
Content-Transfer-Encoding: 8bit
6309f8
6309f8
If OpenSSL does not support TLSv1.3, Net::SSLeay does not have
6309f8
TLS1_3_VERSION() and t/protocol_version.t fails with:
6309f8
6309f8
    #   Failed test 'Your vendor has not defined SSLeay macro TLS1_3_VERSION at /home/test/fedora/perl-IO-Socket-SSL/IO-Socket-SSL-2.059/blib/lib/IO/Socket/SSL.pm line 2337.
6309f8
    # '
6309f8
    #   at ./t/testlib.pl line 39.
6309f8
6309f8
This patch fixes creating IO::Socket:SSL context for TLSv1.3 by
6309f8
checking whether it's supported by Net::SSLeay.
6309f8
6309f8
Signed-off-by: Petr Písař <ppisar@redhat.com>
6309f8
---
6309f8
 lib/IO/Socket/SSL.pm | 4 ++++
6309f8
 1 file changed, 4 insertions(+)
6309f8
6309f8
diff --git a/lib/IO/Socket/SSL.pm b/lib/IO/Socket/SSL.pm
6309f8
index 5b43467..7138ab0 100644
6309f8
--- a/lib/IO/Socket/SSL.pm
6309f8
+++ b/lib/IO/Socket/SSL.pm
6309f8
@@ -2334,6 +2334,10 @@ sub new {
6309f8
 	# There is no CTX_tlsv1_3_new(). Create TLSv1.3 only context using
6309f8
 	# a flexible method.
6309f8
 	if ($ver eq 'TLSv1_3') {
6309f8
+	    if (!eval {Net::SSLeay::TLS1_3_VERSION()}) {
6309f8
+		return IO::Socket::SSL->_internal_error(
6309f8
+		    "SSL Version $ver not supported",9);
6309f8
+	    }
6309f8
 	    if (!Net::SSLeay::CTX_set_min_proto_version($ctx,
6309f8
 		    Net::SSLeay::TLS1_3_VERSION()) or
6309f8
 		!Net::SSLeay::CTX_set_max_proto_version($ctx,
6309f8
-- 
6309f8
2.14.4
6309f8