From 74ee27ec95d9ddd79d85afe19dc05636acaf9112 Mon Sep 17 00:00:00 2001 From: Loup Vaillant Date: Wed, 14 Feb 2018 20:37:25 +0100 Subject: [PATCH] More readable Chacha20 quarter rounds --- src/monocypher.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/monocypher.c b/src/monocypher.c index 9a49137..222d7b8 100644 --- a/src/monocypher.c +++ b/src/monocypher.c @@ -101,11 +101,11 @@ void crypto_wipe(void *secret, size_t size) ///////////////// /// Chacha 20 /// ///////////////// -#define QUARTERROUND(a, b, c, d) \ - a += b; d ^= a; d = rotl32(d, 16); \ - c += d; b ^= c; b = rotl32(b, 12); \ - a += b; d ^= a; d = rotl32(d, 8); \ - c += d; b ^= c; b = rotl32(b, 7) +#define QUARTERROUND(a, b, c, d) \ + a += b; d = rotl32(d ^ a, 16); \ + c += d; b = rotl32(b ^ c, 12); \ + a += b; d = rotl32(d ^ a, 8); \ + c += d; b = rotl32(b ^ c, 7) static void chacha20_rounds(u32 out[16], const u32 in[16]) { -- 2.47.3