commit ab7c8f4efc0c6f0c259e6b9303637969d2435f4b
parent 255c45dd3bfe20b633585932f2acce80263822c8
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Sun, 16 May 2021 18:09:20 +0300
sha256: minor optimization
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/microhttpd/sha256.c b/src/microhttpd/sha256.c
@@ -341,8 +341,8 @@ MHD_SHA256_finish (void *ctx_,
if (SHA256_BLOCK_SIZE - bytes_have < SHA256_SIZE_OF_LEN_ADD)
{ /* No space in current block to put total length of message.
Pad current block with zeros and process it. */
- while (bytes_have < SHA256_BLOCK_SIZE)
- ctx->buffer[bytes_have++] = 0;
+ if (bytes_have < SHA256_BLOCK_SIZE)
+ memset (ctx->buffer + bytes_have, 0, SHA256_BLOCK_SIZE - bytes_have);
/* Process full block. */
sha256_transform (ctx->H, ctx->buffer);
/* Start new block. */