diff options
author | Mattias Andrée <maandree@kth.se> | 2022-02-27 18:27:08 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-02-27 18:27:08 +0100 |
commit | ac2a6719f074fa43d79b31a3994549f2af55efd6 (patch) | |
tree | 5b64a6d135fef440bc48af89d846acf1b7937ebc /libkeccak_generalised_sum_fd.c | |
parent | m (diff) | |
download | libkeccak-ac2a6719f074fa43d79b31a3994549f2af55efd6.tar.gz libkeccak-ac2a6719f074fa43d79b31a3994549f2af55efd6.tar.bz2 libkeccak-ac2a6719f074fa43d79b31a3994549f2af55efd6.tar.xz |
Add cSHAKE
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libkeccak_generalised_sum_fd.c')
-rw-r--r-- | libkeccak_generalised_sum_fd.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libkeccak_generalised_sum_fd.c b/libkeccak_generalised_sum_fd.c index 92a5c4c..11431f0 100644 --- a/libkeccak_generalised_sum_fd.c +++ b/libkeccak_generalised_sum_fd.c @@ -8,8 +8,10 @@ * the content of the file is assumed non-sensitive * * @param fd The file descriptor of the file to hash - * @param state The hashing state, should not be initialised (memory leak otherwise) - * @param spec Specifications for the hashing algorithm + * @param state The hashing state, should not be initialised unless + * `spec` is `NULL` (memory leak otherwise) + * @param spec Specifications for the hashing algorithm; or `NULL` + * if `spec` is already initialised * @param suffix The data suffix, see `libkeccak_digest` * @param hashsum Output array for the hashsum, have an allocation size of * at least `((spec->output + 7) / 8) * sizeof(char)`, may be `NULL` @@ -29,7 +31,7 @@ libkeccak_generalised_sum_fd(int fd, struct libkeccak_state *restrict state, con size_t chunksize, extrasize, extrachunks; size_t chunks, chunkmod; - if (libkeccak_state_initialise(state, spec) < 0) + if (spec && libkeccak_state_initialise(state, spec) < 0) return -1; chunksize = libkeccak_zerocopy_chunksize(state); |