Hardcode numwords in vli_cpm_unsafe
This commit is contained in:
parent
cbbb0f034b
commit
a752191191
3 changed files with 15 additions and 17 deletions
|
@ -102,7 +102,7 @@ static void bits2int(uECC_word_t *native, const uint8_t *bits,
|
|||
}
|
||||
|
||||
/* Reduce mod curve_n */
|
||||
if (uECC_vli_cmp_unsafe(curve->n, native, num_n_words) != 1) {
|
||||
if (uECC_vli_cmp_unsafe(curve->n, native) != 1) {
|
||||
uECC_vli_sub(native, native, curve->n, num_n_words);
|
||||
}
|
||||
}
|
||||
|
@ -236,8 +236,8 @@ int uECC_verify(const uint8_t *public_key, const uint8_t *message_hash,
|
|||
}
|
||||
|
||||
/* r, s must be < n. */
|
||||
if (uECC_vli_cmp_unsafe(curve->n, r, num_n_words) != 1 ||
|
||||
uECC_vli_cmp_unsafe(curve->n, s, num_n_words) != 1) {
|
||||
if (uECC_vli_cmp_unsafe(curve->n, r) != 1 ||
|
||||
uECC_vli_cmp_unsafe(curve->n, s) != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -293,7 +293,7 @@ int uECC_verify(const uint8_t *public_key, const uint8_t *message_hash,
|
|||
apply_z(rx, ry, z);
|
||||
|
||||
/* v = x1 (mod n) */
|
||||
if (uECC_vli_cmp_unsafe(curve->n, rx, num_n_words) != 1) {
|
||||
if (uECC_vli_cmp_unsafe(curve->n, rx) != 1) {
|
||||
uECC_vli_sub(rx, rx, curve->n, num_n_words);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue