2013-11-25 15:06:35 +00:00
|
|
|
#!/bin/sh
|
|
|
|
set -x
|
|
|
|
|
|
|
|
if [ "$1" = "-e" ] ; then
|
|
|
|
CMD="cat < /dev/null >"
|
|
|
|
else
|
|
|
|
CMD="rm -f"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ECC-192, 224
|
2021-03-09 15:47:10 +00:00
|
|
|
for f in ecc-secp192r1.c ecc-secp224r1.c; do
|
2013-11-25 15:06:35 +00:00
|
|
|
eval "$CMD $f"
|
|
|
|
done
|
|
|
|
|
|
|
|
patch -p1 << __EOF__
|
2015-04-30 09:56:29 +00:00
|
|
|
diff --git a/eccdata.c b/eccdata.c
|
2021-03-09 15:47:10 +00:00
|
|
|
index 1b4cb0b5..dc2be5f9 100644
|
2015-04-30 09:56:29 +00:00
|
|
|
--- a/eccdata.c
|
|
|
|
+++ b/eccdata.c
|
2021-03-09 15:47:10 +00:00
|
|
|
@@ -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)
|
2013-11-25 15:06:35 +00:00
|
|
|
{
|
2021-03-09 15:47:10 +00:00
|
|
|
- if (!strcmp (curve, "secp192r1"))
|
|
|
|
- {
|
2015-04-30 09:56:29 +00:00
|
|
|
- ecc_curve_init_str (ecc, ECC_TYPE_WEIERSTRASS,
|
2013-11-25 15:06:35 +00:00
|
|
|
- /* p = 2^{192} - 2^{64} - 1 */
|
|
|
|
- "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE"
|
|
|
|
- "FFFFFFFFFFFFFFFF",
|
|
|
|
-
|
|
|
|
- "64210519e59c80e70fa7e9ab72243049"
|
|
|
|
- "feb8deecc146b9b1",
|
|
|
|
-
|
|
|
|
- "ffffffffffffffffffffffff99def836"
|
|
|
|
- "146bc9b1b4d22831",
|
|
|
|
-
|
|
|
|
- "188da80eb03090f67cbf20eb43a18800"
|
|
|
|
- "f4ff0afd82ff1012",
|
|
|
|
-
|
|
|
|
- "07192b95ffc8da78631011ed6b24cdd5"
|
2021-03-09 15:47:10 +00:00
|
|
|
- "73f977a11e794811");
|
2013-11-25 15:06:35 +00:00
|
|
|
- ecc->ref = ecc_alloc (3);
|
|
|
|
- ecc_set_str (&ecc->ref[0], /* 2 g */
|
|
|
|
- "dafebf5828783f2ad35534631588a3f629a70fb16982a888",
|
|
|
|
- "dd6bda0d993da0fa46b27bbc141b868f59331afa5c7e93ab");
|
|
|
|
-
|
|
|
|
- ecc_set_str (&ecc->ref[1], /* 3 g */
|
|
|
|
- "76e32a2557599e6edcd283201fb2b9aadfd0d359cbb263da",
|
|
|
|
- "782c37e372ba4520aa62e0fed121d49ef3b543660cfd05fd");
|
|
|
|
-
|
|
|
|
- ecc_set_str (&ecc->ref[2], /* 4 g */
|
|
|
|
- "35433907297cc378b0015703374729d7a4fe46647084e4ba",
|
|
|
|
- "a2649984f2135c301ea3acb0776cd4f125389b311db3be32");
|
|
|
|
-
|
2021-03-09 15:47:10 +00:00
|
|
|
- }
|
|
|
|
- else if (!strcmp (curve, "secp224r1"))
|
|
|
|
- {
|
2015-04-30 09:56:29 +00:00
|
|
|
- ecc_curve_init_str (ecc, ECC_TYPE_WEIERSTRASS,
|
2013-11-25 15:06:35 +00:00
|
|
|
- /* p = 2^{224} - 2^{96} + 1 */
|
|
|
|
- "ffffffffffffffffffffffffffffffff"
|
|
|
|
- "000000000000000000000001",
|
|
|
|
-
|
|
|
|
- "b4050a850c04b3abf54132565044b0b7"
|
|
|
|
- "d7bfd8ba270b39432355ffb4",
|
|
|
|
-
|
|
|
|
- "ffffffffffffffffffffffffffff16a2"
|
|
|
|
- "e0b8f03e13dd29455c5c2a3d",
|
|
|
|
-
|
|
|
|
- "b70e0cbd6bb4bf7f321390b94a03c1d3"
|
|
|
|
- "56c21122343280d6115c1d21",
|
|
|
|
-
|
|
|
|
- "bd376388b5f723fb4c22dfe6cd4375a0"
|
2021-03-09 15:47:10 +00:00
|
|
|
- "5a07476444d5819985007e34");
|
2013-11-25 15:06:35 +00:00
|
|
|
-
|
|
|
|
- ecc->ref = ecc_alloc (3);
|
|
|
|
- ecc_set_str (&ecc->ref[0], /* 2 g */
|
|
|
|
- "706a46dc76dcb76798e60e6d89474788d16dc18032d268fd1a704fa6",
|
|
|
|
- "1c2b76a7bc25e7702a704fa986892849fca629487acf3709d2e4e8bb");
|
|
|
|
-
|
|
|
|
- ecc_set_str (&ecc->ref[1], /* 3 g */
|
|
|
|
- "df1b1d66a551d0d31eff822558b9d2cc75c2180279fe0d08fd896d04",
|
|
|
|
- "a3f7f03cadd0be444c0aa56830130ddf77d317344e1af3591981a925");
|
|
|
|
-
|
|
|
|
- ecc_set_str (&ecc->ref[2], /* 4 g */
|
|
|
|
- "ae99feebb5d26945b54892092a8aee02912930fa41cd114e40447301",
|
|
|
|
- "482580a0ec5bc47e88bc8c378632cd196cb3fa058a7114eb03054c9");
|
|
|
|
-
|
2021-03-09 15:47:10 +00:00
|
|
|
- }
|
|
|
|
- else if (!strcmp (curve, "secp256r1"))
|
|
|
|
+ if (!strcmp (curve, "secp256r1"))
|
|
|
|
{
|
2015-04-30 09:56:29 +00:00
|
|
|
ecc_curve_init_str (ecc, ECC_TYPE_WEIERSTRASS,
|
2013-11-25 15:06:35 +00:00
|
|
|
/* p = 2^{256} - 2^{224} + 2^{192} + 2^{96} - 1 */
|
2021-03-09 15:47:10 +00:00
|
|
|
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"
|
2013-11-25 15:06:35 +00:00
|
|
|
__EOF__
|