mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-10 23:35:37 +00:00
Hardcode numwords in vli_equal
This commit is contained in:
parent
a752191191
commit
2eca3d367b
|
@ -419,8 +419,7 @@ uECC_word_t uECC_vli_sub(uECC_word_t *result, const uECC_word_t *left,
|
|||
* @param num_words IN -- number of words
|
||||
* @return Returns 0 if left == right, 1 otherwise.
|
||||
*/
|
||||
uECC_word_t uECC_vli_equal(const uECC_word_t *left, const uECC_word_t *right,
|
||||
wordcount_t num_words);
|
||||
uECC_word_t uECC_vli_equal(const uECC_word_t *left, const uECC_word_t *right);
|
||||
|
||||
/*
|
||||
* @brief Computes (left * right) % mod
|
||||
|
|
|
@ -176,14 +176,13 @@ cmpresult_t uECC_vli_cmp_unsafe(const uECC_word_t *left,
|
|||
return 0;
|
||||
}
|
||||
|
||||
uECC_word_t uECC_vli_equal(const uECC_word_t *left, const uECC_word_t *right,
|
||||
wordcount_t num_words)
|
||||
uECC_word_t uECC_vli_equal(const uECC_word_t *left, const uECC_word_t *right)
|
||||
{
|
||||
|
||||
uECC_word_t diff = 0;
|
||||
wordcount_t i;
|
||||
|
||||
for (i = num_words - 1; i >= 0; --i) {
|
||||
for (i = NUM_ECC_WORDS - 1; i >= 0; --i) {
|
||||
diff |= (left[i] ^ right[i]);
|
||||
}
|
||||
return !(diff == 0);
|
||||
|
@ -1066,7 +1065,7 @@ int uECC_valid_point(const uECC_word_t *point, uECC_Curve curve)
|
|||
curve->x_side(tmp2, point, curve); /* tmp2 = x^3 + ax + b */
|
||||
|
||||
/* Make sure that y^2 == x^3 + ax + b */
|
||||
if (uECC_vli_equal(tmp1, tmp2, num_words) != 0)
|
||||
if (uECC_vli_equal(tmp1, tmp2) != 0)
|
||||
return -3;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -298,7 +298,7 @@ int uECC_verify(const uint8_t *public_key, const uint8_t *message_hash,
|
|||
}
|
||||
|
||||
/* Accept only if v == r. */
|
||||
return (int)(uECC_vli_equal(rx, r, num_words) == 0);
|
||||
return (int)(uECC_vli_equal(rx, r) == 0);
|
||||
}
|
||||
#else
|
||||
typedef int mbedtls_dummy_tinycrypt_def;
|
||||
|
|
Loading…
Reference in a new issue