From edf83759df6fb3413f58f3d7e8a52a4cd6e45410 Mon Sep 17 00:00:00 2001 From: Loup Vaillant Date: Fri, 15 Dec 2017 19:45:21 +0100 Subject: [PATCH] Fixed #74 (crypto_verify bug) --- src/monocypher.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/monocypher.c b/src/monocypher.c index dd97a9c..b4828f1 100644 --- a/src/monocypher.c +++ b/src/monocypher.c @@ -77,8 +77,8 @@ static u64 x16(const u8 a[16], const u8 b[16]) return (load64_le(a + 0) ^ load64_le(b + 0)) | (load64_le(a + 8) ^ load64_le(b + 8)); } -static u64 x32(const u8 a[16],const u8 b[16]){return x16(a,b) ^ x16(a+16, b+16);} -static u64 x64(const u8 a[64],const u8 b[64]){return x32(a,b) ^ x32(a+32, b+32);} +static u64 x32(const u8 a[16],const u8 b[16]){return x16(a,b) | x16(a+16, b+16);} +static u64 x64(const u8 a[64],const u8 b[64]){return x32(a,b) | x32(a+32, b+32);} int crypto_verify16(const u8 a[16], const u8 b[16]){ return neq0(x16(a, b)); } int crypto_verify32(const u8 a[32], const u8 b[32]){ return neq0(x32(a, b)); } int crypto_verify64(const u8 a[64], const u8 b[64]){ return neq0(x64(a, b)); } -- 2.47.3