blob: 34ec87272f102fbf736396b2925ce90e47987aed [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001Upstream-Status: Backport [https://github.com/cryptodev-linux/cryptodev-linux/commit/f971e0c]
2
3Backport patch from upstream to fix module cryptodev loading error.
4
5Signed-off-by: Kai Kang <kai.kang@windriver.com>
6
7From f971e0cd4a0ebe59fb2e8e17240399bf6901b09b Mon Sep 17 00:00:00 2001
8From: "Derald D. Woods" <woods.technical@gmail.com>
9Date: Sun, 10 Feb 2019 13:22:19 -0600
10Subject: [PATCH] Fix module loading with Linux v5.0-rc5
11
12This commit fixes this module load error:
13[...]
14[ 29.112091] cryptodev: loading out-of-tree module taints kernel.
15[ 29.128906] cryptodev: Unknown symbol crypto_givcipher_type (err -2)
16[ 29.188842] cryptodev: Unknown symbol crypto_givcipher_type (err -2)
17modprobe: can't load module cryptodev (extra/cryptodev.ko): unknown symbol in module, or unknown parameter
18[...]
19
20Upstream Linux support for unused GIVCIPHER, and others, was dropped here:
21
22c79b411eaa72 (crypto: skcipher - remove remnants of internal IV generators)
23
24Signed-off-by: Derald D. Woods <woods.technical@gmail.com>
25---
26 cryptlib.c | 9 +++++++--
27 1 file changed, 7 insertions(+), 2 deletions(-)
28
29diff --git a/cryptlib.c b/cryptlib.c
30index 6e66698..4a87037 100644
31--- a/cryptlib.c
32+++ b/cryptlib.c
33@@ -38,7 +38,9 @@
34 #include "cryptodev_int.h"
35 #include "cipherapi.h"
36
37+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0))
38 extern const struct crypto_type crypto_givcipher_type;
39+#endif
40
41 static void cryptodev_complete(struct crypto_async_request *req, int err)
42 {
43@@ -157,8 +159,11 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
44
45 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0))
46 tfm = crypto_skcipher_tfm(out->async.s);
47- if ((tfm->__crt_alg->cra_type == &crypto_ablkcipher_type) ||
48- (tfm->__crt_alg->cra_type == &crypto_givcipher_type)) {
49+ if ((tfm->__crt_alg->cra_type == &crypto_ablkcipher_type)
50+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0))
51+ || (tfm->__crt_alg->cra_type == &crypto_givcipher_type)
52+#endif
53+ ) {
54 struct ablkcipher_alg *alg;
55
56 alg = &tfm->__crt_alg->cra_ablkcipher;
57--
582.20.0
59