From 63733b17850e46d9209a9d0f47e6f7b192d6553e Mon Sep 17 00:00:00 2001
From: Shen Noether <Shen.Noether@gmx.com>
Date: Thu, 2 Jun 2016 17:24:42 +0100
Subject: [PATCH] ringct: compare keys with bitwise equality, not crypto ops

Ported from Shen's RingCT repo
---
 src/ringct/rctOps.cpp | 13 ++++++-------
 1 file 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