1 /* af_alg.h - Compute message digests from file streams.
2 Copyright (C) 2018 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 2, or (at your option) any
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, see <https://www.gnu.org/licenses/>. */
17 /* Written by Matteo Croce <mcroce@redhat.com>, 2018.
18 Documentation by Bruno Haible <bruno@clisp.org>, 2018. */
20 /* Declare specific functions for computing message digests
21 using the Linux kernel crypto API, if available. This kernel API gives
22 access to specialized crypto instructions (that would also be available
23 in user space) or to crypto devices (not directly available in user space).
25 For a more complete set of facilities that use the Linux kernel crypto API,
38 # if HAVE_LINUX_IF_ALG_H
40 /* Compute a message digest of the contents of a file.
41 STREAM is an open file stream. Regular files are handled more efficiently.
42 ALG is the message digest algorithm; see the file /proc/crypto.
43 RESBLOCK points to a block of HASHLEN bytes, for the result.
44 HASHLEN must be the length of the message digest, in bytes, in particular:
55 If successful, fill RESBLOCK and return 0.
56 Upon failure, return a negated error number. */
58 afalg_stream (FILE *stream
, const char *alg
, void *resblock
, ssize_t hashlen
);
63 afalg_stream (FILE *stream
, const char *alg
, void *resblock
, ssize_t hashlen
)