Update hobble-nettle to match the 3.7.x code base

This commit is contained in:
Daiki Ueno 2021-03-09 16:47:10 +01:00
parent b460f49614
commit 62e923b52c

View File

@ -8,20 +8,21 @@ else
fi fi
# ECC-192, 224 # ECC-192, 224
for f in ecc-192.c ecc-224.c; do for f in ecc-secp192r1.c ecc-secp224r1.c; do
eval "$CMD $f" eval "$CMD $f"
done done
patch -p1 << __EOF__ patch -p1 << __EOF__
diff --git a/eccdata.c b/eccdata.c diff --git a/eccdata.c b/eccdata.c
index 9533d78..2f0e4e7 100644 index 1b4cb0b5..dc2be5f9 100644
--- a/eccdata.c --- a/eccdata.c
+++ b/eccdata.c +++ b/eccdata.c
@@ -349,71 +349,6 @@ ecc_curve_init (struct ecc_curve *ecc, unsigned bit_size) @@ -434,72 +434,7 @@ ecc_curve_init_str (struct ecc_curve *ecc, enum ecc_type type,
static void
ecc_curve_init (struct ecc_curve *ecc, const char *curve)
{ {
switch (bit_size) - if (!strcmp (curve, "secp192r1"))
{ - {
- case 192:
- ecc_curve_init_str (ecc, ECC_TYPE_WEIERSTRASS, - ecc_curve_init_str (ecc, ECC_TYPE_WEIERSTRASS,
- /* p = 2^{192} - 2^{64} - 1 */ - /* p = 2^{192} - 2^{64} - 1 */
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE" - "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"
@ -37,8 +38,7 @@ index 9533d78..2f0e4e7 100644
- "f4ff0afd82ff1012", - "f4ff0afd82ff1012",
- -
- "07192b95ffc8da78631011ed6b24cdd5" - "07192b95ffc8da78631011ed6b24cdd5"
- "73f977a11e794811", - "73f977a11e794811");
- NULL, NULL);
- ecc->ref = ecc_alloc (3); - ecc->ref = ecc_alloc (3);
- ecc_set_str (&ecc->ref[0], /* 2 g */ - ecc_set_str (&ecc->ref[0], /* 2 g */
- "dafebf5828783f2ad35534631588a3f629a70fb16982a888", - "dafebf5828783f2ad35534631588a3f629a70fb16982a888",
@ -52,8 +52,9 @@ index 9533d78..2f0e4e7 100644
- "35433907297cc378b0015703374729d7a4fe46647084e4ba", - "35433907297cc378b0015703374729d7a4fe46647084e4ba",
- "a2649984f2135c301ea3acb0776cd4f125389b311db3be32"); - "a2649984f2135c301ea3acb0776cd4f125389b311db3be32");
- -
- break; - }
- case 224: - else if (!strcmp (curve, "secp224r1"))
- {
- ecc_curve_init_str (ecc, ECC_TYPE_WEIERSTRASS, - ecc_curve_init_str (ecc, ECC_TYPE_WEIERSTRASS,
- /* p = 2^{224} - 2^{96} + 1 */ - /* p = 2^{224} - 2^{96} + 1 */
- "ffffffffffffffffffffffffffffffff" - "ffffffffffffffffffffffffffffffff"
@ -69,8 +70,7 @@ index 9533d78..2f0e4e7 100644
- "56c21122343280d6115c1d21", - "56c21122343280d6115c1d21",
- -
- "bd376388b5f723fb4c22dfe6cd4375a0" - "bd376388b5f723fb4c22dfe6cd4375a0"
- "5a07476444d5819985007e34", - "5a07476444d5819985007e34");
- NULL, NULL);
- -
- ecc->ref = ecc_alloc (3); - ecc->ref = ecc_alloc (3);
- ecc_set_str (&ecc->ref[0], /* 2 g */ - ecc_set_str (&ecc->ref[0], /* 2 g */
@ -85,8 +85,29 @@ index 9533d78..2f0e4e7 100644
- "ae99feebb5d26945b54892092a8aee02912930fa41cd114e40447301", - "ae99feebb5d26945b54892092a8aee02912930fa41cd114e40447301",
- "482580a0ec5bc47e88bc8c378632cd196cb3fa058a7114eb03054c9"); - "482580a0ec5bc47e88bc8c378632cd196cb3fa058a7114eb03054c9");
- -
- break; - }
case 256: - else if (!strcmp (curve, "secp256r1"))
+ if (!strcmp (curve, "secp256r1"))
{
ecc_curve_init_str (ecc, ECC_TYPE_WEIERSTRASS, ecc_curve_init_str (ecc, ECC_TYPE_WEIERSTRASS,
/* p = 2^{256} - 2^{224} + 2^{192} + 2^{96} - 1 */ /* p = 2^{256} - 2^{224} + 2^{192} + 2^{96} - 1 */
diff --git a/testsuite/ecdsa-verify-test.c b/testsuite/ecdsa-verify-test.c
index 3ceac0eb..71c0b5c0 100644
--- a/testsuite/ecdsa-verify-test.c
+++ b/testsuite/ecdsa-verify-test.c
@@ -81,14 +81,6 @@ test_ecdsa (const struct ecc_curve *ecc,
void
test_main (void)
{
- /* Test case provided by Guido Vranken, from oss-fuzz */
- test_ecdsa (&_nettle_secp_192r1,
- "14683086 f1734c6d e68743a6 48181b54 a74d4c5b 383eb6a8", /* x */
- " 1e2584 2ab8b2b0 4017f655 1b5e4058 a2aa0612 2dae9344", /* y */
- SHEX("00"), /* h == 0 corner case*/
- "952800792ed19341fdeeec047f2514f3b0f150d6066151fb", /* r */
- "ec5971222014878b50d7a19d8954bc871e7e65b00b860ffb"); /* s */
-
/* From RFC 4754 */
test_ecdsa (&_nettle_secp_256r1,
"2442A5CC 0ECD015F A3CA31DC 8E2BBC70"
__EOF__ __EOF__