diff --git a/include/tinycrypt/ecc.h b/include/tinycrypt/ecc.h index e016c696b..d6f2c9dfc 100644 --- a/include/tinycrypt/ecc.h +++ b/include/tinycrypt/ecc.h @@ -428,8 +428,7 @@ uECC_word_t uECC_vli_equal(const uECC_word_t *left, const uECC_word_t *right); * @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 508831cb2..81464e1e0 100644 --- a/tinycrypt/ecc.c +++ b/tinycrypt/ecc.c @@ -489,13 +489,11 @@ void uECC_vli_mmod(uECC_word_t *result, uECC_word_t *product, } 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 ca07eb191..09b2b848e 100644 --- a/tinycrypt/ecc_dsa.c +++ b/tinycrypt/ecc_dsa.c @@ -142,9 +142,9 @@ int uECC_sign_with_k(const uint8_t *private_key, const uint8_t *message_hash, /* 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 @@ int uECC_sign_with_k(const uint8_t *private_key, const uint8_t *message_hash, 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 @@ int uECC_verify(const uint8_t *public_key, const uint8_t *message_hash, 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);