aboutsummaryrefslogtreecommitdiffstats
path: root/librecrypt_equal_binary.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--librecrypt_equal_binary.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/librecrypt_equal_binary.c b/librecrypt_equal_binary.c
index e1d17cd..21d9224 100644
--- a/librecrypt_equal_binary.c
+++ b/librecrypt_equal_binary.c
@@ -30,9 +30,12 @@ librecrypt_equal_binary(const void *a, const void *b, size_t len)
size_t i;
unsigned char r = 0u;
+ /* For each character pair XOR is zero on and only on equality,
+ * bitwise OR of all XORs remain 0 if and only if all where equal */
for (i = 0u; i < len; i++)
r = (unsigned char)(r | (*x++ ^ *y++));
+ /* Prevent compiler from returning early */
(*librecrypt_explicit_____)(r);
return r ? 0 : 1;