]> git.codecow.com Git - Monocypher.git/commitdiff
Simplify BLAKE2b a tiny little bit
authorLoup Vaillant <loup@loup-vaillant.fr>
Fri, 3 Feb 2023 15:43:06 +0000 (16:43 +0100)
committerLoup Vaillant <loup@loup-vaillant.fr>
Fri, 3 Feb 2023 16:53:24 +0000 (17:53 +0100)
src/monocypher.c

index 7e058712f9150a7695d966924b4d5a61e42df2d4..034da857db13c8e54b0f12dfda7dcbd701156c66 100644 (file)
@@ -569,7 +569,7 @@ void crypto_blake2b_init(crypto_blake2b_ctx *ctx, size_t hash_size)
 void crypto_blake2b_update(crypto_blake2b_ctx *ctx,
                            const u8 *message, size_t message_size)
 {
-       // Avoid UB pointer increments with empty messages
+       // Avoid undefined NULL pointer increments with empty messages
        if (message_size == 0) {
                return;
        }
@@ -619,7 +619,7 @@ void crypto_blake2b_update(crypto_blake2b_ctx *ctx,
                }
                // Fill remaining words (faster than byte by byte)
                size_t nb_words = message_size >> 3;
-               load64_le_buf(ctx->input + (ctx->input_idx >> 3), message, nb_words);
+               load64_le_buf(ctx->input, message, nb_words);
                ctx->input_idx += nb_words << 3;
                message        += nb_words << 3;
                message_size   -= nb_words << 3;