Whamcloud - gitweb
LU-8560 libcfs: add autoconf test for crypto changes 05/22205/3
authorJames Simmons <uja.ornl@yahoo.com>
Sun, 28 Aug 2016 18:59:46 +0000 (14:59 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 8 Sep 2016 02:06:22 +0000 (02:06 +0000)
For linux 4.5 kernels the simple ifdef test in
linux-crypto.c worked but with linux 4.6+ kernels
we need to add a proper crypto api test for the
new inline functions crypto_ahash_alg_name() and
crypto_ahash_driver_name().

Test-Parameters: trivial

Change-Id: Ic18808b622d374cf6dc2417220ed83adc43ea692
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: http://review.whamcloud.com/22205
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
libcfs/autoconf/lustre-libcfs.m4
libcfs/libcfs/linux/linux-crypto.c

index cc0e184..d7e1a45 100644 (file)
@@ -322,6 +322,23 @@ LB_CHECK_LINUX_HEADER([asm/fpu/api.h], [
 ]) # LIBCFS_FPU_API
 
 #
+# Kernel version 4.5-rc1 commit d12481bc58fba89427565f8592e88446ec084a24
+# added crypto hash helpers
+#
+AC_DEFUN([LIBCFS_CRYPTO_HASH_HELPERS], [
+LB_CHECK_COMPILE([does crypto hash helper functions exist],
+crypto_hash_helpers, [
+       #include <crypto/hash.h>
+],[
+       crypto_ahash_alg_name(NULL);
+       crypto_ahash_driver_name(NULL);
+],[
+       AC_DEFINE(HAVE_CRYPTO_HASH_HELPERS, 1,
+               [crypto hash helper functions are available])
+])
+]) # LIBCFS_CRYPTO_HASH_HELPERS
+
+#
 # LIBCFS_PROG_LINUX
 #
 # LibCFS linux kernel checks
@@ -361,6 +378,8 @@ LIBCFS_HLIST_ADD_AFTER
 # 4.2
 LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
 LIBCFS_FPU_API
+# 4.5
+LIBCFS_CRYPTO_HASH_HELPERS
 ]) # LIBCFS_PROG_LINUX
 
 #
index 6d01de3..a8c2ccd 100644 (file)
 #include <libcfs/libcfs_crypto.h>
 #include <libcfs/linux/linux-crypto.h>
 
-#ifndef crypto_ahash_alg_name
+#ifndef HAVE_CRYPTO_HASH_HELPERS
 static inline const char *crypto_ahash_alg_name(struct crypto_ahash *tfm)
 {
        return crypto_tfm_alg_name(crypto_ahash_tfm(tfm));
 }
-#endif
 
-#ifndef crypto_ahash_driver_name
 static inline const char *crypto_ahash_driver_name(struct crypto_ahash *tfm)
 {
        return crypto_tfm_alg_driver_name(crypto_ahash_tfm(tfm));