import perl-Net-SSLeay-1.90-8.el9

This commit is contained in:
CentOS Sources 2021-11-03 14:03:28 -04:00 committed by Stepan Oksanichenko
commit 3de6995c74
10 changed files with 1287 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/Net-SSLeay-1.90.tar.gz

View File

@ -0,0 +1 @@
675c9df74163d48477ecf06601a589f3c3b096dd SOURCES/Net-SSLeay-1.90.tar.gz

View File

@ -0,0 +1,69 @@
diff -ru Net-SSLeay-1.90.orig/t/local/05_passwd_cb.t Net-SSLeay-1.90/t/local/05_passwd_cb.t
--- Net-SSLeay-1.90.orig/t/local/05_passwd_cb.t 2020-11-18 10:12:44.000000000 +0100
+++ Net-SSLeay-1.90/t/local/05_passwd_cb.t 2021-08-11 12:50:16.452681751 +0200
@@ -5,7 +5,12 @@
use Net::SSLeay;
use Test::Net::SSLeay qw( data_file_path initialise_libssl );
-plan tests => 36;
+my $callback_double_use_in_pem_read_bio_key = check_callback_double_use_in_pem_read_bio_key();
+if (! $callback_double_use_in_pem_read_bio_key) {
+ plan tests => 36;
+} else {
+ plan tests => 40;
+}
initialise_libssl();
@@ -99,7 +104,13 @@
ok( !Net::SSLeay::CTX_use_PrivateKey_file($ctx_1, $key_pem, &Net::SSLeay::FILETYPE_PEM),
'CTX_use_PrivateKey_file doesn\'t work with wrong passphrase' );
-is($cb_1_calls, 2, 'callback1 called 2 times');
+my $right_cb_1_calls;
+if (! $callback_double_use_in_pem_read_bio_key) {
+ $right_cb_1_calls = 2;
+} else {
+ $right_cb_1_calls = 3;
+}
+is($cb_1_calls, $right_cb_1_calls, 'callback1 called '.$right_cb_1_calls.' times');
# OpenSSL 1.1.0 has SSL_set_default_passwd_cb, but the callback is not
@@ -177,5 +188,35 @@
ok( !Net::SSLeay::use_PrivateKey_file($ssl_1, $key_pem, &Net::SSLeay::FILETYPE_PEM),
'use_PrivateKey_file doesn\'t work with wrong passphrase' );
- is($cb_1_calls, 2, 'callback1 called 2 times');
+ my $right_cb_1_calls;
+ if (! $callback_double_use_in_pem_read_bio_key) {
+ $right_cb_1_calls = 2;
+ } else {
+ $right_cb_1_calls = 3;
+ }
+
+ is($cb_1_calls, $right_cb_1_calls, 'callback1 called '.$right_cb_1_calls.' times');
+}
+
+# In OpenSSL between alpha16 and alpha17 was change (7bc027d73bc51cfa0ae23fbfd91134be9464d694)
+# which add one callback call in case of failing pem_read_bio_key_decoder()
+# In OpenSSL between beta1 and beta2 was change (66a7c9f34b46edd462d647ae2febe8276bb9b4f7)
+# which add passphrase caching to avoid asking for password twice
+sub check_callback_double_use_in_pem_read_bio_key {
+ my $ssleay_version = Net::SSLeay::SSLeay_version( Net::SSLeay::SSLEAY_VERSION() );
+ my ($openssl_alpha_version, $openssl_beta_version);
+ if (Net::SSLeay::SSLeay == 0x30000000 && $ssleay_version =~ /-alpha(\d+)\ /) {
+ $openssl_alpha_version = $1;
+ }
+ if (Net::SSLeay::SSLeay == 0x30000000 && $ssleay_version =~ /-beta(\d+)\ /) {
+ $openssl_beta_version = $1;
+ }
+ if ((Net::SSLeay::SSLeay == 0x30000000 && defined $openssl_alpha_version && $openssl_alpha_version < 17)
+ || Net::SSLeay::SSLeay == 0x30000000 && defined $openssl_beta_version && $openssl_beta_version > 1
+ || Net::SSLeay::SSLeay < 0x30000000) {
+
+ return 0;
+ } else {
+ return 1;
+ }
}

View File

@ -0,0 +1,12 @@
diff -ru Net-SSLeay-1.90.orig/t/local/32_x509_get_cert_info.t Net-SSLeay-1.90/t/local/32_x509_get_cert_info.t
--- Net-SSLeay-1.90.orig/t/local/32_x509_get_cert_info.t 2020-11-18 10:12:44.000000000 +0100
+++ Net-SSLeay-1.90/t/local/32_x509_get_cert_info.t 2021-06-02 00:37:27.881748999 +0200
@@ -190,7 +190,7 @@
Net::SSLeay::SSLeay < 0x30000000
|| (
Net::SSLeay::SSLeay == 0x30000000
- && Net::SSLeay::SSLeay_version( Net::SSLeay::SSLEAY_VERSION() ) =~ /-alpha1/
+ && Net::SSLeay::SSLeay_version( Net::SSLeay::SSLEAY_VERSION() ) =~ /-alpha1\ /
)
)
) {

View File

@ -0,0 +1,12 @@
diff -ru Net-SSLeay-1.90.orig/SSLeay.xs Net-SSLeay-1.90/SSLeay.xs
--- Net-SSLeay-1.90.orig/SSLeay.xs 2021-01-21 16:14:11.000000000 +0100
+++ Net-SSLeay-1.90/SSLeay.xs 2021-06-02 01:47:55.724962156 +0200
@@ -4556,7 +4556,7 @@
if (passwd_len>0) {
/* encrypted key */
if (!enc_alg)
- PEM_write_bio_PrivateKey(bp,pk,EVP_des_cbc(),(unsigned char *)passwd,passwd_len,cb,u);
+ PEM_write_bio_PrivateKey(bp,pk,EVP_des_ede(),(unsigned char *)passwd,passwd_len,cb,u);
else
PEM_write_bio_PrivateKey(bp,pk,enc_alg,(unsigned char *)passwd,passwd_len,cb,u);
}

View File

@ -0,0 +1,60 @@
commit 327550f61f5e1e932ea911e59ccc496ebb307030
Author: Chris Novakovic <chris@chrisn.me.uk>
Date: Tue Jun 8 21:49:40 2021 +0100
39_pkcs12.t: validate CA certificate CNs with all libssl versions
When verifying common names in the PKCS#12 certificate chain, account
for the fact that PKCS12_parse() returns the CA certificate chain in a
different order in different versions of libssl.
Since the CA certificate chain tests now cover all versions of OpenSSL
and LibreSSL, don't skip the order check for versions of OpenSSL before
1.0.0, and remove the generic tests that ensure X509_NAME_oneline()
returns a valid-looking common name for each of the CA certificates
(since they're now redundant).
diff --git a/t/local/39_pkcs12.t b/t/local/39_pkcs12.t
index 5c7fb8b..5083331 100644
--- a/t/local/39_pkcs12.t
+++ b/t/local/39_pkcs12.t
@@ -3,7 +3,7 @@ use lib 'inc';
use Net::SSLeay;
use Test::Net::SSLeay qw( data_file_path initialise_libssl );
-plan tests => 19;
+plan tests => 17;
initialise_libssl();
@@ -36,12 +36,24 @@ my $filename3 = data_file_path('simple-cert.p12');
my $ca1_subj_name = Net::SSLeay::X509_get_subject_name($cachain[0]);
my $ca2_subj_name = Net::SSLeay::X509_get_subject_name($cachain[1]);
is(Net::SSLeay::X509_NAME_oneline($subj_name), '/C=PL/O=Net-SSLeay/OU=Test Suite/CN=simple-cert.net-ssleay.example', "X509_NAME_oneline [2/1]");
- like(Net::SSLeay::X509_NAME_oneline($ca1_subj_name), qr/C=.*CN=.*/, "X509_NAME_oneline [2/2]");
- like(Net::SSLeay::X509_NAME_oneline($ca2_subj_name), qr/C=.*CN=.*/, "X509_NAME_oneline [2/3]");
- SKIP: {
- skip("cert order in CA chain is different in openssl pre-1.0.0", 2) unless Net::SSLeay::SSLeay >= 0x01000000;
- is(Net::SSLeay::X509_NAME_oneline($ca1_subj_name), '/C=PL/O=Net-SSLeay/OU=Test Suite/CN=Root CA', "X509_NAME_oneline [2/4]");
- is(Net::SSLeay::X509_NAME_oneline($ca2_subj_name), '/C=PL/O=Net-SSLeay/OU=Test Suite/CN=Intermediate CA', "X509_NAME_oneline [2/5]");
+ # OpenSSL versions 1.0.0-beta2 to 3.0.0-alpha6 inclusive and all versions of
+ # LibreSSL return the CA certificate chain with the root CA certificate at the
+ # end; all other versions return the certificate chain with the root CA
+ # certificate at the start
+ if (
+ Net::SSLeay::SSLeay < 0x10000002
+ || (
+ Net::SSLeay::SSLeay == 0x30000000
+ && Net::SSLeay::SSLeay_version( Net::SSLeay::SSLEAY_VERSION() ) !~ /-alpha[1-6] /
+ )
+ || Net::SSLeay::SSLeay > 0x30000000
+ ) {
+ is(Net::SSLeay::X509_NAME_oneline($ca1_subj_name), '/C=PL/O=Net-SSLeay/OU=Test Suite/CN=Intermediate CA', "X509_NAME_oneline [2/3]");
+ is(Net::SSLeay::X509_NAME_oneline($ca2_subj_name), '/C=PL/O=Net-SSLeay/OU=Test Suite/CN=Root CA', "X509_NAME_oneline [2/4]");
+ }
+ else {
+ is(Net::SSLeay::X509_NAME_oneline($ca1_subj_name), '/C=PL/O=Net-SSLeay/OU=Test Suite/CN=Root CA', "X509_NAME_oneline [2/3]");
+ is(Net::SSLeay::X509_NAME_oneline($ca2_subj_name), '/C=PL/O=Net-SSLeay/OU=Test Suite/CN=Intermediate CA', "X509_NAME_oneline [2/4]");
}
}

View File

@ -0,0 +1,45 @@
diff -ru Net-SSLeay-1.90.orig/t/local/43_misc_functions.t Net-SSLeay-1.90/t/local/43_misc_functions.t
--- Net-SSLeay-1.90.orig/t/local/43_misc_functions.t 2021-01-21 16:14:11.000000000 +0100
+++ Net-SSLeay-1.90/t/local/43_misc_functions.t 2021-06-04 17:30:29.508947419 +0200
@@ -245,6 +245,23 @@
my $ciphersuites = join(':', keys(%tls_1_3_aead_cipher_to_keyblock_size));
+ # In OpenSSL 3.0.0 alpha 11 (commit c1e8a0c66e32b4144fdeb49bd5ff7acb76df72b9) was
+ # changed api of set_ciphersuites to ignore unknown ciphers.
+ my $ret_partially_bad_ciphersuites;
+ my $ssleay_version = Net::SSLeay::SSLeay_version( Net::SSLeay::SSLEAY_VERSION() );
+ my $openssl_alpha_version;
+ if (Net::SSLeay::SSLeay == 0x30000000 && $ssleay_version =~ /-alpha(\d+)\ /) {
+ $openssl_alpha_version = $1;
+ }
+ if ((Net::SSLeay::SSLeay == 0x30000000
+ && defined $openssl_alpha_version && $openssl_alpha_version < 11)
+ || Net::SSLeay::SSLeay < 0x30000000) {
+
+ $ret_partially_bad_ciphersuites = 0;
+ } else {
+ $ret_partially_bad_ciphersuites = 1;
+ }
+
my ($ctx, $rv, $ssl);
$ctx = Net::SSLeay::CTX_new();
$rv = Net::SSLeay::CTX_set_ciphersuites($ctx, $ciphersuites);
@@ -257,7 +271,7 @@
};
is($rv, 1, 'CTX set undef ciphersuites');
$rv = Net::SSLeay::CTX_set_ciphersuites($ctx, 'nosuchthing:' . $ciphersuites);
- is($rv, 0, 'CTX set partially bad ciphersuites');
+ is($rv, $ret_partially_bad_ciphersuites, 'CTX set partially bad ciphersuites');
$rv = Net::SSLeay::CTX_set_ciphersuites($ctx, 'nosuchthing:');
is($rv, 0, 'CTX set bad ciphersuites');
@@ -272,7 +286,7 @@
};
is($rv, 1, 'SSL set undef ciphersuites');
$rv = Net::SSLeay::set_ciphersuites($ssl, 'nosuchthing:' . $ciphersuites);
- is($rv, 0, 'SSL set partially bad ciphersuites');
+ is($rv, $ret_partially_bad_ciphersuites, 'SSL set partially bad ciphersuites');
$rv = Net::SSLeay::set_ciphersuites($ssl, 'nosuchthing:');
is($rv, 0, 'SSL set bad ciphersuites');

View File

@ -0,0 +1,37 @@
diff -ru Net-SSLeay-1.90.orig/t/local/44_sess.t Net-SSLeay-1.90/t/local/44_sess.t
--- Net-SSLeay-1.90.orig/t/local/44_sess.t 2020-12-12 14:55:23.000000000 +0100
+++ Net-SSLeay-1.90/t/local/44_sess.t 2021-06-04 18:50:09.733150048 +0200
@@ -13,13 +13,13 @@
if (not can_fork()) {
plan skip_all => "fork() not supported on this system";
} else {
- plan tests => 58;
+ plan tests => 34;
}
initialise_libssl();
my @rounds = qw(
- TLSv1 TLSv1.1 TLSv1.2 TLSv1.3 TLSv1.3-num-tickets-ssl
+ TLSv1.2 TLSv1.3 TLSv1.3-num-tickets-ssl
TLSv1.3-num-tickets-ctx-6 TLSv1.3-num-tickets-ctx-0
);
diff -ru Net-SSLeay-1.90.orig/t/local/45_exporter.t Net-SSLeay-1.90/t/local/45_exporter.t
--- Net-SSLeay-1.90.orig/t/local/45_exporter.t 2020-12-12 14:55:23.000000000 +0100
+++ Net-SSLeay-1.90/t/local/45_exporter.t 2021-06-04 18:50:13.931192784 +0200
@@ -15,12 +15,12 @@
} elsif (!defined &Net::SSLeay::export_keying_material) {
plan skip_all => "No export_keying_material()";
} else {
- plan tests => 36;
+ plan tests => 18;
}
initialise_libssl();
-my @rounds = qw( TLSv1 TLSv1.1 TLSv1.2 TLSv1.3 );
+my @rounds = qw( TLSv1.2 TLSv1.3 );
my %usable =
map {

View File

@ -0,0 +1,16 @@
--- Makefile.PL
+++ Makefile.PL
@@ -209,7 +209,12 @@ EOM
@{ $opts->{lib_links} } = map { $_ =~ s/32\b//g } @{ $opts->{lib_links} } if $Config{use64bitall};
}
else {
- push @{ $opts->{lib_links} }, qw( ssl crypto z );
+ if ( eval { require ExtUtils::PkgConfig; ExtUtils::PkgConfig->VERSION('1.16') } && ExtUtils::PkgConfig->exists('openssl') ) {
+ push @{ $opts->{lib_links} }, map { s/^-l//; $_ } split(' ', ExtUtils::PkgConfig->libs_only_l('openssl'));
+ }
+ else {
+ push @{ $opts->{lib_links} }, qw( ssl crypto z );
+ }
if (($Config{cc} =~ /aCC/i) && $^O eq 'hpux') {
print "*** Enabling HPUX aCC options (+e)\n";

1034
SPECS/perl-Net-SSLeay.spec Normal file

File diff suppressed because it is too large Load Diff