From 568437894a93a6f34b7e3cf21332683946c33902 Mon Sep 17 00:00:00 2001 From: Loup Vaillant Date: Sun, 5 Jan 2020 21:32:41 +0100 Subject: [PATCH] Rolled loop for zero initialisation - Compilers optimise loops better. - We save one line of code this way. (This is a nitpick: in practice, this doesn't change a thing.) --- src/monocypher.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/monocypher.c b/src/monocypher.c index 53cbc48..7e55f24 100644 --- a/src/monocypher.c +++ b/src/monocypher.c @@ -369,10 +369,9 @@ static void poly_block(crypto_poly1305_ctx *ctx) // (re-)initialises the input counter and input buffer static void poly_clear_c(crypto_poly1305_ctx *ctx) { - ctx->c[0] = 0; - ctx->c[1] = 0; - ctx->c[2] = 0; - ctx->c[3] = 0; + FOR (i, 0, 4) { + ctx->c[i] = 0; + } ctx->c_idx = 0; } -- 2.47.3