Fix for constant time (step 2)
This commit is contained in:
14
src/mod.c
14
src/mod.c
@@ -116,11 +116,15 @@ mod_reduce (bn256 *X, const bn512 *A, const bn256 *B, const bn256 *MU_lower)
|
|||||||
q_big->word[8] -= tmp->word[8];
|
q_big->word[8] -= tmp->word[8];
|
||||||
|
|
||||||
carry = q_big->word[8];
|
carry = q_big->word[8];
|
||||||
while (carry)
|
if (carry)
|
||||||
{
|
carry -= bn256_sub (X, X, B);
|
||||||
borrow_next = bn256_sub (X, X, B);
|
else
|
||||||
carry -= borrow_next;
|
bn256_sub (q, X, B);
|
||||||
}
|
|
||||||
|
if (carry)
|
||||||
|
carry -= bn256_sub (X, X, B);
|
||||||
|
else
|
||||||
|
bn256_sub (q, X, B);
|
||||||
|
|
||||||
borrow = bn256_sub (q, X, B);
|
borrow = bn256_sub (q, X, B);
|
||||||
if (borrow)
|
if (borrow)
|
||||||
|
|||||||
Reference in New Issue
Block a user