diff --git a/src/blake3/blake3.c b/src/blake3/blake3.c index 4b54cf3a..2ff241d5 100644 --- a/src/blake3/blake3.c +++ b/src/blake3/blake3.c @@ -1,3 +1,4 @@ +// vim: ts=2 sw=2 et #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -26,7 +27,6 @@ INLINE void chunk_state_init(blake3_chunk_state *self, const uint32_t key[8], uint8_t flags) { memcpy(self->cv, key, BLAKE3_KEY_LEN); self->chunk_counter = 0; - memset(self->buf, 0, BLAKE3_BLOCK_LEN); self->buf_len = 0; self->blocks_compressed = 0; self->flags = flags; @@ -37,7 +37,6 @@ INLINE void chunk_state_reset(blake3_chunk_state *self, const uint32_t key[8], memcpy(self->cv, key, BLAKE3_KEY_LEN); self->chunk_counter = chunk_counter; self->blocks_compressed = 0; - memset(self->buf, 0, BLAKE3_BLOCK_LEN); self->buf_len = 0; } @@ -136,7 +135,6 @@ INLINE void chunk_state_update(blake3_host_state *hs, blake3_chunk_state *self, self->flags | chunk_state_maybe_start_flag(self)); self->blocks_compressed += 1; self->buf_len = 0; - memset(self->buf, 0, BLAKE3_BLOCK_LEN); } } @@ -440,6 +438,7 @@ INLINE void compress_subtree_to_parent_node(blake3_host_state *hs, INLINE void hasher_init_base(blake3_hasher *self, const uint32_t key[8], uint8_t flags) { + memset(self, 0, sizeof(*self)); memcpy(self->key, key, BLAKE3_KEY_LEN); chunk_state_init(&self->chunk, key, flags); self->cv_stack_len = 0;