From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1hxRJF-0007gN-NA for ptxdist@pengutronix.de; Tue, 13 Aug 2019 09:33:33 +0200 Received: from mol by ptx.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1hxRJF-0006Ab-Ep for ptxdist@pengutronix.de; Tue, 13 Aug 2019 09:33:33 +0200 Date: Tue, 13 Aug 2019 09:33:33 +0200 From: Michael Olbrich Message-ID: <20190813073333.5lkngse42acqajto@pengutronix.de> References: <20190812131914.GA23382@lenoch> <20190812131952.GB23382@lenoch> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190812131952.GB23382@lenoch> Subject: Re: [ptxdist] [PATCH v2 1/3] cryptodev: new package List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ptxdist-bounces@pengutronix.de Sender: "ptxdist" To: ptxdist@pengutronix.de On Mon, Aug 12, 2019 at 03:19:52PM +0200, Ladislav Michl wrote: > Cryptodev-linux is a device that allows access to Linux kernel > cryptographic drivers; thus allowing of userspace applications > to take advantage of hardware accelerators. Cryptodev-linux is > implemented as a standalone module that requires no dependencies > other than a stock linux kernel. Its API is compatible with > OpenBSD's cryptodev userspace API (/dev/crypto). > > Signed-off-by: Ladislav Michl Please update to the latest kernel module template. Michael > --- > Changes: > - v2: update to 1.10, add upstream git patch. > > ...x-module-loading-with-Linux-v5.0-rc5.patch | 58 +++++++++++++++ > patches/cryptodev-linux-1.10/series | 1 + > rules/cryptodev.in | 11 +++ > rules/cryptodev.make | 74 +++++++++++++++++++ > 4 files changed, 144 insertions(+) > create mode 100644 patches/cryptodev-linux-1.10/0001-Fix-module-loading-with-Linux-v5.0-rc5.patch > create mode 100644 patches/cryptodev-linux-1.10/series > create mode 100644 rules/cryptodev.in > create mode 100644 rules/cryptodev.make > > diff --git a/patches/cryptodev-linux-1.10/0001-Fix-module-loading-with-Linux-v5.0-rc5.patch b/patches/cryptodev-linux-1.10/0001-Fix-module-loading-with-Linux-v5.0-rc5.patch > new file mode 100644 > index 000000000..a201d0290 > --- /dev/null > +++ b/patches/cryptodev-linux-1.10/0001-Fix-module-loading-with-Linux-v5.0-rc5.patch > @@ -0,0 +1,58 @@ > +Upstream-Status: Backport [https://github.com/cryptodev-linux/cryptodev-linux/commit/f971e0c] > + > +Backport patch from upstream to fix module cryptodev loading error. > + > +Signed-off-by: Kai Kang > + > +From f971e0cd4a0ebe59fb2e8e17240399bf6901b09b Mon Sep 17 00:00:00 2001 > +From: "Derald D. Woods" > +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 > +--- > + 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; > +-- > +2.20.0 > diff --git a/patches/cryptodev-linux-1.10/series b/patches/cryptodev-linux-1.10/series > new file mode 100644 > index 000000000..fa320b645 > --- /dev/null > +++ b/patches/cryptodev-linux-1.10/series > @@ -0,0 +1 @@ > +0001-Fix-module-loading-with-Linux-v5.0-rc5.patch > diff --git a/rules/cryptodev.in b/rules/cryptodev.in > new file mode 100644 > index 000000000..7a231340e > --- /dev/null > +++ b/rules/cryptodev.in > @@ -0,0 +1,11 @@ > +## SECTION=core > + > +config CRYPTODEV > + tristate > + select KERNEL > + prompt "cryptodev" > + help > + Cryptodev-linux is a device that allows access to Linux kernel > + cryptographic drivers; thus allowing of userspace applications > + to take advantage of hardware accelerators. Its API is > + compatible with OpenBSD's cryptodev userspace API (/dev/crypto). > diff --git a/rules/cryptodev.make b/rules/cryptodev.make > new file mode 100644 > index 000000000..132f924e2 > --- /dev/null > +++ b/rules/cryptodev.make > @@ -0,0 +1,74 @@ > +# -*-makefile-*- > +# > +# Copyright (C) 2017, 2019 by Ladislav Michl > +# > +# See CREDITS for details about who has contributed to this project. > +# > +# For further information about the PTXdist project and license conditions > +# see the README file. > +# > + > +# > +# We provide this package > +# > +PACKAGES-$(PTXCONF_CRYPTODEV) += cryptodev > + > +# > +# Paths and names and versions > +# > +CRYPTODEV_VERSION := 1.10 > +CRYPTODEV_MD5 := 53403fbb99cd88a48bc899dbe9158e1c > +CRYPTODEV := cryptodev-linux-$(CRYPTODEV_VERSION) > +CRYPTODEV_SUFFIX := tar.gz > +CRYPTODEV_URL := \ > + https://github.com/cryptodev-linux/cryptodev-linux/archive/$(CRYPTODEV).$(CRYPTODEV_SUFFIX) > +CRYPTODEV_SOURCE := $(SRCDIR)/$(CRYPTODEV).$(CRYPTODEV_SUFFIX) > +CRYPTODEV_DIR := $(BUILDDIR)/$(CRYPTODEV) > +CRYPTODEV_LICENSE := GPL-2.0 > + > +ifdef PTXCONF_CRYPTODEV > +$(STATEDIR)/kernel.targetinstall.post: $(STATEDIR)/cryptodev.targetinstall > +endif > + > +# ---------------------------------------------------------------------------- > +# Prepare > +# ---------------------------------------------------------------------------- > + > +CRYPTODEV_WRAPPER_BLACKLIST = $(KERNEL_WRAPPER_BLACKLIST) > + > +CRYPTODEV_CONF_TOOL := NO > + > +# ---------------------------------------------------------------------------- > +# Compile > +# ---------------------------------------------------------------------------- > + > +$(STATEDIR)/cryptodev.compile: > + @$(call targetinfo) > + $(KERNEL_PATH) $(KERNEL_ENV) $(MAKE) $(KERNEL_MAKE_OPT) \ > + KERNEL_DIR=$(KERNEL_DIR) \ > + -C $(CRYPTODEV_DIR) > + @$(call touch) > + > +# ---------------------------------------------------------------------------- > +# Install > +# ---------------------------------------------------------------------------- > + > +$(STATEDIR)/cryptodev.install: > + @$(call targetinfo) > + @$(call touch) > + > +# ---------------------------------------------------------------------------- > +# Target-Install > +# ---------------------------------------------------------------------------- > + > +$(STATEDIR)/cryptodev.targetinstall: > + @$(call targetinfo) > + $(KERNEL_PATH) $(KERNEL_ENV) $(MAKE) $(KERNEL_MAKE_OPT) \ > + KERNEL_DIR=$(KERNEL_DIR) \ > + DESTDIR=$(SYSROOT) \ > + prefix=/usr \ > + -C $(CRYPTODEV_DIR) \ > + install > + @$(call touch) > + > +# vim: syntax=make > -- > 2.22.0 > > > _______________________________________________ > ptxdist mailing list > ptxdist@pengutronix.de > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de