aboutsummaryrefslogtreecommitdiffstats
path: root/libkeccak_hmac_set_key.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-07-30 18:06:26 +0200
committerMattias Andrée <maandree@kth.se>2021-07-30 18:06:26 +0200
commita198f806d60b641406955d6b8c494b2bd5d8989c (patch)
tree27883711145184fff8d9dc564d368383b1c675db /libkeccak_hmac_set_key.c
parentFix warning (diff)
downloadlibkeccak-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 'libkeccak_hmac_set_key.c')
-rw-r--r--libkeccak_hmac_set_key.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libkeccak_hmac_set_key.c b/libkeccak_hmac_set_key.c
index f8f6a39..b056439 100644
--- a/libkeccak_hmac_set_key.c
+++ b/libkeccak_hmac_set_key.c
@@ -25,7 +25,7 @@ libkeccak_hmac_set_key(struct libkeccak_hmac_state *restrict state, const void *
state->key_opad = realloc(old = state->key_opad, 2 * size);
if (!state->key_opad)
return state->key_opad = old, -1;
- state->key_ipad = state->key_opad + size / sizeof(char);
+ state->key_ipad = state->key_opad + size;
}
memcpy(state->key_opad, key, key_bytes);
@@ -33,7 +33,7 @@ libkeccak_hmac_set_key(struct libkeccak_hmac_state *restrict state, const void *
state->key_opad[(key_bytes >> 3) - 1] &= (unsigned char)((1 << (key_length & 7)) - 1);
if ((size_t)(state->sponge.r) > key_length)
- __builtin_memset(state->key_opad + key_bytes / sizeof(char), 0, size - key_bytes);
+ __builtin_memset(state->key_opad + key_bytes, 0, size - key_bytes);
for (i = 0; i < size; i++) {
state->key_ipad[i] = state->key_opad[i] ^ HMAC_INNER_PAD;