aboutsummaryrefslogtreecommitdiffstats
path: root/hmac_init.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-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) {