summaryrefslogtreecommitdiffstats
path: root/gl/sha256-stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl/sha256-stream.c')
-rw-r--r--gl/sha256-stream.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/gl/sha256-stream.c b/gl/sha256-stream.c
index 08d24b7b..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-2024 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
@@ -23,9 +23,6 @@
23#include <config.h> 23#include <config.h>
24 24
25/* Specification. */ 25/* Specification. */
26#if HAVE_OPENSSL_SHA256
27# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
28#endif
29#include "sha256.h" 26#include "sha256.h"
30 27
31#include <stdlib.h> 28#include <stdlib.h>
@@ -70,7 +67,6 @@ shaxxx_stream (FILE *stream, char const *alg, void *resblock,
70 /* 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
71 computation function processes the whole buffer so that with the 68 computation function processes the whole buffer so that with the
72 next round of the loop another block can be read. */ 69 next round of the loop another block can be read. */
73 size_t n;
74 sum = 0; 70 sum = 0;
75 71
76 /* Read block. Take care for partial reads. */ 72 /* Read block. Take care for partial reads. */
@@ -80,11 +76,11 @@ shaxxx_stream (FILE *stream, char const *alg, void *resblock,
80 or the fread() in afalg_stream may have gotten EOF. 76 or the fread() in afalg_stream may have gotten EOF.
81 We need to avoid a subsequent fread() as EOF may 77 We need to avoid a subsequent fread() as EOF may
82 not be sticky. For details of such systems, see: 78 not be sticky. For details of such systems, see:
83 https://sourceware.org/bugzilla/show_bug.cgi?id=1190 */ 79 https://sourceware.org/PR1190 */
84 if (feof (stream)) 80 if (feof (stream))
85 goto process_partial_block; 81 goto process_partial_block;
86 82
87 n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); 83 size_t n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
88 84
89 sum += n; 85 sum += n;
90 86
@@ -136,10 +132,3 @@ sha224_stream (FILE *stream, void *resblock)
136 return shaxxx_stream (stream, "sha224", resblock, SHA224_DIGEST_SIZE, 132 return shaxxx_stream (stream, "sha224", resblock, SHA224_DIGEST_SIZE,
137 sha224_init_ctx, sha224_finish_ctx); 133 sha224_init_ctx, sha224_finish_ctx);
138} 134}
139
140/*
141 * Hey Emacs!
142 * Local Variables:
143 * coding: utf-8
144 * End:
145 */