From 67e1017da0e5c71367336ccb77c4cb6f1fbc0e88 Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Thu, 9 Dec 2021 00:13:23 -0800 Subject: [PATCH] LU-14651 libcfs: use namespace CRYPTO_INTERNAL In kernel 5.12 commit 0eb76ba29d16df2951d37c54ca279c4e5630b071, cipher routines are moved into include/crypto/internal/cipher.h, and the symbol exports are moved into namespace CRYPTO_INTERNAL. This patch accommodates the above changes and fixes the following build errors: ERROR: modpost: module libcfs uses symbol crypto_cipher_encrypt_one from namespace CRYPTO_INTERNAL, but does not import it. ERROR: modpost: module libcfs uses symbol crypto_cipher_setkey from namespace CRYPTO_INTERNAL, but does not import it. Test-Parameters: trivial Change-Id: I908006f81ee632c2d02fe3dd6ac41fdd6296a4b0 Signed-off-by: Jian Yu Reviewed-on: https://review.whamcloud.com/45805 Tested-by: jenkins Reviewed-by: James Simmons Reviewed-by: Neil Brown Tested-by: Maloo Reviewed-by: Oleg Drokin --- libcfs/autoconf/lustre-libcfs.m4 | 18 ++++++++++++++++++ libcfs/libcfs/crypto/crypto.c | 6 ++++++ libcfs/libcfs/crypto/keysetup.c | 6 ++++++ 3 files changed, 30 insertions(+) diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4 index 4d720834..08dcb53 100644 --- a/libcfs/autoconf/lustre-libcfs.m4 +++ b/libcfs/autoconf/lustre-libcfs.m4 @@ -1803,6 +1803,22 @@ param_set_uint_minmax, [ ]) # LIBCFS_PARAM_SET_UINT_MINMAX # +# LIBCFS_HAVE_CIPHER_HEADER +# +# Kernel 5.12 commit 0eb76ba29d16df2951d37c54ca279c4e5630b071 +# crypto: remove cipher routines from public crypto API +# +AC_DEFUN([LIBCFS_HAVE_CIPHER_HEADER], [ +tmp_flags="$EXTRA_KCFLAGS" +EXTRA_KCFLAGS="-Werror" +LB_CHECK_LINUX_HEADER([crypto/internal/cipher.h], [ + AC_DEFINE(HAVE_CIPHER_H, 1, + [crypto/internal/cipher.h is present]) +]) +EXTRA_KCFLAGS="$tmp_flags" +]) # LIBCFS_HAVE_CIPHER_HEADER + +# # LIBCFS_PROG_LINUX # # LibCFS linux kernel checks @@ -1936,6 +1952,8 @@ LIBCFS_SEC_RELEASE_SECCTX LIBCFS_HAVE_KFREE_SENSITIVE LIBCFS_HAVE_CRYPTO_SHA2_HEADER LIBCFS_HAVE_LIST_CMP_FUNC_T +# 5.12 +LIBCFS_HAVE_CIPHER_HEADER # 5.15 LIBCFS_PARAM_SET_UINT_MINMAX ]) # LIBCFS_PROG_LINUX diff --git a/libcfs/libcfs/crypto/crypto.c b/libcfs/libcfs/crypto/crypto.c index bc888cc..d079b81 100644 --- a/libcfs/libcfs/crypto/crypto.c +++ b/libcfs/libcfs/crypto/crypto.c @@ -35,6 +35,12 @@ #include #include "llcrypt_private.h" +#ifdef HAVE_CIPHER_H +#include + +MODULE_IMPORT_NS(CRYPTO_INTERNAL); +#endif + static unsigned int num_prealloc_crypto_pages = 32; static unsigned int num_prealloc_crypto_ctxs = 128; diff --git a/libcfs/libcfs/crypto/keysetup.c b/libcfs/libcfs/crypto/keysetup.c index 784eacc..bceb642 100644 --- a/libcfs/libcfs/crypto/keysetup.c +++ b/libcfs/libcfs/crypto/keysetup.c @@ -23,6 +23,12 @@ #include "llcrypt_private.h" +#ifdef HAVE_CIPHER_H +#include + +MODULE_IMPORT_NS(CRYPTO_INTERNAL); +#endif + static struct crypto_shash *essiv_hash_tfm; static struct llcrypt_mode available_modes[] = { -- 1.8.3.1