aboutsummaryrefslogtreecommitdiffstats
path: root/hmac_unmarshal.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2019-02-10 20:57:56 +0100
committerMattias Andrée <maandree@kth.se>2019-02-10 20:57:56 +0100
commit15f132722cae63775dd7b2fef866d477c54c7b8e (patch)
tree27359241e0a1a0b6f304060bc0a9e7c9287efd06 /hmac_unmarshal.c
parentFirst commit (diff)
downloadlibsha1-15f132722cae63775dd7b2fef866d477c54c7b8e.tar.gz
libsha1-15f132722cae63775dd7b2fef866d477c54c7b8e.tar.bz2
libsha1-15f132722cae63775dd7b2fef866d477c54c7b8e.tar.xz
Implement SHA-0 and remove .chunk_size1.0
Signed-off-by: Mattias Andrée <maandree@kth.se>
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;
}