aboutsummaryrefslogtreecommitdiffstats
path: root/libkeccak_hmac_fast_update.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_fast_update.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 'libkeccak_hmac_fast_update.c')
-rw-r--r--libkeccak_hmac_fast_update.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libkeccak_hmac_fast_update.c b/libkeccak_hmac_fast_update.c
index fe49960..5a1eb70 100644
--- a/libkeccak_hmac_fast_update.c
+++ b/libkeccak_hmac_fast_update.c
@@ -14,8 +14,8 @@
int
libkeccak_hmac_fast_update(struct libkeccak_hmac_state *restrict state, const void *restrict msg_, size_t msglen)
{
- const char *restrict msg = msg_;
- char *old;
+ const unsigned char *restrict msg = msg_;
+ unsigned char *old;
size_t i;
int n, cn;
@@ -43,9 +43,9 @@ libkeccak_hmac_fast_update(struct libkeccak_hmac_state *restrict state, const vo
n = (int)(state->key_length & 7);
cn = 8 - n;
for (i = 1; i < msglen; i++)
- state->buffer[i] = (char)((msg[i - 1] >> cn) | (msg[i] << n));
- state->buffer[0] = (char)((state->leftover & ((1 << n) - 1)) | (msg[0] << n));
- state->leftover = (char)((unsigned char)msg[msglen - 1] >> cn);
+ state->buffer[i] = (unsigned char)((msg[i - 1] >> cn) | (msg[i] << n));
+ state->buffer[0] = (unsigned char)((state->leftover & ((1 << n) - 1)) | (msg[0] << n));
+ state->leftover = (unsigned char)(msg[msglen - 1] >> cn);
return libkeccak_fast_update(&state->sponge, state->buffer, msglen);
}