From: Shaun Tancheff Date: Thu, 22 Jul 2021 07:45:37 +0000 (-0500) Subject: LU-14880 libcfs: Use crypto/sha2.h if available X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=ce3b689d347dd23a9817d1ea6511e547afea570b;p=fs%2Flustre-release.git LU-14880 libcfs: Use crypto/sha2.h if available As of Linux commit a24d22b225ce158651378869a6b88105c4bdb887 crypto: sha - split sha.h into sha1.h and sha2.h sha.h is removed and sha2.h or sha3.h is preferred. Lustre-change: https://review.whamcloud.com/44373 Lustre-commit: e9cffb256d10a3bb28c957f0bf06c61793a9610b Test-Parameters: trivial Fixes: a813e81870 ("LU-12275 sec: add llcrypt as file encryption library") Signed-off-by: Shaun Tancheff Change-Id: Iead5e1cb23e79a400da3cbfeb4c35c834e821d62 Reviewed-by: James Simmons Reviewed-by: Sebastien Buisson Reviewed-on: https://review.whamcloud.com/44996 Reviewed-by: Andreas Dilger Tested-by: Andreas Dilger --- diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4 index ce1d2f5..481fb8e 100644 --- a/libcfs/autoconf/lustre-libcfs.m4 +++ b/libcfs/autoconf/lustre-libcfs.m4 @@ -1541,6 +1541,18 @@ kfree_sensitive_exists, [ EXTRA_KCFLAGS="$tmp_flags" ]) # LIBCFS_HAVE_NR_UNSTABLE_NFS +# +# LIBCFS_HAVE_CRYPTO_SHA2_HEADER +# +# Kernel v5.10-rc1-114-ga24d22b225ce +# crypto: sha - split sha.h into sha1.h and sha2.h +# +AC_DEFUN([LIBCFS_HAVE_CRYPTO_SHA2_HEADER], [ +LB_CHECK_LINUX_HEADER([crypto/sha2.h], [ + AC_DEFINE(HAVE_CRYPTO_SHA2_HEADER, 1, + [crypto/sha2.h is present])]) +]) # LIBCFS_HAVE_CRYPTO_SHA2_HEADER + AC_DEFUN([LIBCFS_PROG_LINUX_SRC], [ LIBCFS_SRC_HAVE_PROC_OPS @@ -1673,6 +1685,7 @@ LIBCFS_VMALLOC_2ARGS LIBCFS_SEC_RELEASE_SECCTX # 5.10 LIBCFS_HAVE_KFREE_SENSITIVE +LIBCFS_HAVE_CRYPTO_SHA2_HEADER ]) # LIBCFS_PROG_LINUX # diff --git a/libcfs/libcfs/crypto/hkdf.c b/libcfs/libcfs/crypto/hkdf.c index 147f14b..8874bcb 100644 --- a/libcfs/libcfs/crypto/hkdf.c +++ b/libcfs/libcfs/crypto/hkdf.c @@ -14,8 +14,11 @@ */ #include +#ifdef HAVE_CRYPTO_SHA2_HEADER +#include +#else #include - +#endif #include "llcrypt_private.h" /* diff --git a/libcfs/libcfs/crypto/keysetup.c b/libcfs/libcfs/crypto/keysetup.c index 2d35266..14f7bd7 100644 --- a/libcfs/libcfs/crypto/keysetup.c +++ b/libcfs/libcfs/crypto/keysetup.c @@ -13,7 +13,11 @@ */ #include +#ifdef HAVE_CRYPTO_SHA2_HEADER +#include +#else #include +#endif #include #include