refactor(bp+): save one inversion, use sc_muladd

This commit is contained in:
Dusan Klinec 2022-04-26 13:37:11 +02:00 committed by wowario
parent 17949581a7
commit 16bd593720
No known key found for this signature in database
GPG key ID: 24DCBE762DE9C111

View file

@ -653,8 +653,7 @@ try_again:
{
sc_mul(temp.bytes, temp.bytes, z_squared.bytes);
sc_mul(temp2.bytes, y_powers[MN+1].bytes, temp.bytes);
sc_mul(temp2.bytes, temp2.bytes, gamma[j].bytes);
sc_add(alpha1.bytes, alpha1.bytes, temp2.bytes);
sc_muladd(alpha1.bytes, temp2.bytes, gamma[j].bytes, alpha1.bytes);
}
// These are used in the inner product rounds
@ -715,7 +714,8 @@ try_again:
rct::key challenge_squared;
sc_mul(challenge_squared.bytes, challenge.bytes, challenge.bytes);
rct::key challenge_squared_inv = invert(challenge_squared);
rct::key challenge_squared_inv;
sc_mul(challenge_squared_inv.bytes, challenge_inv.bytes, challenge_inv.bytes);
sc_muladd(alpha1.bytes, dL.bytes, challenge_squared.bytes, alpha1.bytes);
sc_muladd(alpha1.bytes, dR.bytes, challenge_squared_inv.bytes, alpha1.bytes);