aboutsummaryrefslogtreecommitdiffstats
path: root/hmac_unmarshal.c
diff options
context:
space:
mode:
Diffstat (limited to 'hmac_unmarshal.c')
-rw-r--r--hmac_unmarshal.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/hmac_unmarshal.c b/hmac_unmarshal.c
index 8db73c8..bd8f3fe 100644
--- a/hmac_unmarshal.c
+++ b/hmac_unmarshal.c
@@ -33,7 +33,7 @@ libsha1_hmac_unmarshal(struct libsha1_hmac_state *restrict state, const void *re
return 0;
off += r;
- if (bufsize - off < sizeof(size_t) + sizeof(unsigned char) + 2 * state->sha1_state.chunk_size) {
+ if (bufsize - off < sizeof(size_t) + sizeof(unsigned char) + sizeof(state->ipad) + sizeof(state->opad)) {
errno = EINVAL;
return 0;
}
@@ -44,11 +44,11 @@ libsha1_hmac_unmarshal(struct libsha1_hmac_state *restrict state, const void *re
state->inited = *(const unsigned char *)&buf[off];
off += sizeof(unsigned char);
- memcpy(state->ipad, &buf[off], state->sha1_state.chunk_size);
- off += state->sha1_state.chunk_size;
+ memcpy(state->ipad, &buf[off], sizeof(state->ipad));
+ off += sizeof(state->ipad);
- memcpy(state->opad, &buf[off], state->sha1_state.chunk_size);
- off += state->sha1_state.chunk_size;
+ memcpy(state->opad, &buf[off], sizeof(state->opad));
+ off += sizeof(state->opad);
return off;
}