From: Loup Vaillant Date: Wed, 14 Feb 2018 19:37:25 +0000 (+0100) Subject: More readable Chacha20 quarter rounds X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=74ee27ec95d9ddd79d85afe19dc05636acaf9112;p=Monocypher.git More readable Chacha20 quarter rounds --- 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]) {