From 257dacd7bb74a45a9628d43cf232394e7909c0d4 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka <valenok@gmail.com> Date: Mon, 30 Dec 2013 11:43:07 +0000 Subject: [PATCH] Squashed warning about dangerous optimization --- mongoose.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mongoose.c b/mongoose.c index 4de79c5f2..9ea78be3c 100644 --- a/mongoose.c +++ b/mongoose.c @@ -1347,8 +1347,10 @@ static void SHA1Transform(uint32_t state[5], const unsigned char buffer[64]) { state[2] += c; state[3] += d; state[4] += e; - a = b = c = d = e = 0; - memset(block, '\0', sizeof(block)); + // Erase working structures. The order of operations is important, + // used to ensure that compiler doesn't optimize those out. + memset(block, 0, sizeof(block)); + a = b = c = d = e = block[0].l[0]; } static void SHA1Init(SHA1_CTX* context) { -- GitLab