Use AF_ALG for md5 too Signed-off-by: Matteo Croce <mcr...@redhat.com> --- lib/md5.c | 18 +++++++++++++++++- modules/crypto/md5 | 6 +++++- 2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/lib/md5.c b/lib/md5.c index 68d00a6c7..307abbbe7 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -32,6 +32,10 @@ #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 @@ -142,8 +146,20 @@ md5_stream (FILE *stream, void *resblock) { 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; diff --git a/modules/crypto/md5 b/modules/crypto/md5 index e5fb39ced..415cf0523 100644 --- a/modules/crypto/md5 +++ b/modules/crypto/md5 @@ -5,8 +5,11 @@ Files: 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 @@ -15,9 +18,10 @@ stdint 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" -- 2.14.3