0.30 bump; Modernize spec file

This commit is contained in:
Jitka Plesnikova 2018-06-19 16:53:54 +02:00
parent fbd39ae7bf
commit e026672e8e
5 changed files with 29 additions and 216 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
Crypt-OpenSSL-RSA-0.25.tar.gz
/Crypt-OpenSSL-RSA-0.26.tar.gz
/Crypt-OpenSSL-RSA-0.28.tar.gz
/Crypt-OpenSSL-RSA-0.30.tar.gz

View File

@ -1,185 +0,0 @@
From b3747e625780be90dcff11c2d9e91048016bb4d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 13 Oct 2016 18:14:17 +0200
Subject: [PATCH] Adapt to OpenSSL 1.1.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
OpenSSL 1.1.0 hid structure internals and provided methods for getting
and settting the internal values. This patch modifes the code so that
it can be built with OpenSSL 1.1.0 as well as with the older one.
CPAN RT#117481
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
RSA.xs | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 73 insertions(+), 16 deletions(-)
diff --git a/RSA.xs b/RSA.xs
index de512e7..9bf6f01 100644
--- a/RSA.xs
+++ b/RSA.xs
@@ -49,7 +49,13 @@ void croakSsl(char* p_file, int p_line)
char _is_private(rsaData* p_rsa)
{
- return(p_rsa->rsa->d != NULL);
+ const BIGNUM *d;
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ d = p_rsa->rsa->d;
+#else
+ RSA_get0_key(p_rsa->rsa, NULL, NULL, &d);
+#endif
+ return(d != NULL);
}
SV* make_rsa_obj(SV* p_proto, RSA* p_rsa)
@@ -136,7 +142,7 @@ unsigned char* get_message_digest(SV* text_SV, int hash_method)
}
}
-SV* bn2sv(BIGNUM* p_bn)
+SV* bn2sv(const BIGNUM* p_bn)
{
return p_bn != NULL
? sv_2mortal(newSViv((IV) BN_dup(p_bn)))
@@ -317,6 +323,9 @@ _new_key_from_parameters(proto, n, e, d, p, q)
BN_CTX* ctx;
BIGNUM* p_minus_1 = NULL;
BIGNUM* q_minus_1 = NULL;
+ BIGNUM* dmp1 = NULL;
+ BIGNUM* dmq1 = NULL;
+ BIGNUM* iqmp = NULL;
int error;
CODE:
{
@@ -325,8 +334,10 @@ _new_key_from_parameters(proto, n, e, d, p, q)
croak("At least a modulous and public key must be provided");
}
CHECK_OPEN_SSL(rsa = RSA_new());
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
rsa->n = n;
rsa->e = e;
+#endif
if (p || q)
{
error = 0;
@@ -341,8 +352,12 @@ _new_key_from_parameters(proto, n, e, d, p, q)
q = BN_new();
THROW(BN_div(q, NULL, n, p, ctx));
}
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
rsa->p = p;
rsa->q = q;
+#else
+ THROW(RSA_set0_factors(rsa, p, q));
+#endif
THROW(p_minus_1 = BN_new());
THROW(BN_sub(p_minus_1, p, BN_value_one()));
THROW(q_minus_1 = BN_new());
@@ -353,17 +368,32 @@ _new_key_from_parameters(proto, n, e, d, p, q)
THROW(BN_mul(d, p_minus_1, q_minus_1, ctx));
THROW(BN_mod_inverse(d, e, d, ctx));
}
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
rsa->d = d;
- THROW(rsa->dmp1 = BN_new());
- THROW(BN_mod(rsa->dmp1, d, p_minus_1, ctx));
- THROW(rsa->dmq1 = BN_new());
- THROW(BN_mod(rsa->dmq1, d, q_minus_1, ctx));
- THROW(rsa->iqmp = BN_new());
- THROW(BN_mod_inverse(rsa->iqmp, q, p, ctx));
+#else
+ THROW(RSA_set0_key(rsa, n, e, d));
+#endif
+ THROW(dmp1 = BN_new());
+ THROW(BN_mod(dmp1, d, p_minus_1, ctx));
+ THROW(dmq1 = BN_new());
+ THROW(BN_mod(dmq1, d, q_minus_1, ctx));
+ THROW(iqmp = BN_new());
+ THROW(BN_mod_inverse(iqmp, q, p, ctx));
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ rsa->dmp1 = dmp1;
+ rsa->dmq1 = dmq1;
+ rsa->iqmp = iqmp;
+#else
+ THROW(RSA_set0_crt_params(rsa, dmp1, dmq1, iqmp));
+#endif
+ dmp1 = dmq1 = iqmp = NULL;
THROW(RSA_check_key(rsa) == 1);
err:
if (p_minus_1) BN_clear_free(p_minus_1);
if (q_minus_1) BN_clear_free(q_minus_1);
+ if (dmp1) BN_clear_free(dmp1);
+ if (dmq1) BN_clear_free(dmq1);
+ if (iqmp) BN_clear_free(iqmp);
if (ctx) BN_CTX_free(ctx);
if (error)
{
@@ -373,7 +403,11 @@ _new_key_from_parameters(proto, n, e, d, p, q)
}
else
{
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
rsa->d = d;
+#else
+ CHECK_OPEN_SSL(RSA_set0_key(rsa, n, e, d));
+#endif
}
RETVAL = make_rsa_obj(proto, rsa);
}
@@ -383,18 +417,41 @@ _new_key_from_parameters(proto, n, e, d, p, q)
void
_get_key_parameters(p_rsa)
rsaData* p_rsa;
+PREINIT:
+ const BIGNUM* n;
+ const BIGNUM* e;
+ const BIGNUM* d;
+ const BIGNUM* p;
+ const BIGNUM* q;
+ const BIGNUM* dmp1;
+ const BIGNUM* dmq1;
+ const BIGNUM* iqmp;
PPCODE:
{
RSA* rsa;
rsa = p_rsa->rsa;
- XPUSHs(bn2sv(rsa->n));
- XPUSHs(bn2sv(rsa->e));
- XPUSHs(bn2sv(rsa->d));
- XPUSHs(bn2sv(rsa->p));
- XPUSHs(bn2sv(rsa->q));
- XPUSHs(bn2sv(rsa->dmp1));
- XPUSHs(bn2sv(rsa->dmq1));
- XPUSHs(bn2sv(rsa->iqmp));
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ n = rsa->n;
+ e = rsa->e;
+ d = rsa->d;
+ p = rsa->p;
+ q = rsa->q;
+ dmp1 = rsa->dmp1;
+ dmq1 = rsa->dmq1;
+ iqmp = rsa->iqmp;
+#else
+ RSA_get0_key(rsa, &n, &e, &d);
+ RSA_get0_factors(rsa, &p, &q);
+ RSA_get0_crt_params(rsa, &dmp1, &dmq1, &iqmp);
+#endif
+ XPUSHs(bn2sv(n));
+ XPUSHs(bn2sv(e));
+ XPUSHs(bn2sv(d));
+ XPUSHs(bn2sv(p));
+ XPUSHs(bn2sv(q));
+ XPUSHs(bn2sv(dmp1));
+ XPUSHs(bn2sv(dmq1));
+ XPUSHs(bn2sv(iqmp));
}
SV*
--
2.7.4

View File

@ -1,11 +0,0 @@
--- Crypt-OpenSSL-RSA-0.26/RSA.pm 2009-11-22 12:36:07.000000000 -0800
+++ Crypt-OpenSSL-RSA-0.26.new/RSA.pm 2011-05-12 09:17:11.312502286 -0700
@@ -6,7 +6,7 @@
use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD);
require DynaLoader;
-require AutoLoader;
+use AutoLoader 'AUTOLOAD';
@ISA = qw(DynaLoader);

View File

@ -1,22 +1,33 @@
Name: perl-Crypt-OpenSSL-RSA
Version: 0.28
Release: 21%{?dist}
Version: 0.30
Release: 1%{?dist}
Summary: Perl interface to OpenSSL for RSA
License: GPL+ or Artistic
Group: Development/Libraries
URL: https://metacpan.org/release/Crypt-OpenSSL-RSA
Source0: https://cpan.metacpan.org/authors/id/P/PE/PERLER/Crypt-OpenSSL-RSA-%{version}.tar.gz
# Adjust to OpenSSL 1.1.0, bug #1383650, CPAN RT#117481
Patch0: Crypt-OpenSSL-RSA-0.28-Adapt-to-OpenSSL-1.1.0.patch
BuildRequires: openssl openssl-devel
Source0: https://cpan.metacpan.org/authors/id/T/TO/TODDR/Crypt-OpenSSL-RSA-%{version}.tar.gz
BuildRequires: findutils
BuildRequires: make
BuildRequires: openssl
BuildRequires: openssl-devel
BuildRequires: perl-devel
BuildRequires: perl-generators
BuildRequires: perl-interpreter
BuildRequires: perl(:VERSION) >= 5.6
BuildRequires: perl(Crypt::OpenSSL::Guess) >= 0.11
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76
BuildRequires: perl(strict)
BuildRequires: perl(warnings)
# Run-time
BuildRequires: perl(AutoLoader)
BuildRequires: perl(Carp)
BuildRequires: perl(Crypt::OpenSSL::Bignum)
BuildRequires: perl(Crypt::OpenSSL::Random)
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl(XSLoader)
# Tests
BuildRequires: perl(base)
BuildRequires: perl(Test)
BuildRequires: perl(Test::More)
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Requires: perl(Crypt::OpenSSL::Random)
@ -27,34 +38,31 @@ Crypt::OpenSSL::RSA - RSA encoding and decoding, using the openSSL libraries
%prep
%setup -q -n Crypt-OpenSSL-RSA-%{version}
%patch0 -p1
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
%{__perl} Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1
make %{?_smp_mflags}
%install
rm -rf %{buildroot}
make pure_install PERL_INSTALL_ROOT=%{buildroot}
find %{buildroot} -type f -name .packlist -exec rm -f {} \;
find %{buildroot} -depth -type d -exec rmdir {} 2>/dev/null \;
find %{buildroot} -type f -name '*.bs' -size 0 -exec rm -f {} \;
make pure_install DESTDIR=%{buildroot}
find %{buildroot} -type f -name '*.bs' -size 0 -delete
%{_fixperms} %{buildroot}/*
%check
make test
%files
%defattr(-,root,root,-)
%doc Changes README LICENSE
%license LICENSE
%doc Changes README
%{perl_vendorarch}/auto/*
%{perl_vendorarch}/Crypt/
%{_mandir}/man3/*
%changelog
* Tue Jun 19 2018 Jitka Plesnikova <jplesnik@redhat.com> - 0.30-1
- 0.30 bump
- Modernize spec file
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.28-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

View File

@ -1 +1 @@
86217a5036fc63779c30420b5fd84129 Crypt-OpenSSL-RSA-0.28.tar.gz
SHA512 (Crypt-OpenSSL-RSA-0.30.tar.gz) = 7a6fb6dd3a454f97666f1ccdefae57641b8f79513b8ac3850b5508c27f3ad3195649b2979693e38350ea94d2f405390a77ca893431b2e349d4aa4eb06c0ba11b