mirror of
https://github.com/openbsd/ports.git
synced 2026-06-17 23:13:55 +02:00
p5-Crypt-OpenSSL-EC: adjust for upcoming libcrypto bump
This exposed everything just because it copied the ectest, so the patching is a bit more intrusive than one would like it to be.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
COMMENT = EC using OpenSSL
|
||||
|
||||
DISTNAME = Crypt-OpenSSL-EC-1.32
|
||||
REVISION = 2
|
||||
REVISION = 3
|
||||
|
||||
CATEGORIES = security
|
||||
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
Index: EC.xs
|
||||
--- EC.xs.orig
|
||||
+++ EC.xs
|
||||
@@ -25,9 +25,13 @@ EC_GFp_simple_method()
|
||||
const EC_METHOD *
|
||||
EC_GFp_mont_method()
|
||||
@@ -19,6 +19,8 @@ BOOT:
|
||||
ERR_load_crypto_strings();
|
||||
ERR_load_EC_strings();
|
||||
|
||||
+#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x3080000fL
|
||||
+
|
||||
const EC_METHOD *
|
||||
EC_GFp_simple_method()
|
||||
|
||||
@@ -28,6 +30,8 @@ EC_GFp_mont_method()
|
||||
const EC_METHOD *
|
||||
EC_GFp_nist_method()
|
||||
|
||||
@@ -15,13 +19,100 @@ Index: EC.xs
|
||||
#ifndef OPENSSL_NO_EC2M
|
||||
|
||||
const EC_METHOD *
|
||||
@@ -254,11 +258,15 @@ EC_POINT_method_of(const EC_POINT *point)
|
||||
@@ -69,6 +73,8 @@ ERR_error_string(error,buf=NULL)
|
||||
|
||||
MODULE = Crypt::OpenSSL::EC PACKAGE = Crypt::OpenSSL::EC::EC_GROUP PREFIX=EC_GROUP_
|
||||
|
||||
+#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x4000000fL
|
||||
+
|
||||
EC_GROUP *
|
||||
EC_GROUP_new(const EC_METHOD *meth)
|
||||
CODE:
|
||||
@@ -76,6 +82,8 @@ EC_GROUP_new(const EC_METHOD *meth)
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
+#endif
|
||||
+
|
||||
void
|
||||
EC_GROUP_DESTROY(EC_GROUP * group)
|
||||
CODE:
|
||||
@@ -84,18 +92,22 @@ EC_GROUP_DESTROY(EC_GROUP * group)
|
||||
void
|
||||
EC_GROUP_free(EC_GROUP * group)
|
||||
|
||||
-int
|
||||
-EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src)
|
||||
-
|
||||
EC_GROUP *
|
||||
EC_GROUP_dup(const EC_GROUP *src)
|
||||
|
||||
+#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x4000000fL
|
||||
+
|
||||
+int
|
||||
+EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src)
|
||||
+
|
||||
const EC_METHOD *
|
||||
EC_GROUP_method_of(const EC_GROUP *group)
|
||||
|
||||
int
|
||||
EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point)
|
||||
EC_METHOD_get_field_type(const EC_METHOD *meth)
|
||||
|
||||
+#endif
|
||||
+
|
||||
int
|
||||
EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor)
|
||||
|
||||
@@ -162,12 +174,16 @@ EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM
|
||||
int
|
||||
EC_GROUP_get_degree(const EC_GROUP *group)
|
||||
|
||||
+#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x4000000fL
|
||||
+
|
||||
int
|
||||
EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx)
|
||||
|
||||
int
|
||||
EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx)
|
||||
|
||||
+#endif
|
||||
+
|
||||
int
|
||||
EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx)
|
||||
|
||||
@@ -184,12 +200,15 @@ EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM
|
||||
EC_GROUP *
|
||||
EC_GROUP_new_by_curve_name(int nid)
|
||||
|
||||
+#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x3080000fL
|
||||
+
|
||||
int
|
||||
EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
|
||||
|
||||
int
|
||||
EC_GROUP_have_precompute_mult(const EC_GROUP *group)
|
||||
|
||||
+#endif
|
||||
|
||||
int
|
||||
EC_GROUP_get_basis_type(const EC_GROUP *group)
|
||||
@@ -247,18 +266,22 @@ EC_POINT_copy(EC_POINT *dst, const EC_POINT *src)
|
||||
|
||||
EC_POINT *
|
||||
EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group)
|
||||
+
|
||||
+int
|
||||
+EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point)
|
||||
+
|
||||
+#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x4000000fL
|
||||
|
||||
const EC_METHOD *
|
||||
EC_POINT_method_of(const EC_POINT *point)
|
||||
|
||||
int
|
||||
-EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point)
|
||||
-
|
||||
-int
|
||||
EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx)
|
||||
|
||||
int
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
Index: t/Crypt-OpenSSL-EC.t
|
||||
--- t/Crypt-OpenSSL-EC.t.orig
|
||||
+++ t/Crypt-OpenSSL-EC.t
|
||||
@@ -8,7 +8,7 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
-use Test::More tests => 19;
|
||||
+use Test::More tests => 14;
|
||||
BEGIN { use_ok('Crypt::OpenSSL::EC'); use_ok('Crypt::OpenSSL::Bignum') };
|
||||
|
||||
my $fail = 0;
|
||||
@@ -117,19 +117,19 @@ ok( $fail == 0 , 'Constants' );
|
||||
|
||||
# Exercise basic creation and destruction code:
|
||||
|
||||
-my $method = Crypt::OpenSSL::EC::EC_GFp_mont_method();
|
||||
-ok($method);
|
||||
-$method = Crypt::OpenSSL::EC::EC_GFp_mont_method();
|
||||
-ok($method);
|
||||
+#my $method = Crypt::OpenSSL::EC::EC_GFp_mont_method();
|
||||
+#ok($method);
|
||||
+#$method = Crypt::OpenSSL::EC::EC_GFp_mont_method();
|
||||
+#ok($method);
|
||||
|
||||
-my $group = Crypt::OpenSSL::EC::EC_GROUP::new($method);
|
||||
-$group = Crypt::OpenSSL::EC::EC_GROUP::new($method);
|
||||
-ok($group);
|
||||
+#my $group = Crypt::OpenSSL::EC::EC_GROUP::new($method);
|
||||
+#$group = Crypt::OpenSSL::EC::EC_GROUP::new($method);
|
||||
+#ok($group);
|
||||
|
||||
-my $point = Crypt::OpenSSL::EC::EC_POINT::new($group);
|
||||
-ok($point);
|
||||
-$point = Crypt::OpenSSL::EC::EC_POINT::new($group);
|
||||
-ok($point);
|
||||
+#my $point = Crypt::OpenSSL::EC::EC_POINT::new($group);
|
||||
+#ok($point);
|
||||
+#$point = Crypt::OpenSSL::EC::EC_POINT::new($group);
|
||||
+#ok($point);
|
||||
|
||||
my $key = Crypt::OpenSSL::EC::EC_KEY::new();
|
||||
ok($key);
|
||||
@@ -139,10 +139,10 @@ ok($key);
|
||||
my $bignum = $key->get0_private_key();
|
||||
ok($bignum);
|
||||
|
||||
-$group = $key->get0_group();
|
||||
+my $group = $key->get0_group();
|
||||
ok($group);
|
||||
|
||||
-$point = $key->get0_public_key();
|
||||
+my $point = $key->get0_public_key();
|
||||
ok($point);
|
||||
|
||||
my $nid = 415; # NID_X9_62_prime256v1
|
||||
@@ -1,7 +1,20 @@
|
||||
Index: t/prime-field.t
|
||||
--- t/prime-field.t.orig
|
||||
+++ t/prime-field.t
|
||||
@@ -119,7 +119,7 @@ sub prime_field_tests()
|
||||
@@ -38,11 +38,9 @@ sub prime_field_tests()
|
||||
# Caution: this fails on some OpenSSLs, eg on Fedora 13 where EC2M are not available
|
||||
ok($group->set_curve_GFp($p, $a, $b, $ctx));
|
||||
|
||||
- my $tmp = Crypt::OpenSSL::EC::EC_GROUP::new($group->method_of());
|
||||
+ my $tmp = Crypt::OpenSSL::EC::EC_GROUP::dup($group);
|
||||
ok($tmp);
|
||||
|
||||
- ok($tmp->copy($group));
|
||||
-
|
||||
ok($group->get_curve_GFp($p, $a, $b, $ctx));
|
||||
|
||||
# print "Curve defined by Weierstrass equation\n y^2 = x^3 + a*x + b (mod 0x" . $p->to_hex() . ")\n a = 0x" . $a->to_hex() . "\n b = 0x" . $b->to_hex() . "\n";
|
||||
@@ -119,7 +117,7 @@ sub prime_field_tests()
|
||||
# print "Generator as octet string, hybrid form:\n " . unpack('H*', $buf) . "\n";
|
||||
ok($buf eq pack('H*', '070d07'));
|
||||
|
||||
@@ -10,3 +23,69 @@ Index: t/prime-field.t
|
||||
# print "A representation of the inverse of that generator in\nJacobian projective coordinates:\n X = 0x" .$x->to_hex() . " Y = 0x" . $y->to_hex() . " Z = 0x" . $z->to_hex() . "\n";
|
||||
|
||||
$p = Crypt::OpenSSL::Bignum->new_from_hex('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF');
|
||||
@@ -148,9 +146,8 @@ sub prime_field_tests()
|
||||
|
||||
group_order_tests($group);
|
||||
|
||||
- my $P_160 = Crypt::OpenSSL::EC::EC_GROUP::new($group->method_of());
|
||||
+ my $P_160 = Crypt::OpenSSL::EC::EC_GROUP::dup($group);
|
||||
ok($P_160);
|
||||
- ok($P_160->copy($group));
|
||||
|
||||
# Curve P-192 (FIPS PUB 186-2, App. 6)
|
||||
$p = Crypt::OpenSSL::Bignum->new_from_hex('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF');
|
||||
@@ -172,9 +169,8 @@ sub prime_field_tests()
|
||||
|
||||
group_order_tests($group);
|
||||
|
||||
- my $P_192 = Crypt::OpenSSL::EC::EC_GROUP::new($group->method_of());
|
||||
+ my $P_192 = Crypt::OpenSSL::EC::EC_GROUP::dup($group);
|
||||
ok($P_192);
|
||||
- ok($P_192->copy($group));
|
||||
|
||||
# Curve P-224 (FIPS PUB 186-2, App. 6)
|
||||
|
||||
@@ -197,9 +193,8 @@ sub prime_field_tests()
|
||||
|
||||
group_order_tests($group);
|
||||
|
||||
- my $P_224 = Crypt::OpenSSL::EC::EC_GROUP::new($group->method_of());
|
||||
+ my $P_224 = Crypt::OpenSSL::EC::EC_GROUP::dup($group);
|
||||
ok($P_224);
|
||||
- ok($P_224->copy($group));
|
||||
|
||||
|
||||
# Curve P-256 (FIPS PUB 186-2, App. 6)
|
||||
@@ -223,9 +218,8 @@ sub prime_field_tests()
|
||||
|
||||
group_order_tests($group);
|
||||
|
||||
- my $P_256 = Crypt::OpenSSL::EC::EC_GROUP::new($group->method_of());
|
||||
+ my $P_256 = Crypt::OpenSSL::EC::EC_GROUP::new($group);
|
||||
ok($P_256);
|
||||
- ok($P_256->copy($group));
|
||||
|
||||
# Curve P-384 (FIPS PUB 186-2, App. 6)
|
||||
|
||||
@@ -248,9 +242,8 @@ sub prime_field_tests()
|
||||
|
||||
group_order_tests($group);
|
||||
|
||||
- my $P_384 = Crypt::OpenSSL::EC::EC_GROUP::new($group->method_of());
|
||||
+ my $P_384 = Crypt::OpenSSL::EC::EC_GROUP::dup($group);
|
||||
ok($P_384);
|
||||
- ok($P_384->copy($group));
|
||||
|
||||
# Curve P-521 (FIPS PUB 186-2, App. 6)
|
||||
|
||||
@@ -273,9 +266,8 @@ sub prime_field_tests()
|
||||
|
||||
group_order_tests($group);
|
||||
|
||||
- my $P_521 = Crypt::OpenSSL::EC::EC_GROUP::new($group->method_of());
|
||||
+ my $P_521 = Crypt::OpenSSL::EC::EC_GROUP::dup($group);
|
||||
ok($P_521);
|
||||
- ok($P_521->copy($group));
|
||||
|
||||
|
||||
# more tests using the last curve
|
||||
|
||||
Reference in New Issue
Block a user