diff options
author | Mattias Andrée <maandree@kth.se> | 2021-07-30 18:06:26 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-07-30 18:06:26 +0200 |
commit | a198f806d60b641406955d6b8c494b2bd5d8989c (patch) | |
tree | 27883711145184fff8d9dc564d368383b1c675db /libkeccak_hmac_unmarshal.c | |
parent | Fix warning (diff) | |
download | libkeccak-a198f806d60b641406955d6b8c494b2bd5d8989c.tar.gz libkeccak-a198f806d60b641406955d6b8c494b2bd5d8989c.tar.bz2 libkeccak-a198f806d60b641406955d6b8c494b2bd5d8989c.tar.xz |
Do not divide by sizeof(char)
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | libkeccak_hmac_unmarshal.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libkeccak_hmac_unmarshal.c b/libkeccak_hmac_unmarshal.c index 452efa3..2084e23 100644 --- a/libkeccak_hmac_unmarshal.c +++ b/libkeccak_hmac_unmarshal.c @@ -22,10 +22,10 @@ libkeccak_hmac_unmarshal(struct libkeccak_hmac_state *restrict state, const void parsed = libkeccak_state_unmarshal(state ? &state->sponge : NULL, data); if (!parsed) return 0; - data += parsed / sizeof(char); + data += parsed; size = *(const size_t *)data; - data += sizeof(size_t) / sizeof(char); + data += sizeof(size_t); if (state) size = state->key_length; size = (state->key_length + 7) >> 3; @@ -37,12 +37,12 @@ libkeccak_hmac_unmarshal(struct libkeccak_hmac_state *restrict state, const void return 0; } memcpy(state->key_opad, data, size); - data += size / sizeof(char); + data += size; if (data[0]) { - state->key_ipad = state->key_opad + size / sizeof(char); + state->key_ipad = state->key_opad + size; memcpy(state->key_ipad, state->key_opad, size); - for (i = 0; i < size / sizeof(char); i++) + for (i = 0; i < size; i++) state->key_ipad[i] ^= (char)(HMAC_OUTER_PAD ^ HMAC_INNER_PAD); } |