Use AF_ALG for md5 too
Signed-off-by: Matteo Croce <mcroce@redhat.com>
+2018-04-28 Matteo Croce <mcroce@redhat.com>
+
+ md5sum: Use AF_ALG when available.
+ * lib/md5.c: Include af_alg.h.
+ (md5_stream): Use afalg_stream when available.
+ * modules/crypto/md5 (Files): Add the af_alg files.
+ (configure.ac): Invoke gl_LINUX_IF_ALG_H.
+ (Makefile.am): Add af_alg.c.
+
2018-04-28 Matteo Croce <mcroce@redhat.com>
sha512sum: Use AF_ALG when available.
#include <string.h>
#include <sys/types.h>
+#ifdef HAVE_LINUX_IF_ALG_H
+# include "af_alg.h"
+#endif
+
#if USE_UNLOCKED_IO
# include "unlocked-io.h"
#endif
{
struct md5_ctx ctx;
size_t sum;
+ char *buffer;
+
+#ifdef HAVE_LINUX_IF_ALG_H
+ int ret;
+
+ ret = afalg_stream(stream, resblock, "md5", MD5_DIGEST_SIZE);
+ if (!ret)
+ return 0;
+
+ if (ret == -EIO)
+ return 1;
+#endif
- char *buffer = malloc (BLOCKSIZE + 72);
+ buffer = malloc (BLOCKSIZE + 72);
if (!buffer)
return 1;
lib/gl_openssl.h
lib/md5.h
lib/md5.c
+lib/af_alg.h
+lib/af_alg.c
m4/gl-openssl.m4
m4/md5.m4
+m4/linux-if-alg.m4
Depends-on:
extern-inline
configure.ac:
gl_MD5
+gl_LINUX_IF_ALG_H
Makefile.am:
-lib_SOURCES += md5.c
+lib_SOURCES += md5.c af_alg.c
Include:
"md5.h"