aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/crypto-ops.c
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-07-26 18:03:10 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-09-11 13:38:20 +0000
commit463434d1f7159780f64b0fe2ca4d042cb49f1b2a (patch)
treefa92dd273c2d15848564ccc828357d1ce1a5d5a5 /src/crypto/crypto-ops.c
parentunit_tests: add a few more multiexp unit tests (diff)
downloadmonero-463434d1f7159780f64b0fe2ca4d042cb49f1b2a.tar.xz
more comprehensive test for ge_p3 comparison to identity/point at infinity
Reported by QuarksLab.
Diffstat (limited to 'src/crypto/crypto-ops.c')
-rw-r--r--src/crypto/crypto-ops.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/crypto/crypto-ops.c b/src/crypto/crypto-ops.c
index c1fff1d44..09296d6f9 100644
--- a/src/crypto/crypto-ops.c
+++ b/src/crypto/crypto-ops.c
@@ -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;
+}