summaryrefslogtreecommitdiffhomepage
path: root/src/crypto/zinc
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-03-27 18:08:19 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-03-27 18:08:19 +0100
commit2aecdd106f20816cee7e85902d7c517606b1e563 (patch)
treee423a407a56b87a8e75e0bf7c8884bff74953d54 /src/crypto/zinc
parentdbd56ac3969f3d100e945fc27599cf8ccdd098e9 (diff)
blake2s: remove outlen parameter from final
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/crypto/zinc')
-rw-r--r--src/crypto/zinc/blake2s/blake2s.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/crypto/zinc/blake2s/blake2s.c b/src/crypto/zinc/blake2s/blake2s.c
index 5bf76e2..e9e0bda 100644
--- a/src/crypto/zinc/blake2s/blake2s.c
+++ b/src/crypto/zinc/blake2s/blake2s.c
@@ -194,10 +194,9 @@ void blake2s_update(struct blake2s_state *state, const u8 *in, size_t inlen)
}
EXPORT_SYMBOL(blake2s_update);
-void blake2s_final(struct blake2s_state *state, u8 *out, const size_t outlen)
+void blake2s_final(struct blake2s_state *state, u8 *out)
{
- WARN_ON(IS_ENABLED(DEBUG) &&
- (!out || outlen < state->outlen));
+ WARN_ON(IS_ENABLED(DEBUG) && !out);
blake2s_set_lastblock(state);
memset(state->buf + state->buflen, 0,
BLAKE2S_BLOCK_SIZE - state->buflen); /* Padding */
@@ -219,7 +218,7 @@ void blake2s_hmac(u8 *out, const u8 *in, const u8 *key, const size_t outlen,
if (keylen > BLAKE2S_BLOCK_SIZE) {
blake2s_init(&state, BLAKE2S_HASH_SIZE);
blake2s_update(&state, key, keylen);
- blake2s_final(&state, x_key, BLAKE2S_HASH_SIZE);
+ blake2s_final(&state, x_key);
} else
memcpy(x_key, key, keylen);
@@ -229,7 +228,7 @@ void blake2s_hmac(u8 *out, const u8 *in, const u8 *key, const size_t outlen,
blake2s_init(&state, BLAKE2S_HASH_SIZE);
blake2s_update(&state, x_key, BLAKE2S_BLOCK_SIZE);
blake2s_update(&state, in, inlen);
- blake2s_final(&state, i_hash, BLAKE2S_HASH_SIZE);
+ blake2s_final(&state, i_hash);
for (i = 0; i < BLAKE2S_BLOCK_SIZE; ++i)
x_key[i] ^= 0x5c ^ 0x36;
@@ -237,7 +236,7 @@ void blake2s_hmac(u8 *out, const u8 *in, const u8 *key, const size_t outlen,
blake2s_init(&state, BLAKE2S_HASH_SIZE);
blake2s_update(&state, x_key, BLAKE2S_BLOCK_SIZE);
blake2s_update(&state, i_hash, BLAKE2S_HASH_SIZE);
- blake2s_final(&state, i_hash, BLAKE2S_HASH_SIZE);
+ blake2s_final(&state, i_hash);
memcpy(out, i_hash, outlen);
memzero_explicit(x_key, BLAKE2S_BLOCK_SIZE);