diff options
author | Mattias Andrée <maandree@kth.se> | 2021-12-24 21:34:11 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-12-24 21:34:11 +0100 |
commit | 495d8cadd04656f263185c37c0c86c5650be5b28 (patch) | |
tree | dda8ce0e46d541b84356a39e04a40b33a09b4552 | |
parent | Add man pages for zero-copy functions (diff) | |
download | libkeccak-1.3.tar.gz libkeccak-1.3.tar.bz2 libkeccak-1.3.tar.xz |
Fix zero-copy update to libkeccak_generalised_sum_fd1.3
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r-- | libkeccak_generalised_sum_fd.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libkeccak_generalised_sum_fd.c b/libkeccak_generalised_sum_fd.c index 78890b4..e86c459 100644 --- a/libkeccak_generalised_sum_fd.c +++ b/libkeccak_generalised_sum_fd.c @@ -1,5 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "common.h" +#include <stdio.h> /** @@ -25,14 +26,16 @@ libkeccak_generalised_sum_fd(int fd, struct libkeccak_state *restrict state, con #endif size_t blksize = 4096; unsigned char *restrict chunk; - size_t chunksize = libkeccak_zerocopy_chunksize(state); - size_t extrasize = (strlen(suffix) + 2 + 7) >> 3; - size_t extrachunks = (extrasize + (chunksize - 1)) / chunksize; + size_t chunksize, extrasize, extrachunks; size_t chunks, chunkmod; if (libkeccak_state_initialise(state, spec) < 0) return -1; + chunksize = libkeccak_zerocopy_chunksize(state); + extrasize = ((suffix ? strlen(suffix) : 0) + 2 + 7) >> 3; + extrachunks = (extrasize + (chunksize - 1)) / chunksize; + #ifndef _WIN32 if (fstat(fd, &attr) == 0) if (attr.st_blksize > 0) |