diff --git a/Net-SNMP-v6.0.1-Rewrite_from_Digest-SHA1-to-Digest-SHA.patch b/Net-SNMP-v6.0.1-Rewrite_from_Digest-SHA1-to-Digest-SHA.patch new file mode 100644 index 0000000..b82139b --- /dev/null +++ b/Net-SNMP-v6.0.1-Rewrite_from_Digest-SHA1-to-Digest-SHA.patch @@ -0,0 +1,127 @@ +From dbb8c0a1fe27bb250c8a34a8f83ace87de34eec3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michal=20Josef=20=C5=A0pa=C4=8Dek?= + +Date: Wed, 13 Mar 2024 12:13:44 +0100 +Subject: [PATCH 10/11] Rewrite from Digest::SHA1 to Digest::SHA + +Digest::SHA is most actual in CPAN. +All changes are covered by tests. +--- + Build.PL | 2 +- + META.yml | 2 +- + Makefile.PL | 2 +- + README | 2 +- + lib/Net/SNMP.pm | 4 ++-- + lib/Net/SNMP/Security/USM.pm | 8 ++++---- + 6 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/Build.PL b/Build.PL +index a8ae8dd..3140545 100644 +--- a/Build.PL ++++ b/Build.PL +@@ -38,7 +38,7 @@ Module::Build->new( + recommends => { + Crypt::DES => '2.03', # SNMPv3 + Digest::MD5 => '2.11', # SNMPv3 +- Digest::SHA1 => '1.02', # SNMPv3 ++ Digest::SHA => 0, # SNMPv3 + Digest::HMAC_MD5 => '1.01', # SNMPv3 + Digest::HMAC_SHA1 => '1.03', # SNMPv3 + Crypt::Rijndael => '1.02', # SNMPv3 - AES Cipher Algorithm +diff --git a/META.yml b/META.yml +index 0b1acd7..42fbc5f 100644 +--- a/META.yml ++++ b/META.yml +@@ -65,7 +65,7 @@ recommends: + Digest::HMAC_MD5: '1.01' + Digest::HMAC_SHA1: '1.03' + Digest::MD5: '2.11' +- Digest::SHA1: '1.02' ++ Digest::SHA: '0' + requires: + Carp: '0' + Errno: '0' +diff --git a/Makefile.PL b/Makefile.PL +index 516b2f9..3b134c4 100644 +--- a/Makefile.PL ++++ b/Makefile.PL +@@ -40,7 +40,7 @@ WriteMakefile( + Math::BigInt => 0, + Crypt::DES => '2.03', # SNMPv3 + Digest::MD5 => '2.11', # SNMPv3 +- Digest::SHA1 => '1.02', # SNMPv3 ++ Digest::SHA => 0, # SNMPv3 + Digest::HMAC_MD5 => '1.01', # SNMPv3 + Digest::HMAC_SHA1 => '1.03', # SNMPv3 + Socket => '2.000', +diff --git a/README b/README +index 7f23ea0..b5d02bc 100644 +--- a/README ++++ b/README +@@ -53,7 +53,7 @@ REQUIREMENTS + Net::SNMP uses syntax that is not supported in versions of Perl + earlier than v5.6.0. + +- The non-core modules Crypt::DES, Digest::MD5, Digest::SHA1, and ++ The non-core modules Crypt::DES, Digest::MD5, Digest::SHA, and + Digest::HMAC are needed to support SNMPv3. + + In order to support the AES Cipher Algorithm as a SNMPv3 privacy +diff --git a/lib/Net/SNMP.pm b/lib/Net/SNMP.pm +index 1f69630..53ddda9 100644 +--- a/lib/Net/SNMP.pm ++++ b/lib/Net/SNMP.pm +@@ -3550,8 +3550,8 @@ earlier than v5.6.0. + + =item * + +-The non-core modules F, F, F, and +-F are required to support SNMPv3. ++The non-core modules F, F, F, and ++F are required to support SNMPv3. + + =item * + +diff --git a/lib/Net/SNMP/Security/USM.pm b/lib/Net/SNMP/Security/USM.pm +index 0a2ab34..a76ef56 100644 +--- a/lib/Net/SNMP/Security/USM.pm ++++ b/lib/Net/SNMP/Security/USM.pm +@@ -25,7 +25,7 @@ use Net::SNMP::Message qw( + + use Crypt::DES(); + use Digest::MD5(); +-use Digest::SHA1(); ++use Digest::SHA(); + use Digest::HMAC_MD5(); + use Digest::HMAC_SHA1(); + +@@ -1392,7 +1392,7 @@ sub _priv_data_init_3desede + if ($this->{_auth_protocol} eq AUTH_PROTOCOL_HMACMD5) { + $this->{_priv_data}->{hash} = Digest::MD5->new(); + } elsif ($this->{_auth_protocol} eq AUTH_PROTOCOL_HMACSHA) { +- $this->{_priv_data}->{hash} = Digest::SHA1->new(); ++ $this->{_priv_data}->{hash} = Digest::SHA->new(); + } + + return TRUE; +@@ -1682,7 +1682,7 @@ sub _priv_key_generate + if ($this->{_auth_protocol} eq AUTH_PROTOCOL_HMACMD5) { + $hnnn = Digest::MD5->new(); + } elsif ($this->{_auth_protocol} eq AUTH_PROTOCOL_HMACSHA) { +- $hnnn = Digest::SHA1->new(); ++ $hnnn = Digest::SHA->new(); + } else { + return $this->_error( + 'The authProtocol "%s" is unknown', $this->{_auth_protocol} +@@ -1784,7 +1784,7 @@ sub _password_localize + my $digests = + { + AUTH_PROTOCOL_HMACMD5, 'Digest::MD5', +- AUTH_PROTOCOL_HMACSHA, 'Digest::SHA1', ++ AUTH_PROTOCOL_HMACSHA, 'Digest::SHA', + }; + + if (!exists $digests->{$this->{_auth_protocol}}) { +-- +2.45.1 + diff --git a/perl-Net-SNMP.spec b/perl-Net-SNMP.spec index 03b4040..acb92b0 100644 --- a/perl-Net-SNMP.spec +++ b/perl-Net-SNMP.spec @@ -10,6 +10,7 @@ Patch0: Net-SNMP-v6.0.1-Switch_from_Socket6_to_Socket.patch Patch1: Net-SNMP-v6.0.1-Simple_rewrite_to_Digest-HMAC-helpers.patch Patch2: Net-SNMP-v6.0.1-Split_usm.t_to_two_parts.patch Patch3: Net-SNMP-v6.0.1-Add_tests_for_another_usm_scenarios.patch +Patch4: Net-SNMP-v6.0.1-Rewrite_from_Digest-SHA1-to-Digest-SHA.patch BuildArch: noarch BuildRequires: coreutils @@ -45,12 +46,11 @@ Requires: perl(Crypt::DES) >= 2.03 Requires: perl(Digest::HMAC_MD5) => 1.01 Requires: perl(Digest::HMAC_SHA1) => 1.03 Requires: perl(Digest::MD5) >= 2.11 -Requires: perl(Digest::SHA1) >= 1.02 # Optional run-time: # Crypt::Rijndael 1.02 # Filter under-specified dependencies -%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\((Crypt::DES|Digest::HMAC_MD5|Digest::HMAC_SHA1|Digest::MD5|Digest::SHA1)\\)$ +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\((Crypt::DES|Digest::HMAC_MD5|Digest::HMAC_SHA1|Digest::MD5)\\)$ %description The Net::SNMP module implements an object oriented interface to the @@ -79,6 +79,7 @@ with "%{_libexecdir}/%{name}/test". %patch -P1 -p1 %patch -P2 -p1 %patch -P3 -p1 +%patch -P4 -p1 perl -MConfig -pi -e 's|^#!.*perl|$Config{startperl}|' examples/*.pl chmod -c a-x examples/*.pl @@ -130,6 +131,7 @@ make test %changelog * Tue Jun 27 2024 Michal Josef Špaček - 6.0.1-42 - Add patch to add tests for other USM scenarios +- Add patch to rewrite from Digest::SHA1 to Digest::SHA - Add patch to rewrite usage of HMAC with same dependencies - Add patch to split test files for better readability - Improve patch for switch from Socket6 to Socket