ports/security/p5-POE-Component-SSLify/patches/patch-lib_POE_Component_SSLify_pm

49 lines
1.5 KiB
Text

From Nigel Gregoire (nfg@github): adds more recent TLS versions
https://github.com/apocalypse/perl-poe-sslify/pull/2/commits/e15bcb93f39e690ad385d89d2f8d2ffd40d852c3
Index: lib/POE/Component/SSLify.pm
--- lib/POE/Component/SSLify.pm.orig
+++ lib/POE/Component/SSLify.pm
@@ -295,6 +295,8 @@ sub Server_SSLify {
#pod * sslv2
#pod * sslv3
#pod * tlsv1
+#pod * tlsv1_1
+#pod * tlsv1_2
#pod * sslv23
#pod * default ( sslv23 )
#pod
@@ -351,21 +353,24 @@ sub SSLify_Options {
return 1;
}
+my %ssl_versions = (
+ sslv2 => \&Net::SSLeay::CTX_v2_new,
+ sslv3 => \&Net::SSLeay::CTX_v3_new,
+ tlsv1 => \&Net::SSLeay::CTX_tlsv1_new,
+ tlsv1_1 => \&Net::SSLeay::CTX_tlsv1_1_new,
+ tlsv1_2 => \&Net::SSLeay::CTX_tlsv1_2_new,
+ # The below are equivalent
+ sslv23 => \&Net::SSLeay::CTX_v23_new,
+ default => \&Net::SSLeay::CTX_new,
+);
+
sub _createSSLcontext {
my( $key, $cert, $version, $options ) = @_;
my $context;
if ( defined $version and ! ref $version ) {
- if ( $version eq 'sslv2' ) {
- $context = Net::SSLeay::CTX_v2_new();
- } elsif ( $version eq 'sslv3' ) {
- $context = Net::SSLeay::CTX_v3_new();
- } elsif ( $version eq 'tlsv1' ) {
- $context = Net::SSLeay::CTX_tlsv1_new();
- } elsif ( $version eq 'sslv23' ) {
- $context = Net::SSLeay::CTX_v23_new();
- } elsif ( $version eq 'default' ) {
- $context = Net::SSLeay::CTX_new();
+ if ($ssl_versions{$version}) {
+ $context = $ssl_versions{$version}->();
} else {
die "unknown SSL version: $version";
}