From: Loup Vaillant Date: Fri, 15 Dec 2017 18:45:21 +0000 (+0100) Subject: Fixed #74 (crypto_verify bug) X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=edf83759df6fb3413f58f3d7e8a52a4cd6e45410;p=Monocypher.git Fixed #74 (crypto_verify bug) --- 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)); }