diff options
Diffstat (limited to 'gl/sha256-stream.c')
| -rw-r--r-- | gl/sha256-stream.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/gl/sha256-stream.c b/gl/sha256-stream.c index e2668078..011b36e2 100644 --- a/gl/sha256-stream.c +++ b/gl/sha256-stream.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or | 1 | /* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or |
| 2 | memory blocks according to the NIST specification FIPS-180-2. | 2 | memory blocks according to the NIST specification FIPS-180-2. |
| 3 | 3 | ||
| 4 | Copyright (C) 2005-2006, 2008-2025 Free Software Foundation, Inc. | 4 | Copyright (C) 2005-2006, 2008-2026 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | This file is free software: you can redistribute it and/or modify | 6 | This file is free software: you can redistribute it and/or modify |
| 7 | it under the terms of the GNU Lesser General Public License as | 7 | it under the terms of the GNU Lesser General Public License as |
| @@ -67,7 +67,6 @@ shaxxx_stream (FILE *stream, char const *alg, void *resblock, | |||
| 67 | /* We read the file in blocks of BLOCKSIZE bytes. One call of the | 67 | /* We read the file in blocks of BLOCKSIZE bytes. One call of the |
| 68 | computation function processes the whole buffer so that with the | 68 | computation function processes the whole buffer so that with the |
| 69 | next round of the loop another block can be read. */ | 69 | next round of the loop another block can be read. */ |
| 70 | size_t n; | ||
| 71 | sum = 0; | 70 | sum = 0; |
| 72 | 71 | ||
| 73 | /* Read block. Take care for partial reads. */ | 72 | /* Read block. Take care for partial reads. */ |
| @@ -77,11 +76,11 @@ shaxxx_stream (FILE *stream, char const *alg, void *resblock, | |||
| 77 | or the fread() in afalg_stream may have gotten EOF. | 76 | or the fread() in afalg_stream may have gotten EOF. |
| 78 | We need to avoid a subsequent fread() as EOF may | 77 | We need to avoid a subsequent fread() as EOF may |
| 79 | not be sticky. For details of such systems, see: | 78 | not be sticky. For details of such systems, see: |
| 80 | https://sourceware.org/bugzilla/show_bug.cgi?id=1190 */ | 79 | https://sourceware.org/PR1190 */ |
| 81 | if (feof (stream)) | 80 | if (feof (stream)) |
| 82 | goto process_partial_block; | 81 | goto process_partial_block; |
| 83 | 82 | ||
| 84 | n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); | 83 | size_t n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); |
| 85 | 84 | ||
| 86 | sum += n; | 85 | sum += n; |
| 87 | 86 | ||
