aboutsummaryrefslogtreecommitdiffstats
path: root/libkeccak_hmac_set_key.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2019-02-11 17:56:37 +0100
committerMattias Andrée <maandree@kth.se>2019-02-11 17:56:37 +0100
commit5cee9b9c6394cffee6f31fab00323d9e559f0702 (patch)
treed21ba3da234c46b4f3c96e0065eb83d8c3cc8e96 /libkeccak_hmac_set_key.c
parentDeprecate typedefs (diff)
downloadlibkeccak-5cee9b9c6394cffee6f31fab00323d9e559f0702.tar.gz
libkeccak-5cee9b9c6394cffee6f31fab00323d9e559f0702.tar.bz2
libkeccak-5cee9b9c6394cffee6f31fab00323d9e559f0702.tar.xz
General improvements
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-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 89c01e6..f8f6a39 100644
--- a/libkeccak_hmac_set_key.c
+++ b/libkeccak_hmac_set_key.c
@@ -14,7 +14,7 @@ int
libkeccak_hmac_set_key(struct libkeccak_hmac_state *restrict state, const void *restrict key, size_t key_length)
{
size_t i, size, new_key_length, key_bytes;
- char *old;
+ unsigned char *old;
size = (size_t)(state->sponge.r) > key_length ? (size_t)(state->sponge.r) : key_length;
new_key_length = size;
@@ -30,7 +30,7 @@ libkeccak_hmac_set_key(struct libkeccak_hmac_state *restrict state, const void *
memcpy(state->key_opad, key, key_bytes);
if (key_length & 7)
- state->key_opad[(key_bytes >> 3) - 1] &= (char)((1 << (key_length & 7)) - 1);
+ 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);