From 519fa062fa8297fdf871319f81f4179ed7aba63c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 13 Nov 2014 05:10:02 +0100 Subject: assume the contents of files are nonsensitive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libkeccak/files.c | 7 ++++--- src/libkeccak/files.h | 15 ++++++++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/libkeccak/files.c b/src/libkeccak/files.c index aa71037..46aea61 100644 --- a/src/libkeccak/files.c +++ b/src/libkeccak/files.c @@ -26,7 +26,8 @@ /** - * Calculate a Keccak-family hashsum of a file + * Calculate a Keccak-family hashsum of a file, + * 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) @@ -59,10 +60,10 @@ int libkeccak_generalised_sum_fd(int fd, libkeccak_state_t* restrict state, got = read(fd, chunk, blksize); if (got < 0) return -1; if (got == 0) break; - if (libkeccak_update(state, chunk, (size_t)got) < 0) + if (libkeccak_fast_update(state, chunk, (size_t)got) < 0) return -1; } - return libkeccak_digest(state, NULL, 0, 0, suffix, hashsum); + return libkeccak_fast_digest(state, NULL, 0, 0, suffix, hashsum); } diff --git a/src/libkeccak/files.h b/src/libkeccak/files.h index de63c85..f3279af 100644 --- a/src/libkeccak/files.h +++ b/src/libkeccak/files.h @@ -24,7 +24,8 @@ /** - * Calculate a Keccak-family hashsum of a file + * Calculate a Keccak-family hashsum of a file, + * 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) @@ -41,7 +42,8 @@ int libkeccak_generalised_sum_fd(int fd, libkeccak_state_t* restrict state, /** - * Calculate the Keccak hashsum of a file + * Calculate the Keccak hashsum of a file, + * 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) @@ -59,7 +61,8 @@ int libkeccak_keccaksum_fd(int fd, libkeccak_state_t* restrict state, /** - * Calculate the SHA3 hashsum of a file + * Calculate the SHA3 hashsum of a file, + * 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) @@ -79,7 +82,8 @@ int libkeccak_sha3sum_fd(int fd, libkeccak_state_t* restrict state, /** - * Calculate the RawSHAKE hashsum of a file + * Calculate the RawSHAKE hashsum of a file, + * 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) @@ -100,7 +104,8 @@ int libkeccak_rawshakesum_fd(int fd, libkeccak_state_t* restrict state, /** - * Calculate the SHAKE hashsum of a file + * Calculate the SHAKE hashsum of a file, + * 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) -- cgit v1.2.3-70-g09d2