more comprehensive test for ge_p3 comparison to identity/point at infinity

Reported by QuarksLab.
This commit is contained in:
moneromooo-monero 2018-07-26 18:03:10 +01:00
parent d0a0565f7d
commit 463434d1f7
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
3 changed files with 21 additions and 6 deletions

View file

@ -3729,3 +3729,16 @@ int sc_isnonzero(const unsigned char *s) {
s[18] | s[19] | s[20] | s[21] | s[22] | s[23] | s[24] | s[25] | s[26] |
s[27] | s[28] | s[29] | s[30] | s[31]) - 1) >> 8) + 1;
}
int ge_p3_is_point_at_infinity(const ge_p3 *p) {
// X = 0 and Y == Z
int n;
for (n = 0; n < 10; ++n)
{
if (p->X[n] | p->T[n])
return 0;
if (p->Y[n] != p->Z[n])
return 0;
}
return 1;
}