+2018-05-07 Paul Eggert <eggert@cs.ucla.edu>
+
+ af_alg: Pacify --enable-gcc-warnings
+ Problem reported by Assaf Gordon in:
+ https://lists.gnu.org/r/bug-gnulib/2018-05/msg00041.html
+ * lib/af_alg.c (afalg_buffer): Move local decls to pacify
+ gcc -Wjump-misses-init.
+ * lib/sha512.c (shaxxx_stream): Now static.
+
2018-05-06 Bruno Haible <bruno@clisp.org>
af_alg: Add ability to use Linux kernel crypto API on data in memory.
void *resblock, ssize_t hashlen)
{
/* On Linux < 4.9, the value for an empty stream is wrong (all zeroes).
- See <https://patchwork.kernel.org/patch/9434741/>. */
+ See <https://patchwork.kernel.org/patch/9308641/>. */
if (len == 0)
return -EAFNOSUPPORT;
if (cfd < 0)
return -EAFNOSUPPORT;
+ int fd;
+ struct stat st;
+
int result;
struct sockaddr_alg salg = {
.salg_family = AF_ALG,
}
/* if file is a regular file, attempt sendfile to pipe the data. */
- int fd = fileno (stream);
- struct stat st;
+ fd = fileno (stream);
if (fstat (fd, &st) == 0
&& (S_ISREG (st.st_mode) || S_TYPEISSHM (&st) || S_TYPEISTMO (&st))
&& 0 < st.st_size && st.st_size <= SYS_BUFSIZE_MAX)
off_t nbytes = st.st_size - lseek (fd, 0, SEEK_CUR);
/* On Linux < 4.9, the value for an empty stream is wrong (all zeroes).
- See <https://patchwork.kernel.org/patch/9434741/>. */
+ See <https://patchwork.kernel.org/patch/9308641/>. */
if (nbytes <= 0)
{
result = -EAFNOSUPPORT;
goto out_ofd;
}
/* On Linux < 4.9, the value for an empty stream is wrong (all zeroes).
- See <https://patchwork.kernel.org/patch/9434741/>. */
+ See <https://patchwork.kernel.org/patch/9308641/>. */
if (!non_empty)
{
result = -EAFNOSUPPORT;
Write the message digest into RESBLOCK, which contains HASHLEN bytes.
The initial and finishing operations are INIT_CTX and FINISH_CTX.
Return zero if and only if successful. */
-int
+static int
shaxxx_stream (FILE *stream, char const *alg, void *resblock,
ssize_t hashlen, void (*init_ctx) (struct sha512_ctx *),
void *(*finish_ctx) (struct sha512_ctx *, void *))