]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Stricter requirements for in-place ecc_add_func.
authorNiels Möller <nisse@lysator.liu.se>
Tue, 3 Nov 2020 19:26:34 +0000 (20:26 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Tue, 3 Nov 2020 19:26:34 +0000 (20:26 +0100)
ChangeLog
ecc-internal.h
ecc-mul-a-eh.c
testsuite/ecc-add-test.c

index f44401fbbb876bb7a79bf370d93bb67bdc938c2f..025403c909f66e8b9a557e895641a06e7d4a9985 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2020-11-03  Niels Möller  <nisse@lysator.liu.se>
 
+       * ecc-internal.h (ecc_add_func): Document in-place operation.
+       * ecc-mul-a-eh.c (ecc_mul_a_eh): Fix call to ecc->add_hhh accordingly.
+       * testsuite/ecc-add-test.c (test_main): Likewise.
+
        * ecc-add-eh.c (ecc_add_eh): Reduce scratch need.
        * ecc-add-th.c (ecc_add_th): Analogous changes.
        * ecc-internal.h (ECC_ADD_EH_ITCH, ECC_ADD_TH_ITCH): Now 4*size.
index 0afd7c6b5b39443ceffd90321b87b2e242932a76..6dba06d1b00cf6e59439f46e54033bd2d67017e9 100644 (file)
@@ -129,6 +129,7 @@ typedef int ecc_mod_sqrt_func (const struct ecc_modulo *m,
                               const mp_limb_t *up, const mp_limb_t *vp,
                               mp_limb_t *scratch);
 
+/* Allows in-place operation with r == p, but not r == q */
 typedef void ecc_add_func (const struct ecc_curve *ecc,
                           mp_limb_t *r,
                           const mp_limb_t *p, const mp_limb_t *q,
index d7765ebfe9300b0ded290807a802ede7cbca2072..b0aa269765a2ddf3ec3bdc05492d789d0b5f6bfc 100644 (file)
@@ -167,7 +167,7 @@ ecc_mul_a_eh (const struct ecc_curve *ecc,
 
       bits &= TABLE_MASK;
       sec_tabselect (tp, 3*ecc->p.size, table, TABLE_SIZE, bits);
-      ecc->add_hhh (ecc, r, tp, r, scratch_out);
+      ecc->add_hhh (ecc, r, r, tp, scratch_out);
     }
 #undef table
 #undef tp
index d3b0bd92f4356c48e72dd8e2360f5a913a041028..6f58a3bbe029131b5a9ea6031ef0743cebb7f3ac 100644 (file)
@@ -35,7 +35,7 @@ test_main (void)
          ecc->add_hh (ecc, p, z, z, scratch);
          test_ecc_mul_h (i, 0, p);
 
-         ecc->add_hhh (ecc, p, g, p, scratch);
+         ecc->add_hhh (ecc, p, p, g, scratch);
          test_ecc_mul_h (i, 1, p);
 
          ecc->add_hh (ecc, p, z, g, scratch);