Gentoo Archives: gentoo-commits

From: Conrad Kostecki <conikost@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-perl/Crypt-OpenSSL-ECDSA/files/
Date: Fri, 29 Oct 2021 22:01:15
Message-Id: 1635543755.590ba6d66936fc6b7c08694548da04615504c5ed.conikost@gentoo
1 commit: 590ba6d66936fc6b7c08694548da04615504c5ed
2 Author: Conrad Kostecki <conikost <AT> gentoo <DOT> org>
3 AuthorDate: Fri Oct 29 21:42:35 2021 +0000
4 Commit: Conrad Kostecki <conikost <AT> gentoo <DOT> org>
5 CommitDate: Fri Oct 29 21:42:35 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=590ba6d6
7
8 dev-perl/Crypt-OpenSSL-ECDSA: remove unused patch
9
10 Closes: https://github.com/gentoo/gentoo/pull/22624
11 Signed-off-by: Michael Mair-Keimberger <mmk <AT> levelnine.at>
12 Package-Manager: Portage-3.0.28, Repoman-3.0.3
13 Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>
14
15 ...L-ECDSA-0.80.0-0002-Port-to-OpenSSL-1.1.0.patch | 252 ---------------------
16 1 file changed, 252 deletions(-)
17
18 diff --git a/dev-perl/Crypt-OpenSSL-ECDSA/files/Crypt-OpenSSL-ECDSA-0.80.0-0002-Port-to-OpenSSL-1.1.0.patch b/dev-perl/Crypt-OpenSSL-ECDSA/files/Crypt-OpenSSL-ECDSA-0.80.0-0002-Port-to-OpenSSL-1.1.0.patch
19 deleted file mode 100644
20 index 9fe9f58d476..00000000000
21 --- a/dev-perl/Crypt-OpenSSL-ECDSA/files/Crypt-OpenSSL-ECDSA-0.80.0-0002-Port-to-OpenSSL-1.1.0.patch
22 +++ /dev/null
23 @@ -1,252 +0,0 @@
24 -From b110ec2277ba33e0935f3d465a5413f669d8aefc Mon Sep 17 00:00:00 2001
25 -From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@××××××.com>
26 -Date: Tue, 11 Oct 2016 16:15:43 +0200
27 -Subject: [PATCH] Port to OpenSSL 1.1.0
28 -MIME-Version: 1.0
29 -Content-Type: text/plain; charset=UTF-8
30 -Content-Transfer-Encoding: 8bit
31 -
32 -OpenSSL 1.1.0 hid ECDSA structure internals and provided methods
33 -instead.
34 -
35 -This patch uses the methods and provides their copies in the case of
36 -older OpenSSL. Because the new OpenSSL API, ECDSA_SIG_set0(), cannot
37 -set curve parameters individually and ECDSA_SIG_get0() returns yet
38 -another reference, it's necessary to duplicate the other unchanged
39 -paramater when calling set_r() or set_s().
40 -
41 -This patch also stops exporting ECDSA_METHOD functions that were
42 -removed from the new OpenSSL.
43 -
44 -CPAN RT#118330
45 -
46 -Signed-off-by: Petr Písař <ppisar@××××××.com>
47 ----
48 - ECDSA.xs | 105 ++++++++++++++++++++++++++++++++++++++++--------
49 - t/Crypt-OpenSSL-ECDSA.t | 13 +++++-
50 - 2 files changed, 100 insertions(+), 18 deletions(-)
51 -
52 -diff --git a/ECDSA.xs b/ECDSA.xs
53 -index 4016368..3d6e2d1 100644
54 ---- a/ECDSA.xs
55 -+++ b/ECDSA.xs
56 -@@ -7,9 +7,35 @@
57 -
58 - #include <openssl/ecdsa.h>
59 - #include <openssl/err.h>
60 -+#include <openssl/bn.h>
61 -
62 - #include "const-c.inc"
63 -
64 -+
65 -+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
66 -+#include <openssl/ec.h>
67 -+#else
68 -+/* ECDSA_SIG_get0() and ECDSA_SIG_set0() copied from OpenSSL 1.1.0b. */
69 -+static void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr,
70 -+ const BIGNUM **ps) {
71 -+ if (pr != NULL)
72 -+ *pr = sig->r;
73 -+ if (ps != NULL)
74 -+ *ps = sig->s;
75 -+}
76 -+
77 -+static int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s)
78 -+{
79 -+ if (r == NULL || s == NULL)
80 -+ return 0;
81 -+ BN_clear_free(sig->r);
82 -+ BN_clear_free(sig->s);
83 -+ sig->r = r;
84 -+ sig->s = s;
85 -+ return 1;
86 -+}
87 -+#endif
88 -+
89 - MODULE = Crypt::OpenSSL::ECDSA PACKAGE = Crypt::OpenSSL::ECDSA
90 -
91 - PROTOTYPES: ENABLE
92 -@@ -17,7 +43,9 @@ INCLUDE: const-xs.inc
93 -
94 - BOOT:
95 - ERR_load_crypto_strings();
96 -+#if OPENSSL_VERSION_NUMBER >= 0x10002000L && OPENSSL_VERSION_NUMBER < 0x10100000L
97 - ERR_load_ECDSA_strings();
98 -+#endif
99 -
100 - #ECDSA_SIG *
101 - #ECDSA_SIG_new()
102 -@@ -61,10 +89,16 @@ ECDSA_do_verify(const unsigned char *dgst, const ECDSA_SIG *sig, EC_KEY* eckey);
103 - OUTPUT:
104 - RETVAL
105 -
106 --# These ECDSA_METHOD functions only became available in 1.0.2
107 -+# These ECDSA_METHOD functions only became available in 1.0.2,
108 -+# but some of them removed again in 1.1.0.
109 -
110 - #if OPENSSL_VERSION_NUMBER >= 0x10002000L
111 -
112 -+int
113 -+ECDSA_size(const EC_KEY *eckey)
114 -+
115 -+#if OPENSSL_VERSION_NUMBER < 0x10100000L
116 -+
117 - const ECDSA_METHOD *
118 - ECDSA_OpenSSL()
119 -
120 -@@ -77,9 +111,6 @@ ECDSA_get_default_method()
121 - int
122 - ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth)
123 -
124 --int
125 --ECDSA_size(const EC_KEY *eckey)
126 --
127 - ECDSA_METHOD *
128 - ECDSA_METHOD_new(ECDSA_METHOD *ecdsa_method=0)
129 -
130 -@@ -95,7 +126,7 @@ ECDSA_METHOD_set_name(ECDSA_METHOD *ecdsa_method, char *name)
131 - void
132 - ERR_load_ECDSA_strings()
133 -
134 --
135 -+#endif
136 - #endif
137 -
138 -
139 -@@ -135,11 +166,13 @@ SV *
140 - get_r(ecdsa_sig)
141 - ECDSA_SIG *ecdsa_sig
142 - PREINIT:
143 -+ const BIGNUM *r;
144 - unsigned char *to;
145 - STRLEN len;
146 - CODE:
147 - to = malloc(sizeof(char) * 128);
148 -- len = BN_bn2bin(ecdsa_sig->r, to);
149 -+ ECDSA_SIG_get0(ecdsa_sig, &r, NULL);
150 -+ len = BN_bn2bin(r, to);
151 - RETVAL = newSVpvn((const char*)to, len);
152 - free(to);
153 - OUTPUT:
154 -@@ -149,11 +182,13 @@ SV *
155 - get_s(ecdsa_sig)
156 - ECDSA_SIG *ecdsa_sig
157 - PREINIT:
158 -+ const BIGNUM *s;
159 - unsigned char *to;
160 - STRLEN len;
161 - CODE:
162 - to = malloc(sizeof(char) * 128);
163 -- len = BN_bn2bin(ecdsa_sig->s, to);
164 -+ ECDSA_SIG_get0(ecdsa_sig, NULL, &s);
165 -+ len = BN_bn2bin(s, to);
166 - RETVAL = newSVpvn((const char*)to, len);
167 - free(to);
168 - OUTPUT:
169 -@@ -164,26 +199,62 @@ set_r(ecdsa_sig, r_SV)
170 - ECDSA_SIG *ecdsa_sig
171 - SV * r_SV
172 - PREINIT:
173 -- char *s;
174 -+ char *string;
175 - STRLEN len;
176 -+ BIGNUM *r;
177 -+ BIGNUM *s;
178 -+ const BIGNUM *old_s;
179 - CODE:
180 -- s = SvPV(r_SV, len);
181 -- if (ecdsa_sig->r)
182 -- BN_free(ecdsa_sig->r);
183 -- ecdsa_sig->r = BN_bin2bn((const unsigned char *)s, len, NULL);
184 -+ string = SvPV(r_SV, len);
185 -+ r = BN_bin2bn((const unsigned char *)string, len, NULL);
186 -+ if (NULL == r)
187 -+ croak("Could not convert ECDSA parameter string to big number");
188 -+ ECDSA_SIG_get0(ecdsa_sig, NULL, &old_s);
189 -+ if (NULL == old_s) {
190 -+ s = BN_new();
191 -+ } else {
192 -+ s = BN_dup(old_s);
193 -+ }
194 -+ if (NULL == s) {
195 -+ BN_free(r);
196 -+ croak("Could not duplicate unchanged ECDSA parameter");
197 -+ }
198 -+ if (!ECDSA_SIG_set0(ecdsa_sig, r, s)) {
199 -+ BN_free(r);
200 -+ BN_free(s);
201 -+ croak("Could not store ECDSA parameters");
202 -+ }
203 -
204 - void
205 - set_s(ecdsa_sig, s_SV)
206 - ECDSA_SIG *ecdsa_sig
207 - SV * s_SV
208 - PREINIT:
209 -- char *s;
210 -+ char *string;
211 - STRLEN len;
212 -+ BIGNUM *r;
213 -+ BIGNUM *s;
214 -+ const BIGNUM *old_r;
215 - CODE:
216 -- s = SvPV(s_SV, len);
217 -- if (ecdsa_sig->s)
218 -- BN_free(ecdsa_sig->s);
219 -- ecdsa_sig->s = BN_bin2bn((const unsigned char *)s, len, NULL);
220 -+ string = SvPV(s_SV, len);
221 -+ s = BN_bin2bn((const unsigned char *)string, len, NULL);
222 -+ if (NULL == s)
223 -+ croak("Could not convert ECDSA parameter string to big number");
224 -+ ECDSA_SIG_get0(ecdsa_sig, &old_r, NULL);
225 -+ if (NULL == old_r) {
226 -+ r = BN_new();
227 -+ } else {
228 -+ r = BN_dup(old_r);
229 -+ }
230 -+ if (NULL == r) {
231 -+ BN_free(s);
232 -+ croak("Could not duplicate unchanged ECDSA parameter");
233 -+ }
234 -+ if (!ECDSA_SIG_set0(ecdsa_sig, r, s)) {
235 -+ BN_free(r);
236 -+ BN_free(s);
237 -+ croak("Could not store ECDSA parameters");
238 -+ }
239 -
240 -
241 -
242 -diff --git a/t/Crypt-OpenSSL-ECDSA.t b/t/Crypt-OpenSSL-ECDSA.t
243 -index 7ab584f..3c02025 100644
244 ---- a/t/Crypt-OpenSSL-ECDSA.t
245 -+++ b/t/Crypt-OpenSSL-ECDSA.t
246 -@@ -6,7 +6,7 @@
247 - use strict;
248 - use warnings;
249 -
250 --use Test::More tests => 21;
251 -+use Test::More tests => 25;
252 - BEGIN { use_ok('Crypt::OpenSSL::ECDSA'); use_ok('Crypt::OpenSSL::EC'); };
253 -
254 -
255 -@@ -77,6 +77,17 @@ $ret = Crypt::OpenSSL::ECDSA::ECDSA_do_verify($digest, $sig, $key);
256 - ok($ret);
257 - undef $sig;
258 -
259 -+# Test a signature can be built from scratch
260 -+$sig = Crypt::OpenSSL::ECDSA::ECDSA_SIG->new();
261 -+ok($sig, 'Empty Crypt::OpenSSL::ECDSA::ECDSA_SIG object created');
262 -+eval { $sig->set_r($r); };
263 -+ok(!$@, 'R parameter set');
264 -+eval { $sig->set_s($s); };
265 -+ok(!$@, 'S parameter set');
266 -+$ret = Crypt::OpenSSL::ECDSA::ECDSA_do_verify($digest, $sig, $key);
267 -+ok($ret, 'built-from-scratch signature matches');
268 -+undef $sig;
269 -+
270 - # Testing signing and verifying with the _ex version
271 - my $dummy = 0;
272 - $sig = Crypt::OpenSSL::ECDSA::ECDSA_do_sign_ex($digest, \$dummy, \$dummy, $key);
273 ---
274 -2.7.4
275 -