summaryrefslogtreecommitdiff
path: root/lib/sha256.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2018-05-06 13:30:24 +0200
committerBruno Haible <bruno@clisp.org>2018-05-06 13:30:24 +0200
commit22d459bb708adc2651f47e6ad877e4848c5319bd (patch)
treeff94bba8f3c803315991e37114bcdf4bae09d2f5 /lib/sha256.h
parentc24c54ae211f0b482693394f71970b182120f2ef (diff)
downloadgnulib-22d459bb708adc2651f47e6ad877e4848c5319bd.tar.gz
af_alg: Fix bug with streams that are not at position 0.
* lib/af_alg.c (afalg_stream): Before sendfile, invoke fflush. Don't assume that the stream is positioned at position 0. * lib/af_alg.h (afalg_stream): Mention restriction regarding the state of the stream. * lib/md5.h (md5_stream): Likewise. * lib/sha1.h (sha1_stream): Likewise. * lib/sha256.h (sha256_stream, sha224_stream): Likewise. * lib/sha512.h (sha512_stream, sha384_stream): Likewise. * modules/crypto/af_alg (Depends-on): Add fflush, lseek.
Diffstat (limited to 'lib/sha256.h')
-rw-r--r--lib/sha256.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/sha256.h b/lib/sha256.h
index e3449864bb..19ed3ccd4d 100644
--- a/lib/sha256.h
+++ b/lib/sha256.h
@@ -89,8 +89,11 @@ extern void *sha256_buffer (const char *buffer, size_t len, void *resblock);
extern void *sha224_buffer (const char *buffer, size_t len, void *resblock);
# endif
-/* Compute SHA256 (SHA224) message digest for bytes read from STREAM. The
- resulting message digest number will be written into the 32 (28) bytes
+/* Compute SHA256 (SHA224) message digest for bytes read from STREAM.
+ STREAM is an open file stream. Regular files are handled more efficiently.
+ The contents of STREAM from its current position to its end will be read.
+ The case that the last operation on STREAM was an 'ungetc' is not supported.
+ The resulting message digest number will be written into the 32 (28) bytes
beginning at RESBLOCK. */
extern int sha256_stream (FILE *stream, void *resblock);
extern int sha224_stream (FILE *stream, void *resblock);