Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed Dec 12, 2017
1 parent 1d85e73 commit a1d438c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ blake2b_init_key(blake2b_state *S, const uint8_t outlen, const void *key,
{
uint8_t block[BLAKE2B_BLOCKBYTES];
memset(block, 0, BLAKE2B_BLOCKBYTES);
memcpy(block, key, keylen);
memcpy(block, key, keylen); /* keylen cannot be 0 */
blake2b_update(S, block, BLAKE2B_BLOCKBYTES);
sodium_memzero(block, BLAKE2B_BLOCKBYTES); /* Burn the key from stack */
}
Expand Down Expand Up @@ -249,7 +249,7 @@ blake2b_init_key_salt_personal(blake2b_state *S, const uint8_t outlen,
{
uint8_t block[BLAKE2B_BLOCKBYTES];
memset(block, 0, BLAKE2B_BLOCKBYTES);
memcpy(block, key, keylen);
memcpy(block, key, keylen); /* keylen cannot be 0 */
blake2b_update(S, block, BLAKE2B_BLOCKBYTES);
sodium_memzero(block, BLAKE2B_BLOCKBYTES); /* Burn the key from stack */
}
Expand Down Expand Up @@ -320,7 +320,7 @@ blake2b_final(blake2b_state *S, uint8_t *out, uint8_t outlen)
STORE64_LE(buffer + 8 * 5, S->h[5]);
STORE64_LE(buffer + 8 * 6, S->h[6]);
STORE64_LE(buffer + 8 * 7, S->h[7]);
memcpy(out, buffer, outlen);
memcpy(out, buffer, outlen); /* outlen <= BLAKE2B_OUTBYTES (64) */

sodium_memzero(S->h, sizeof S->h);
sodium_memzero(S->buf, sizeof S->buf);
Expand Down

0 comments on commit a1d438c

Please sign in to comment.