aboutsummaryrefslogtreecommitdiffstats
path: root/hmac_init.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2019-02-10 17:54:09 +0100
committerMattias Andrée <maandree@kth.se>2019-02-10 17:54:09 +0100
commit6e3af681aa5927d2ab2861e94c0cfea6fa42c0ab (patch)
treedc14cf6beeab03da867e7946bd6ab3601a66d370 /hmac_init.c
parentlibsha2.h.0: securely erasing the state (diff)
downloadlibsha2-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.c4
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) {