Hardcode numwords in vli_cmp
diff --git a/include/tinycrypt/ecc.h b/include/tinycrypt/ecc.h
index 74c0960..c4dad0b 100644
--- a/include/tinycrypt/ecc.h
+++ b/include/tinycrypt/ecc.h
@@ -320,8 +320,7 @@
* @param num_words IN -- number of words
* @return the sign of left - right
*/
-cmpresult_t uECC_vli_cmp(const uECC_word_t *left, const uECC_word_t *right,
- wordcount_t num_words);
+cmpresult_t uECC_vli_cmp(const uECC_word_t *left, const uECC_word_t *right);
/*
* @brief computes sign of left - right, not in constant time.
diff --git a/tinycrypt/ecc.c b/tinycrypt/ecc.c
index 47acf2a..10d3972 100644
--- a/tinycrypt/ecc.c
+++ b/tinycrypt/ecc.c
@@ -226,13 +226,11 @@
return carry;
}
-cmpresult_t uECC_vli_cmp(const uECC_word_t *left, const uECC_word_t *right,
- wordcount_t num_words)
+cmpresult_t uECC_vli_cmp(const uECC_word_t *left, const uECC_word_t *right)
{
uECC_word_t tmp[NUM_ECC_WORDS];
uECC_word_t neg = !!uECC_vli_sub(tmp, left, right);
uECC_word_t equal = uECC_vli_isZero(tmp);
- (void) num_words;
return (!equal - 2 * neg);
}
@@ -1039,7 +1037,7 @@
random[num_words - 1] &=
mask >> ((bitcount_t)(num_words * uECC_WORD_SIZE * 8 - num_bits));
if (!uECC_vli_isZero(random) &&
- uECC_vli_cmp(top, random, num_words) == 1) {
+ uECC_vli_cmp(top, random) == 1) {
return 1;
}
}
@@ -1109,7 +1107,7 @@
return 0;
}
- if (uECC_vli_cmp(curve->n, _private, BITS_TO_WORDS(curve->num_n_bits)) != 1) {
+ if (uECC_vli_cmp(curve->n, _private) != 1) {
return 0;
}
diff --git a/tinycrypt/ecc_dsa.c b/tinycrypt/ecc_dsa.c
index 1685c20..8cc09c7 100644
--- a/tinycrypt/ecc_dsa.c
+++ b/tinycrypt/ecc_dsa.c
@@ -121,7 +121,7 @@
/* Make sure 0 < k < curve_n */
if (uECC_vli_isZero(k) ||
- uECC_vli_cmp(curve->n, k, num_n_words) != 1) {
+ uECC_vli_cmp(curve->n, k) != 1) {
return 0;
}