aboutsummaryrefslogtreecommitdiffstats
path: root/libkeccak_hmac_fast_update.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2023-07-02 16:22:54 +0200
committerMattias Andrée <maandree@kth.se>2023-07-02 16:22:54 +0200
commit2c13d7a29b7b6a16401e9ef3a9f6d9793e2250be (patch)
tree48b9cc13933e17f9dfd0e94bb73ea48f3b6f2dde /libkeccak_hmac_fast_update.c
parentUpdate DEPENDENCIES (diff)
downloadlibkeccak-1.4.tar.gz
libkeccak-1.4.tar.bz2
libkeccak-1.4.tar.xz
Fix false warnings1.4
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libkeccak_hmac_fast_update.c')
-rw-r--r--libkeccak_hmac_fast_update.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/libkeccak_hmac_fast_update.c b/libkeccak_hmac_fast_update.c
index 2f541d4..50c34dd 100644
--- a/libkeccak_hmac_fast_update.c
+++ b/libkeccak_hmac_fast_update.c
@@ -15,7 +15,7 @@ int
libkeccak_hmac_fast_update(struct libkeccak_hmac_state *restrict state, const void *restrict msg_, size_t msglen)
{
const unsigned char *restrict msg = msg_;
- unsigned char *old;
+ void *new;
size_t i;
int n, cn;
@@ -34,11 +34,10 @@ libkeccak_hmac_fast_update(struct libkeccak_hmac_state *restrict state, const vo
return libkeccak_fast_update(&state->sponge, msg, msglen);
if (msglen != state->buffer_size) {
- state->buffer = realloc(old = state->buffer, msglen);
- if (!state->buffer) {
- state->buffer = old;
+ new = realloc(state->buffer, msglen);
+ if (!new)
return -1;
- }
+ state->buffer = new;
state->buffer_size = msglen;
}