cryptodev-linux: Fix error when compiling with 5.4 kernel
authorJeffery To <jeffery.to@gmail.com>
Tue, 17 Mar 2020 14:27:13 +0000 (22:27 +0800)
committerDaniel Golle <daniel@makrotopia.org>
Wed, 18 Mar 2020 22:12:48 +0000 (23:12 +0100)
Currently, cryptodev-linux fails to compile with a
'"crypto_givcipher_type" undefined' error for targets on the 5.4 kernel,
e.g. armvirt[1].

This backports an upstream patch[2] that fixes this error.

[1]: https://downloads.openwrt.org/snapshots/faillogs/aarch64_generic/base/cryptodev-linux/compile.txt
[2]: https://github.com/cryptodev-linux/cryptodev-linux/commit/f971e0cd4a0ebe59fb2e8e17240399bf6901b09b

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
package/kernel/cryptodev-linux/Makefile
package/kernel/cryptodev-linux/patches/010-Fix-module-loading-with-Linux-v5.0-rc5.patch [new file with mode: 0644]

index da18c714b0a7fa43ad202979e279bad5ba1a11e6..9bea63ebd12c2bfff43acc6a03819b566575723b 100644 (file)
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=cryptodev-linux
 PKG_VERSION:=1.10
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_URL:=https://codeload.github.com/$(PKG_NAME)/$(PKG_NAME)/tar.gz/$(PKG_NAME)-$(PKG_VERSION)?
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
diff --git a/package/kernel/cryptodev-linux/patches/010-Fix-module-loading-with-Linux-v5.0-rc5.patch b/package/kernel/cryptodev-linux/patches/010-Fix-module-loading-with-Linux-v5.0-rc5.patch
new file mode 100644 (file)
index 0000000..5909f6d
--- /dev/null
@@ -0,0 +1,50 @@
+From f971e0cd4a0ebe59fb2e8e17240399bf6901b09b Mon Sep 17 00:00:00 2001
+From: "Derald D. Woods" <woods.technical@gmail.com>
+Date: Sun, 10 Feb 2019 13:22:19 -0600
+Subject: [PATCH] Fix module loading with Linux v5.0-rc5
+
+This commit fixes this module load error:
+[...]
+[   29.112091] cryptodev: loading out-of-tree module taints kernel.
+[   29.128906] cryptodev: Unknown symbol crypto_givcipher_type (err -2)
+[   29.188842] cryptodev: Unknown symbol crypto_givcipher_type (err -2)
+modprobe: can't load module cryptodev (extra/cryptodev.ko): unknown symbol in module, or unknown parameter
+[...]
+
+Upstream Linux support for unused GIVCIPHER, and others, was dropped here:
+
+c79b411eaa72 (crypto: skcipher - remove remnants of internal IV generators)
+
+Signed-off-by: Derald D. Woods <woods.technical@gmail.com>
+---
+ cryptlib.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/cryptlib.c b/cryptlib.c
+index 6e66698..4a87037 100644
+--- a/cryptlib.c
++++ b/cryptlib.c
+@@ -38,7 +38,9 @@
+ #include "cryptodev_int.h"
+ #include "cipherapi.h"
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0))
+ extern const struct crypto_type crypto_givcipher_type;
++#endif
+ static void cryptodev_complete(struct crypto_async_request *req, int err)
+ {
+@@ -157,8 +159,11 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0))
+               tfm = crypto_skcipher_tfm(out->async.s);
+-              if ((tfm->__crt_alg->cra_type == &crypto_ablkcipher_type) ||
+-                  (tfm->__crt_alg->cra_type == &crypto_givcipher_type)) {
++              if ((tfm->__crt_alg->cra_type == &crypto_ablkcipher_type)
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0))
++                  || (tfm->__crt_alg->cra_type == &crypto_givcipher_type)
++#endif
++                                                      ) {
+                       struct ablkcipher_alg *alg;
+                       alg = &tfm->__crt_alg->cra_ablkcipher;