diff options
author | Mattias Andrée <maandree@kth.se> | 2019-02-10 17:54:09 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2019-02-10 17:54:09 +0100 |
commit | 6e3af681aa5927d2ab2861e94c0cfea6fa42c0ab (patch) | |
tree | dc14cf6beeab03da867e7946bd6ab3601a66d370 /hmac_init.c | |
parent | libsha2.h.0: securely erasing the state (diff) | |
download | libsha2-6e3af681aa5927d2ab2861e94c0cfea6fa42c0ab.tar.gz libsha2-6e3af681aa5927d2ab2861e94c0cfea6fa42c0ab.tar.bz2 libsha2-6e3af681aa5927d2ab2861e94c0cfea6fa42c0ab.tar.xz |
Minor improvement and man pages for HMAC
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'hmac_init.c')
-rw-r--r-- | hmac_init.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/hmac_init.c b/hmac_init.c index 4aee2c2..17b31ce 100644 --- a/hmac_init.c +++ b/hmac_init.c @@ -20,6 +20,10 @@ libsha2_hmac_init(struct libsha2_hmac_state *restrict state, enum libsha2_algori state->sha2_state.algorithm = algorithm; state->outsize = libsha2_algorithm_output_size(algorithm) * 8; + if (!state->outsize) { + errno = EINVAL; + return -1; + } state->inited = 0; if (keylen <= state->sha2_state.chunk_size * 8) { |