From 9f64f51efd9161c9ac7149d52d39d7530558118b Mon Sep 17 00:00:00 2001 From: Mike Hamburg Date: Thu, 22 Jan 2015 18:52:04 -0800 Subject: [PATCH] fix(?) perf regr in verify pre --- src/scalarmul.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/scalarmul.c b/src/scalarmul.c index af7f72a..93d9443 100644 --- a/src/scalarmul.c +++ b/src/scalarmul.c @@ -356,11 +356,13 @@ linear_combo_combs_vt ( assert(table2->t >= 1); #endif - tw_niels_a_t ni; + const struct tw_niels_t *ni; - unsigned int swords[2] = {scalar1b_words, scalar2b_words}, started = 0; + unsigned int swords[2] = {scalar1b_words, scalar2b_words}; word_t *scalars[2] = {scalar1b,scalar2b}; + set_identity_tw_extensible(out); + for (i=0; it-1)) - 1; - copy_tw_niels(ni, table->table[tab + (j<<(table->t-1))]); - cond_negate_tw_niels(ni,invert); + ni = table->table[tab + (j<<(table->t-1))]; - if (started) { - add_tw_niels_to_tw_extensible(out, ni); - } else { - convert_tw_niels_to_tw_extensible(out, ni); - started = 1; - } - + if (invert) sub_tw_niels_from_tw_extensible(out, ni); + else add_tw_niels_to_tw_extensible(out, ni); } } - - assert(started); } return MASK_SUCCESS;