Hardcode numwords in vli_modMult
diff --git a/include/tinycrypt/ecc.h b/include/tinycrypt/ecc.h
index e016c69..d6f2c9d 100644
--- a/include/tinycrypt/ecc.h
+++ b/include/tinycrypt/ecc.h
@@ -428,8 +428,7 @@
* @param num_words IN -- number of words
*/
void uECC_vli_modMult(uECC_word_t *result, const uECC_word_t *left,
- const uECC_word_t *right, const uECC_word_t *mod,
- wordcount_t num_words);
+ const uECC_word_t *right, const uECC_word_t *mod);
/*
* @brief Computes (1 / input) % mod
diff --git a/tinycrypt/ecc.c b/tinycrypt/ecc.c
index 508831c..81464e1 100644
--- a/tinycrypt/ecc.c
+++ b/tinycrypt/ecc.c
@@ -489,13 +489,11 @@
}
void uECC_vli_modMult(uECC_word_t *result, const uECC_word_t *left,
- const uECC_word_t *right, const uECC_word_t *mod,
- wordcount_t num_words)
+ const uECC_word_t *right, const uECC_word_t *mod)
{
uECC_word_t product[2 * NUM_ECC_WORDS];
uECC_vli_mult_rnd(product, left, right, NULL);
uECC_vli_mmod(result, product, mod);
- (void) num_words;
}
static void uECC_vli_modMult_rnd(uECC_word_t *result, const uECC_word_t *left,
diff --git a/tinycrypt/ecc_dsa.c b/tinycrypt/ecc_dsa.c
index ca07eb1..09b2b84 100644
--- a/tinycrypt/ecc_dsa.c
+++ b/tinycrypt/ecc_dsa.c
@@ -142,9 +142,9 @@
/* Prevent side channel analysis of uECC_vli_modInv() to determine
bits of k / the private key by premultiplying by a random number */
- uECC_vli_modMult(k, k, tmp, curve->n, num_n_words); /* k' = rand * k */
+ uECC_vli_modMult(k, k, tmp, curve->n); /* k' = rand * k */
uECC_vli_modInv(k, k, curve->n, num_n_words); /* k = 1 / k' */
- uECC_vli_modMult(k, k, tmp, curve->n, num_n_words); /* k = 1 / k */
+ uECC_vli_modMult(k, k, tmp, curve->n); /* k = 1 / k */
uECC_vli_nativeToBytes(signature, curve->num_bytes, p); /* store r */
@@ -153,11 +153,11 @@
s[num_n_words - 1] = 0;
uECC_vli_set(s, p);
- uECC_vli_modMult(s, tmp, s, curve->n, num_n_words); /* s = r*d */
+ uECC_vli_modMult(s, tmp, s, curve->n); /* s = r*d */
bits2int(tmp, message_hash, hash_size, curve);
uECC_vli_modAdd(s, tmp, s, curve->n); /* s = e + r*d */
- uECC_vli_modMult(s, s, k, curve->n, num_n_words); /* s = (e + r*d) / k */
+ uECC_vli_modMult(s, s, k, curve->n); /* s = (e + r*d) / k */
if (uECC_vli_numBits(s) > (bitcount_t)curve->num_bytes * 8) {
return 0;
}
@@ -245,8 +245,8 @@
uECC_vli_modInv(z, s, curve->n, num_n_words); /* z = 1/s */
u1[num_n_words - 1] = 0;
bits2int(u1, message_hash, hash_size, curve);
- uECC_vli_modMult(u1, u1, z, curve->n, num_n_words); /* u1 = e/s */
- uECC_vli_modMult(u2, r, z, curve->n, num_n_words); /* u2 = r/s */
+ uECC_vli_modMult(u1, u1, z, curve->n); /* u1 = e/s */
+ uECC_vli_modMult(u2, r, z, curve->n); /* u2 = r/s */
/* Calculate sum = G + Q. */
uECC_vli_set(sum, _public);