1 |
jpp |
1.1 |
diff -up openssl-3.0.1/crypto/ec/ec_asn1.c.disable_explicit_ec openssl-3.0.1/crypto/ec/ec_asn1.c |
2 |
|
|
--- openssl-3.0.1/crypto/ec/ec_asn1.c.disable_explicit_ec 2022-03-22 13:10:45.718077845 +0100 |
3 |
|
|
+++ openssl-3.0.1/crypto/ec/ec_asn1.c 2022-03-22 13:12:46.626599016 +0100 |
4 |
|
|
@@ -895,6 +895,12 @@ EC_GROUP *d2i_ECPKParameters(EC_GROUP ** |
5 |
|
|
if (params->type == ECPKPARAMETERS_TYPE_EXPLICIT) |
6 |
|
|
group->decoded_from_explicit_params = 1; |
7 |
|
|
|
8 |
|
|
+ if (EC_GROUP_check_named_curve(group, 0, NULL) == NID_undef) { |
9 |
|
|
+ EC_GROUP_free(group); |
10 |
|
|
+ ECPKPARAMETERS_free(params); |
11 |
|
|
+ return NULL; |
12 |
|
|
+ } |
13 |
|
|
+ |
14 |
|
|
if (a) { |
15 |
|
|
EC_GROUP_free(*a); |
16 |
|
|
*a = group; |
17 |
|
|
@@ -954,6 +959,11 @@ EC_KEY *d2i_ECPrivateKey(EC_KEY **a, con |
18 |
|
|
goto err; |
19 |
|
|
} |
20 |
|
|
|
21 |
|
|
+ if (EC_GROUP_check_named_curve(ret->group, 0, NULL) == NID_undef) { |
22 |
|
|
+ ERR_raise(ERR_LIB_EC, EC_R_UNKNOWN_GROUP); |
23 |
|
|
+ goto err; |
24 |
|
|
+ } |
25 |
|
|
+ |
26 |
|
|
ret->version = priv_key->version; |
27 |
|
|
|
28 |
|
|
if (priv_key->privateKey) { |
29 |
|
|
diff -up openssl-3.0.1/test/endecode_test.c.disable_explicit_ec openssl-3.0.1/test/endecode_test.c |
30 |
|
|
--- openssl-3.0.1/test/endecode_test.c.disable_explicit_ec 2022-03-21 16:55:46.005558779 +0100 |
31 |
|
|
+++ openssl-3.0.1/test/endecode_test.c 2022-03-21 16:56:12.636792762 +0100 |
32 |
|
|
@@ -57,7 +57,7 @@ static BN_CTX *bnctx = NULL; |
33 |
|
|
static OSSL_PARAM_BLD *bld_prime_nc = NULL; |
34 |
|
|
static OSSL_PARAM_BLD *bld_prime = NULL; |
35 |
|
|
static OSSL_PARAM *ec_explicit_prime_params_nc = NULL; |
36 |
|
|
-static OSSL_PARAM *ec_explicit_prime_params_explicit = NULL; |
37 |
|
|
+/*static OSSL_PARAM *ec_explicit_prime_params_explicit = NULL;*/ |
38 |
|
|
|
39 |
|
|
# ifndef OPENSSL_NO_EC2M |
40 |
|
|
static OSSL_PARAM_BLD *bld_tri_nc = NULL; |
41 |
|
|
@@ -990,9 +990,9 @@ IMPLEMENT_TEST_SUITE_LEGACY(EC, "EC") |
42 |
|
|
DOMAIN_KEYS(ECExplicitPrimeNamedCurve); |
43 |
|
|
IMPLEMENT_TEST_SUITE(ECExplicitPrimeNamedCurve, "EC", 1) |
44 |
|
|
IMPLEMENT_TEST_SUITE_LEGACY(ECExplicitPrimeNamedCurve, "EC") |
45 |
|
|
-DOMAIN_KEYS(ECExplicitPrime2G); |
46 |
|
|
-IMPLEMENT_TEST_SUITE(ECExplicitPrime2G, "EC", 0) |
47 |
|
|
-IMPLEMENT_TEST_SUITE_LEGACY(ECExplicitPrime2G, "EC") |
48 |
|
|
+/*DOMAIN_KEYS(ECExplicitPrime2G);*/ |
49 |
|
|
+/*IMPLEMENT_TEST_SUITE(ECExplicitPrime2G, "EC", 0)*/ |
50 |
|
|
+/*IMPLEMENT_TEST_SUITE_LEGACY(ECExplicitPrime2G, "EC")*/ |
51 |
|
|
# ifndef OPENSSL_NO_EC2M |
52 |
|
|
DOMAIN_KEYS(ECExplicitTriNamedCurve); |
53 |
|
|
IMPLEMENT_TEST_SUITE(ECExplicitTriNamedCurve, "EC", 1) |
54 |
|
|
@@ -1318,7 +1318,7 @@ int setup_tests(void) |
55 |
|
|
|| !create_ec_explicit_prime_params_namedcurve(bld_prime_nc) |
56 |
|
|
|| !create_ec_explicit_prime_params(bld_prime) |
57 |
|
|
|| !TEST_ptr(ec_explicit_prime_params_nc = OSSL_PARAM_BLD_to_param(bld_prime_nc)) |
58 |
|
|
- || !TEST_ptr(ec_explicit_prime_params_explicit = OSSL_PARAM_BLD_to_param(bld_prime)) |
59 |
|
|
+/* || !TEST_ptr(ec_explicit_prime_params_explicit = OSSL_PARAM_BLD_to_param(bld_prime))*/ |
60 |
|
|
# ifndef OPENSSL_NO_EC2M |
61 |
|
|
|| !TEST_ptr(bld_tri_nc = OSSL_PARAM_BLD_new()) |
62 |
|
|
|| !TEST_ptr(bld_tri = OSSL_PARAM_BLD_new()) |
63 |
|
|
@@ -1346,7 +1346,7 @@ int setup_tests(void) |
64 |
|
|
TEST_info("Generating EC keys..."); |
65 |
|
|
MAKE_DOMAIN_KEYS(EC, "EC", EC_params); |
66 |
|
|
MAKE_DOMAIN_KEYS(ECExplicitPrimeNamedCurve, "EC", ec_explicit_prime_params_nc); |
67 |
|
|
- MAKE_DOMAIN_KEYS(ECExplicitPrime2G, "EC", ec_explicit_prime_params_explicit); |
68 |
|
|
+/* MAKE_DOMAIN_KEYS(ECExplicitPrime2G, "EC", ec_explicit_prime_params_explicit);*/ |
69 |
|
|
# ifndef OPENSSL_NO_EC2M |
70 |
|
|
MAKE_DOMAIN_KEYS(ECExplicitTriNamedCurve, "EC", ec_explicit_tri_params_nc); |
71 |
|
|
MAKE_DOMAIN_KEYS(ECExplicitTri2G, "EC", ec_explicit_tri_params_explicit); |
72 |
|
|
@@ -1389,8 +1389,8 @@ int setup_tests(void) |
73 |
|
|
ADD_TEST_SUITE_LEGACY(EC); |
74 |
|
|
ADD_TEST_SUITE(ECExplicitPrimeNamedCurve); |
75 |
|
|
ADD_TEST_SUITE_LEGACY(ECExplicitPrimeNamedCurve); |
76 |
|
|
- ADD_TEST_SUITE(ECExplicitPrime2G); |
77 |
|
|
- ADD_TEST_SUITE_LEGACY(ECExplicitPrime2G); |
78 |
|
|
+/* ADD_TEST_SUITE(ECExplicitPrime2G);*/ |
79 |
|
|
+/* ADD_TEST_SUITE_LEGACY(ECExplicitPrime2G);*/ |
80 |
|
|
# ifndef OPENSSL_NO_EC2M |
81 |
|
|
ADD_TEST_SUITE(ECExplicitTriNamedCurve); |
82 |
|
|
ADD_TEST_SUITE_LEGACY(ECExplicitTriNamedCurve); |
83 |
|
|
@@ -1427,7 +1427,7 @@ void cleanup_tests(void) |
84 |
|
|
{ |
85 |
|
|
#ifndef OPENSSL_NO_EC |
86 |
|
|
OSSL_PARAM_free(ec_explicit_prime_params_nc); |
87 |
|
|
- OSSL_PARAM_free(ec_explicit_prime_params_explicit); |
88 |
|
|
+/* OSSL_PARAM_free(ec_explicit_prime_params_explicit);*/ |
89 |
|
|
OSSL_PARAM_BLD_free(bld_prime_nc); |
90 |
|
|
OSSL_PARAM_BLD_free(bld_prime); |
91 |
|
|
# ifndef OPENSSL_NO_EC2M |
92 |
|
|
@@ -1449,7 +1449,7 @@ void cleanup_tests(void) |
93 |
|
|
#ifndef OPENSSL_NO_EC |
94 |
|
|
FREE_DOMAIN_KEYS(EC); |
95 |
|
|
FREE_DOMAIN_KEYS(ECExplicitPrimeNamedCurve); |
96 |
|
|
- FREE_DOMAIN_KEYS(ECExplicitPrime2G); |
97 |
|
|
+/* FREE_DOMAIN_KEYS(ECExplicitPrime2G);*/ |
98 |
|
|
# ifndef OPENSSL_NO_EC2M |
99 |
|
|
FREE_DOMAIN_KEYS(ECExplicitTriNamedCurve); |
100 |
|
|
FREE_DOMAIN_KEYS(ECExplicitTri2G); |
101 |
|
|
diff -up openssl-3.0.1/test/recipes/30-test_evp_data/evppkey_ecdsa.txt.disable_explicit_ec openssl-3.0.1/test/recipes/30-test_evp_data/evppkey_ecdsa.txt |
102 |
|
|
--- openssl-3.0.1/test/recipes/30-test_evp_data/evppkey_ecdsa.txt.disable_explicit_ec 2022-03-25 11:20:50.920949208 +0100 |
103 |
|
|
+++ openssl-3.0.1/test/recipes/30-test_evp_data/evppkey_ecdsa.txt 2022-03-25 11:21:13.177147598 +0100 |
104 |
|
|
@@ -121,18 +121,6 @@ AAAA//////////+85vqtpxeehPO5ysL8YyVRAgEB |
105 |
|
|
3ev1gTwRBduzqqlwd54AUSgI+pjttW8zrWNitO8H1sf59MPWOESKxNtZ1+Nl |
106 |
|
|
-----END PRIVATE KEY----- |
107 |
|
|
|
108 |
|
|
-PrivateKey = EC_EXPLICIT |
109 |
|
|
------BEGIN PRIVATE KEY----- |
110 |
|
|
-MIIBeQIBADCCAQMGByqGSM49AgEwgfcCAQEwLAYHKoZIzj0BAQIhAP////8AAAAB |
111 |
|
|
-AAAAAAAAAAAAAAAA////////////////MFsEIP////8AAAABAAAAAAAAAAAAAAAA |
112 |
|
|
-///////////////8BCBaxjXYqjqT57PrvVV2mIa8ZR0GsMxTsPY7zjw+J9JgSwMV |
113 |
|
|
-AMSdNgiG5wSTamZ44ROdJreBn36QBEEE5JcIvn36opqjEm/k59Al40rBAxWM2TPG |
114 |
|
|
-l0L13Je51zHpfXQ9Z2o7IQicMXP4wSfJ0qCgg2bgydqoxlYrlLGuVQIhAP////8A |
115 |
|
|
-AAAA//////////+85vqtpxeehPO5ysL8YyVRAgEBBG0wawIBAQQgec92jwduadCk |
116 |
|
|
-OjoNRI+YT5Be5TkzZXzYCyTLkMOikDmhRANCAATtECEhQbLEaiUj/Wu0qjcr81lL |
117 |
|
|
-46dx5zYgArz/iaSNJ3W80oO+F7v04jlQ7wxQzg96R0bwKiMeq5CcW9ZFt6xg |
118 |
|
|
------END PRIVATE KEY----- |
119 |
|
|
- |
120 |
|
|
PrivateKey = B-163 |
121 |
|
|
-----BEGIN PRIVATE KEY----- |
122 |
|
|
MGMCAQAwEAYHKoZIzj0CAQYFK4EEAA8ETDBKAgEBBBUDnQW0mLiHVha/jqFznX/K |