aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShen Noether <Shen.Noether@gmx.com>2016-06-02 17:24:42 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-08-28 21:27:56 +0100
commit63733b17850e46d9209a9d0f47e6f7b192d6553e (patch)
tree8eab09875ae4a31aa7e5a52fbb0e78b5d1e8da65
parentringct: fix size argument to cn_fast_hash (diff)
downloadmonero-63733b17850e46d9209a9d0f47e6f7b192d6553e.tar.xz
ringct: compare keys with bitwise equality, not crypto ops
Ported from Shen's RingCT repo
-rw-r--r--src/ringct/rctOps.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/ringct/rctOps.cpp b/src/ringct/rctOps.cpp
index 9e45e0ac9..4fdfba73b 100644
--- a/src/ringct/rctOps.cpp
+++ b/src/ringct/rctOps.cpp
@@ -305,14 +305,13 @@ namespace rct {
//checks if A, B are equal as curve points
//without doing curve operations
bool equalKeys(const key & a, const key & b) {
- key eqk;
- sc_sub(eqk.bytes, cn_fast_hash(a).bytes, cn_fast_hash(b).bytes);
- if (sc_isnonzero(eqk.bytes) ) {
- //DP("eq bytes");
- //DP(eqk);
- return false;
+ bool rv = true;
+ for (int i = 0; i < 32; ++i) {
+ if (a.bytes[i] != b.bytes[i]) {
+ rv = false;
+ }
}
- return true;
+ return rv;
}
//Hashing - cn_fast_hash