aboutsummaryrefslogtreecommitdiffstats
path: root/hmac_init.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2019-02-10 19:18:57 +0100
committerMattias Andrée <maandree@kth.se>2019-02-10 19:18:57 +0100
commit3bf8125fce2a7fa71214a03384f2a6dac459ccfc (patch)
tree5a13fb1d9fcc46876c19ce1e82107c152570d7a7 /hmac_init.c
parentFix warnings (diff)
downloadlibsha2-3bf8125fce2a7fa71214a03384f2a6dac459ccfc.tar.gz
libsha2-3bf8125fce2a7fa71214a03384f2a6dac459ccfc.tar.bz2
libsha2-3bf8125fce2a7fa71214a03384f2a6dac459ccfc.tar.xz
Fix HMAC and add tests1.0.1
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'hmac_init.c')
-rw-r--r--hmac_init.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hmac_init.c b/hmac_init.c
index b60ebef..6983073 100644
--- a/hmac_init.c
+++ b/hmac_init.c
@@ -26,7 +26,7 @@ libsha2_hmac_init(struct libsha2_hmac_state *restrict state, enum libsha2_algori
}
state->inited = 0;
- if (keylen <= state->sha2_state.chunk_size * 8) {
+ if (keylen <= (algorithm <= LIBSHA2_256 ? 64 * 8 : 128 * 8)) {
memset(state->ipad, 0x36, sizeof(state->ipad));
memset(state->opad, 0x5C, sizeof(state->opad));
for (i = 0; i < keylen / 8; i++) {