Whamcloud - gitweb
LU-14651 libcfs: use namespace CRYPTO_INTERNAL 05/45805/3
authorJian Yu <yujian@whamcloud.com>
Thu, 9 Dec 2021 08:13:23 +0000 (00:13 -0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 6 Jan 2022 22:00:33 +0000 (22:00 +0000)
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 <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/45805
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Neil Brown <neilb@suse.de>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/autoconf/lustre-libcfs.m4
libcfs/libcfs/crypto/crypto.c
libcfs/libcfs/crypto/keysetup.c

index 4d72083..08dcb53 100644 (file)
@@ -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
index bc888cc..d079b81 100644 (file)
 #include <crypto/skcipher.h>
 #include "llcrypt_private.h"
 
+#ifdef HAVE_CIPHER_H
+#include <crypto/internal/cipher.h>
+
+MODULE_IMPORT_NS(CRYPTO_INTERNAL);
+#endif
+
 static unsigned int num_prealloc_crypto_pages = 32;
 static unsigned int num_prealloc_crypto_ctxs = 128;
 
index 784eacc..bceb642 100644 (file)
 
 #include "llcrypt_private.h"
 
+#ifdef HAVE_CIPHER_H
+#include <crypto/internal/cipher.h>
+
+MODULE_IMPORT_NS(CRYPTO_INTERNAL);
+#endif
+
 static struct crypto_shash *essiv_hash_tfm;
 
 static struct llcrypt_mode available_modes[] = {