]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Delete ecc->mul_g and ecc->h_to_a indirection for ecdsa/gostdsa sign. ecdsa-weierstrass-only
authorNiels Möller <nisse@lysator.liu.se>
Wed, 28 Sep 2022 17:29:15 +0000 (19:29 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Wed, 28 Sep 2022 17:29:15 +0000 (19:29 +0200)
ecc-ecdsa-sign.c
ecc-gostdsa-sign.c

index 4adee1d1f58e2287a7cc1b57955df672fd93c15a..6a41c14c611f542c5e804a220581ac2e5684b70f 100644 (file)
@@ -46,9 +46,9 @@
 mp_size_t
 ecc_ecdsa_sign_itch (const struct ecc_curve *ecc)
 {
-  /* Needs 3*ecc->p.size + scratch for ecc->mul_g. Currently same for
-     ecc_mul_g. */
-  assert (ecc->p.size + ecc->p.invert_itch <= 3*ecc->p.size + ecc->mul_g_itch);
+  /* Needs 3*ecc->p.size + scratch for ecc_mul_g. */
+  assert (ecc->p.size + ecc->p.invert_itch
+         <= 3*ecc->p.size + ECC_MUL_G_ITCH (ecc->p.size));
   return ECC_ECDSA_SIGN_ITCH (ecc->p.size);
 }
 
@@ -79,9 +79,9 @@ ecc_ecdsa_sign (const struct ecc_curve *ecc,
      4. s2 <-- (h + z*s1)/k mod q.
   */
 
-  ecc->mul_g (ecc, P, kp, P + 3*ecc->p.size);
+  ecc_mul_g (ecc, P, kp, P + 3*ecc->p.size);
   /* x coordinate only, modulo q */
-  ecc->h_to_a (ecc, 2, rp, P, P + 3*ecc->p.size);
+  ecc_j_to_a (ecc, 2, rp, P, P + 3*ecc->p.size);
 
   /* Invert k, uses up to 7 * ecc->p.size including scratch (for secp384). */
   ecc->q.invert (&ecc->q, kinv, kp, tp);
index c924122ce97b3e91cabe0c02148108134426e742..491a228157783304096375285d7a68ad0d97c561 100644 (file)
@@ -45,8 +45,7 @@
 mp_size_t
 ecc_gostdsa_sign_itch (const struct ecc_curve *ecc)
 {
-  /* Needs 3*ecc->p.size + scratch for ecc->mul_g. Currently same for
-     ecc_mul_g. */
+  /* Needs 3*ecc->p.size + scratch for ecc_mul_g. */
   return ECC_GOSTDSA_SIGN_ITCH (ecc->p.size);
 }
 
@@ -75,9 +74,9 @@ ecc_gostdsa_sign (const struct ecc_curve *ecc,
      4. s <-- (r*z + k*h) mod q.
   */
 
-  ecc->mul_g (ecc, P, kp, P + 3*ecc->p.size);
+  ecc_mul_g (ecc, P, kp, P + 3*ecc->p.size);
   /* x coordinate only, modulo q */
-  ecc->h_to_a (ecc, 2, rp, P, P + 3*ecc->p.size);
+  ecc_j_to_a (ecc, 2, rp, P, P + 3*ecc->p.size);
 
   /* Process hash digest */
   gost_hash (&ecc->q, hp, length, digest);