diff options
Diffstat (limited to 'libkeccak_hmac_fast_digest.c')
-rw-r--r-- | libkeccak_hmac_fast_digest.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libkeccak_hmac_fast_digest.c b/libkeccak_hmac_fast_digest.c index c203716..d8b4509 100644 --- a/libkeccak_hmac_fast_digest.c +++ b/libkeccak_hmac_fast_digest.c @@ -20,10 +20,10 @@ int libkeccak_hmac_fast_digest(struct libkeccak_hmac_state *restrict state, const void *restrict msg_, size_t msglen, size_t bits, const char *restrict suffix, void *restrict hashsum) { - const char *restrict msg = msg_; + const unsigned char *restrict msg = msg_; size_t hashsize = (size_t)state->sponge.n >> 3; - char *tmp = malloc((size_t)((state->sponge.n + 7) >> 3) * sizeof(char)); - char leftover[2]; + unsigned char *tmp = malloc((size_t)((state->sponge.n + 7) >> 3) * sizeof(char)); + unsigned char leftover[2]; size_t newlen; if (!tmp) @@ -39,8 +39,8 @@ libkeccak_hmac_fast_digest(struct libkeccak_hmac_state *restrict state, const vo goto fail; leftover[0] = state->leftover; if (bits) { - leftover[0] |= (char)(msg[msglen] >> (state->key_length & 7)); - leftover[1] = (char)((unsigned char)msg[msglen] << (8 - (state->key_length & 7))); + leftover[0] |= (unsigned char)(msg[msglen] >> (state->key_length & 7)); + leftover[1] = (unsigned char)(msg[msglen] << (8 - (state->key_length & 7))); } newlen = (state->key_length & 7) + bits; if (libkeccak_fast_digest(&state->sponge, leftover, newlen >> 3, newlen & 7, suffix, tmp) < 0) @@ -62,8 +62,8 @@ stage_2: goto fail; leftover[0] = state->leftover; if (bits) { - leftover[0] |= (char)(tmp[hashsize] >> (state->key_length & 7)); - leftover[1] = (char)((unsigned char)tmp[hashsize] << (8 - (state->key_length & 7))); + leftover[0] |= (unsigned char)(tmp[hashsize] >> (state->key_length & 7)); + leftover[1] = (unsigned char)(tmp[hashsize] << (8 - (state->key_length & 7))); } newlen = (state->key_length & 7) + bits; if (libkeccak_fast_digest(&state->sponge, leftover, newlen >> 3, newlen & 7, suffix, tmp) < 0) |