summaryrefslogtreecommitdiff
path: root/dev-perl/Crypt-OpenSSL-RSA
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /dev-perl/Crypt-OpenSSL-RSA
reinit the tree, so we can have metadata
Diffstat (limited to 'dev-perl/Crypt-OpenSSL-RSA')
-rw-r--r--dev-perl/Crypt-OpenSSL-RSA/Crypt-OpenSSL-RSA-0.280.0-r3.ebuild29
-rw-r--r--dev-perl/Crypt-OpenSSL-RSA/Manifest6
-rw-r--r--dev-perl/Crypt-OpenSSL-RSA/files/Crypt-OpenSSL-RSA-0.280.0-openssl-1.1.0.patch256
-rw-r--r--dev-perl/Crypt-OpenSSL-RSA/metadata.xml12
4 files changed, 303 insertions, 0 deletions
diff --git a/dev-perl/Crypt-OpenSSL-RSA/Crypt-OpenSSL-RSA-0.280.0-r3.ebuild b/dev-perl/Crypt-OpenSSL-RSA/Crypt-OpenSSL-RSA-0.280.0-r3.ebuild
new file mode 100644
index 000000000000..f0f369438ef5
--- /dev/null
+++ b/dev-perl/Crypt-OpenSSL-RSA/Crypt-OpenSSL-RSA-0.280.0-r3.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+MODULE_AUTHOR=PERLER
+MODULE_VERSION=0.28
+inherit perl-module
+
+DESCRIPTION="Crypt::OpenSSL::RSA module for perl"
+
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="libressl"
+
+RDEPEND="dev-perl/Crypt-OpenSSL-Bignum
+ dev-perl/Crypt-OpenSSL-Random
+ !libressl? ( dev-libs/openssl:0 )
+ libressl? ( dev-libs/libressl )
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+ "${FILESDIR}/${P}-openssl-1.1.0.patch"
+)
+
+SRC_TEST="do"
+
+mydoc="rfc*.txt"
diff --git a/dev-perl/Crypt-OpenSSL-RSA/Manifest b/dev-perl/Crypt-OpenSSL-RSA/Manifest
new file mode 100644
index 000000000000..ea36edafc1af
--- /dev/null
+++ b/dev-perl/Crypt-OpenSSL-RSA/Manifest
@@ -0,0 +1,6 @@
+AUX Crypt-OpenSSL-RSA-0.280.0-openssl-1.1.0.patch 6969 SHA256 6039fc517cb7fb91123a4009fa553e01fde006b50718fe9d55aa9e89a01ea070 SHA512 9006464a2e8037b0e712e90bcbea89e764cfd2d3ed41479f8efc1b9bde4899bd1dbf5197577c20fc286d8577a9bdfd730d5676de122249eb786d63e0c3c70880 WHIRLPOOL e607c1e253b25cecd01fa96ab7713c70e2a0b4322314acc6aef015adc97c28c1a0c8f321fcb41907be219be4904b796c9570f54315ad91d674a21ad2b03f5c61
+DIST Crypt-OpenSSL-RSA-0.28.tar.gz 20035 SHA256 5357f977464bb3a8184cf2d3341851a10d5515b4b2b0dfb88bf78995c0ded7be SHA512 4a20c3f814e80ea15304b2a189001172e72237d703a0f9281e7e46d593c521508abfac3a259701994ec867f160821bec37e4e8234d04b792168db19b065ce324 WHIRLPOOL 5c935e5dc7350712ee1ac514dea4dbc3a3107654ba759346f4acc0bd3a77cb82d14725fd922c0417b47beb6b6375254f89177e88e100a3959ae7f320ddcb826a
+EBUILD Crypt-OpenSSL-RSA-0.280.0-r3.ebuild 647 SHA256 9b672910ae6c5ba7463f851f345f0b7c34857b322fc18e863c06bca470cd593c SHA512 c3490e1278f840376a3e22b6b8d6ce262bf7ebcee81fd8fbe2a9c419be9cb9efb7ba5a68ffe2155fa1070bf501751956d44bdeaa5818b257103bdd5cbb264e6e WHIRLPOOL 5289fdb216195b23aaa8bcc3a0c1a3fec12ae2f44664dcb52c88a5616e6a672864c1460a2a751d9c189902ef5c2ed4c26684e60046888eff462725b33208611f
+MISC ChangeLog 3102 SHA256 f59da666978eac7d0eb1186eef3298d0ea3708424d2d11f4a481cd2f247fcad1 SHA512 ba84ebe3ea67cc8038b80da78cd6408caad8fbc0b81fce3e1818ae882441b21ac17b015643dfbeda745fba019d027ce595a8045f670878d79e2bc39c7de9a55f WHIRLPOOL 8c59c1f74fab57bbfe86668d721f5c559d86fc34ccdaea8e8fdfe394f2822af47a430f4692ceb41fa8524a6a4381960d9463682fe95d2f8d94a00b9e6d93d11c
+MISC ChangeLog-2015 10881 SHA256 c668bc8a4944e6ab93b3aa3a77e03f3f8b05b06a8b5b20ff9fd7195c8e5f5f3e SHA512 adb9e52560a1229199925e78a82aeeba75a35aefc091e4098d48da3121c16c8f28b31c4a9aa6b48c9ea6b514ed13164f9e86b30bcb077e43555b900fcb73eadf WHIRLPOOL e7e7ea0524bbca6ba0b1c559a011133d0b8d2917ea42d3fc0c03aeb64d7b0acf033a251a72c348265326f53ac648f8c4e3c5fa975e658db9cff5a500a34b483b
+MISC metadata.xml 407 SHA256 f27b609f69c0baaf0f07de9f2002b218f224baa4a777e37cc2aab29a597b3c24 SHA512 5cd69acf50b1ec86397e96b03d6aca318669f83b7a6276231572634622e889479330e741ac7a858a5c4fd633f40b5c4ca7cc0bc40e6cfc8eb02bee827eabb9a2 WHIRLPOOL 2ee66129ec83d28b5a5af1efeeda8c2999b000a1b330b2fe6d30dd7068ddb2268d2ddaaedf7b57a86e63d70976d167fe319d5a2ec0a0749bc1510ad8d25982d0
diff --git a/dev-perl/Crypt-OpenSSL-RSA/files/Crypt-OpenSSL-RSA-0.280.0-openssl-1.1.0.patch b/dev-perl/Crypt-OpenSSL-RSA/files/Crypt-OpenSSL-RSA-0.280.0-openssl-1.1.0.patch
new file mode 100644
index 000000000000..719ef2824d67
--- /dev/null
+++ b/dev-perl/Crypt-OpenSSL-RSA/files/Crypt-OpenSSL-RSA-0.280.0-openssl-1.1.0.patch
@@ -0,0 +1,256 @@
+From fdbda9585f5c99670912e5c0517dbc7a9d92c74b Mon Sep 17 00:00:00 2001
+From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
+Date: Sat, 1 Oct 2016 19:52:44 +0000
+Subject: [PATCH] libcrypt-openssl-rsa-perl: get it compiled with openssl 1.1.0
+
+Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
+
+Bug: https://rt.cpan.org/Public/Bug/Display.html?id=117481
+Bug-Debian: https://bugs.debian.org/828387
+
+---
+ RSA.xs | 173 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------
+ 1 file changed, 150 insertions(+), 23 deletions(-)
+
+diff --git a/RSA.xs b/RSA.xs
+index de512e7822d0..b384cb0e23a2 100644
+--- a/RSA.xs
++++ b/RSA.xs
+@@ -47,9 +47,119 @@ void croakSsl(char* p_file, int p_line)
+
+ #define THROW(p_result) if (!(p_result)) { error = 1; goto err; }
+
++#if OPENSSL_VERSION_NUMBER < 0x10100000 || defined(LIBRESSL_VERSION_NUMBER)
++
++static void RSA_get0_key(const RSA *r,
++ const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
++{
++ if (n != NULL)
++ *n = r->n;
++ if (e != NULL)
++ *e = r->e;
++ if (d != NULL)
++ *d = r->d;
++}
++
++static int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d)
++{
++ /* If the fields n and e in r are NULL, the corresponding input
++ * parameters MUST be non-NULL for n and e. d may be
++ * left NULL (in case only the public key is used).
++ */
++ if ((r->n == NULL && n == NULL)
++ || (r->e == NULL && e == NULL))
++ return 0;
++
++ if (n != NULL) {
++ BN_free(r->n);
++ r->n = n;
++ }
++ if (e != NULL) {
++ BN_free(r->e);
++ r->e = e;
++ }
++ if (d != NULL) {
++ BN_free(r->d);
++ r->d = d;
++ }
++
++ return 1;
++}
++
++static int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q)
++{
++ /* If the fields p and q in r are NULL, the corresponding input
++ * parameters MUST be non-NULL.
++ */
++ if ((r->p == NULL && p == NULL)
++ || (r->q == NULL && q == NULL))
++ return 0;
++
++ if (p != NULL) {
++ BN_free(r->p);
++ r->p = p;
++ }
++ if (q != NULL) {
++ BN_free(r->q);
++ r->q = q;
++ }
++
++ return 1;
++}
++
++static void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q)
++{
++ if (p != NULL)
++ *p = r->p;
++ if (q != NULL)
++ *q = r->q;
++}
++
++static int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp)
++{
++ /* If the fields dmp1, dmq1 and iqmp in r are NULL, the corresponding input
++ * parameters MUST be non-NULL.
++ */
++ if ((r->dmp1 == NULL && dmp1 == NULL)
++ || (r->dmq1 == NULL && dmq1 == NULL)
++ || (r->iqmp == NULL && iqmp == NULL))
++ return 0;
++
++ if (dmp1 != NULL) {
++ BN_free(r->dmp1);
++ r->dmp1 = dmp1;
++ }
++ if (dmq1 != NULL) {
++ BN_free(r->dmq1);
++ r->dmq1 = dmq1;
++ }
++ if (iqmp != NULL) {
++ BN_free(r->iqmp);
++ r->iqmp = iqmp;
++ }
++
++ return 1;
++}
++
++static void RSA_get0_crt_params(const RSA *r,
++ const BIGNUM **dmp1, const BIGNUM **dmq1,
++ const BIGNUM **iqmp)
++{
++ if (dmp1 != NULL)
++ *dmp1 = r->dmp1;
++ if (dmq1 != NULL)
++ *dmq1 = r->dmq1;
++ if (iqmp != NULL)
++ *iqmp = r->iqmp;
++}
++#endif
++
+ char _is_private(rsaData* p_rsa)
+ {
+- return(p_rsa->rsa->d != NULL);
++ const BIGNUM *d;
++
++ RSA_get0_key(p_rsa->rsa, NULL, NULL, &d);
++ return(d != NULL);
+ }
+
+ SV* make_rsa_obj(SV* p_proto, RSA* p_rsa)
+@@ -136,7 +246,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)))
+@@ -297,8 +407,15 @@ generate_key(proto, bitsSV, exponent = 65537)
+ unsigned long exponent;
+ PREINIT:
+ RSA* rsa;
++ BIGNUM *e;
+ CODE:
+- CHECK_OPEN_SSL(rsa = RSA_generate_key(SvIV(bitsSV), exponent, NULL, NULL));
++ e = BN_new();
++ CHECK_OPEN_SSL(e);
++ rsa = RSA_new();
++ CHECK_OPEN_SSL(rsa);
++ BN_set_word(e, exponent);
++ CHECK_OPEN_SSL(RSA_generate_key_ex(rsa, SvIV(bitsSV), e, NULL));
++ BN_free(e);
+ RETVAL = make_rsa_obj(proto, rsa);
+ OUTPUT:
+ RETVAL
+@@ -325,10 +442,11 @@ _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());
+- rsa->n = n;
+- rsa->e = e;
++ CHECK_OPEN_SSL(RSA_set0_key(rsa, n, e, NULL));
+ if (p || q)
+ {
++ BIGNUM *dmp1, *dmq1, *iqmp;
++
+ error = 0;
+ THROW(ctx = BN_CTX_new());
+ if (!p)
+@@ -341,8 +459,7 @@ _new_key_from_parameters(proto, n, e, d, p, q)
+ q = BN_new();
+ THROW(BN_div(q, NULL, n, p, ctx));
+ }
+- rsa->p = p;
+- rsa->q = q;
++ CHECK_OPEN_SSL(RSA_set0_factors(rsa, p, q));
+ THROW(p_minus_1 = BN_new());
+ THROW(BN_sub(p_minus_1, p, BN_value_one()));
+ THROW(q_minus_1 = BN_new());
+@@ -353,13 +470,17 @@ _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));
+ }
+- 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));
++ CHECK_OPEN_SSL(RSA_set0_key(rsa, NULL, NULL, d));
++
++ THROW(dmp1 = BN_new());
++ THROW(dmq1 = BN_new());
++ THROW(iqmp = BN_new());
++
++ THROW(BN_mod(dmp1, d, p_minus_1, ctx));
++ THROW(BN_mod(dmq1, d, q_minus_1, ctx));
++ THROW(BN_mod_inverse(iqmp, q, p, ctx));
++
++ CHECK_OPEN_SSL(RSA_set0_crt_params(rsa, dmp1, dmq1, iqmp));
+ THROW(RSA_check_key(rsa) == 1);
+ err:
+ if (p_minus_1) BN_clear_free(p_minus_1);
+@@ -373,7 +494,7 @@ _new_key_from_parameters(proto, n, e, d, p, q)
+ }
+ else
+ {
+- rsa->d = d;
++ CHECK_OPEN_SSL(RSA_set0_key(rsa, NULL, NULL, d));
+ }
+ RETVAL = make_rsa_obj(proto, rsa);
+ }
+@@ -386,15 +507,21 @@ _get_key_parameters(p_rsa)
+ PPCODE:
+ {
+ RSA* rsa;
++ const BIGNUM *n, *e, *d, *p, *q;
++ const BIGNUM *dmp1, *dmq1, *iqmp;
++
+ 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));
++ RSA_get0_key(rsa, &n, &e, &d);
++ RSA_get0_factors(rsa, &p, &q);
++ RSA_get0_crt_params(rsa, &dmp1, &dmq1, &iqmp);
++ 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.1.4
+
diff --git a/dev-perl/Crypt-OpenSSL-RSA/metadata.xml b/dev-perl/Crypt-OpenSSL-RSA/metadata.xml
new file mode 100644
index 000000000000..1e425bb8a496
--- /dev/null
+++ b/dev-perl/Crypt-OpenSSL-RSA/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>perl@gentoo.org</email>
+ <name>Gentoo Perl Project</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="cpan">Crypt-OpenSSL-RSA</remote-id>
+ <remote-id type="cpan-module">Crypt::OpenSSL::RSA</remote-id>
+ </upstream>
+</pkgmetadata>