From 15f132722cae63775dd7b2fef866d477c54c7b8e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 10 Feb 2019 20:57:56 +0100 Subject: Implement SHA-0 and remove .chunk_size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- hmac_unmarshal.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'hmac_unmarshal.c') 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; } -- cgit v1.2.3-70-g09d2