mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH v2 0/3] cryptodev
@ 2019-08-12 13:19 Ladislav Michl
  2019-08-12 13:19 ` [ptxdist] [PATCH v2 1/3] cryptodev: new package Ladislav Michl
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ladislav Michl @ 2019-08-12 13:19 UTC (permalink / raw)
  To: ptxdist

Hi there!

This serie adds support for cryptodev hardware acceleration.
However, there's one issue unresolved: cryptodev module
loading.
As we have three different modutils implementations available
and also supporting systemd and sysv init it is a bit messy
to generate proper config to load cryptodev at boot time.
So we could either leave module loading to BSP or do something
on ptxdist level. Thoughts?

Thank you,
        ladis

Changes:
- v2: Update cryptodev module to 1.10
      As openssl was updated to 1.1, cryptodev support works
      out of the box now.

This serie was first sent two years ago. Those two years showed
nothing dramatic happened and code still works and compiles.

Btw, I found patch first adding cryptodev in 2010, so perhaps we
want to wait for 10th anniversary? ;-)

Ladislav Michl (3):
  cryptodev: new package
  gnutls: add cryptodev support
  openssl: add cryptodev support

 ...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 +++++++++++++++++++
 rules/gnutls.in                               |  7 ++
 rules/gnutls.make                             |  2 +-
 rules/openssl.in                              |  7 ++
 rules/openssl.make                            |  1 +
 8 files changed, 160 insertions(+), 1 deletion(-)
 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

-- 
2.22.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ptxdist] [PATCH v2 1/3] cryptodev: new package
  2019-08-12 13:19 [ptxdist] [PATCH v2 0/3] cryptodev Ladislav Michl
@ 2019-08-12 13:19 ` Ladislav Michl
  2019-08-13  7:33   ` Michael Olbrich
  2019-08-12 13:20 ` [ptxdist] [PATCH v2 2/3] gnutls: add cryptodev support Ladislav Michl
  2019-08-12 13:21 ` [ptxdist] [PATCH v2 3/3] openssl: " Ladislav Michl
  2 siblings, 1 reply; 8+ messages in thread
From: Ladislav Michl @ 2019-08-12 13:19 UTC (permalink / raw)
  To: ptxdist

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 <ladis@linux-mips.org>
---
 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 <kai.kang@windriver.com>
+
+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;
+-- 
+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 <ladis@linux-mips.org>
+#
+# 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ptxdist] [PATCH v2 2/3] gnutls: add cryptodev support
  2019-08-12 13:19 [ptxdist] [PATCH v2 0/3] cryptodev Ladislav Michl
  2019-08-12 13:19 ` [ptxdist] [PATCH v2 1/3] cryptodev: new package Ladislav Michl
@ 2019-08-12 13:20 ` Ladislav Michl
  2019-08-12 13:21 ` [ptxdist] [PATCH v2 3/3] openssl: " Ladislav Michl
  2 siblings, 0 replies; 8+ messages in thread
From: Ladislav Michl @ 2019-08-12 13:20 UTC (permalink / raw)
  To: ptxdist

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 Changes:
 -v2: None

 rules/gnutls.in   | 7 +++++++
 rules/gnutls.make | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/rules/gnutls.in b/rules/gnutls.in
index e3427d6eb..c0f47b5cf 100644
--- a/rules/gnutls.in
+++ b/rules/gnutls.in
@@ -5,6 +5,7 @@ menuconfig GNUTLS
 	select LIBTASN1
 	select NETTLE
 	select GCCLIBS_CXX	if GNUTLS_CXX
+	select CRYPTODEV	if GNUTLS_CRYPTODEV
 	prompt "gnutls                        "
 	help
 	  GnuTLS is a secure communications library implementing the SSL,
@@ -21,6 +22,12 @@ config GNUTLS_CXX
 	bool
 	prompt "install C++ runtime library"
 
+config GNUTLS_CRYPTODEV
+	bool
+	prompt "enable cryptodev support"
+	help
+	  Enable the BSD cryptodev engine even if we are not using BSD.
+
 config GNUTLS_OPENSSL
 	bool
 	prompt "openssl compatibility"
diff --git a/rules/gnutls.make b/rules/gnutls.make
index caa5d8426..955d1f5b4 100644
--- a/rules/gnutls.make
+++ b/rules/gnutls.make
@@ -56,7 +56,7 @@ GNUTLS_CONF_OPT		:= \
 	--enable-dhe \
 	--enable-ecdhe \
 	--enable-gost \
-	--disable-cryptodev \
+	--$(call ptx/endis, PTXCONF_GNUTLS_CRYPTODEV)-cryptodev \
 	--enable-ocsp \
 	--$(call ptx/endis, PTXCONF_GNUTLS_OPENSSL)-openssl-compatibility \
 	--disable-tests \
-- 
2.22.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ptxdist] [PATCH v2 3/3] openssl: add cryptodev support
  2019-08-12 13:19 [ptxdist] [PATCH v2 0/3] cryptodev Ladislav Michl
  2019-08-12 13:19 ` [ptxdist] [PATCH v2 1/3] cryptodev: new package Ladislav Michl
  2019-08-12 13:20 ` [ptxdist] [PATCH v2 2/3] gnutls: add cryptodev support Ladislav Michl
@ 2019-08-12 13:21 ` Ladislav Michl
  2 siblings, 0 replies; 8+ messages in thread
From: Ladislav Michl @ 2019-08-12 13:21 UTC (permalink / raw)
  To: ptxdist

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 Changes:
 -v2: Drop patches as v1.1 reimplemented cryptodev support

 rules/openssl.in   | 7 +++++++
 rules/openssl.make | 1 +
 2 files changed, 8 insertions(+)

diff --git a/rules/openssl.in b/rules/openssl.in
index 096b398d3..2471376be 100644
--- a/rules/openssl.in
+++ b/rules/openssl.in
@@ -4,6 +4,7 @@ menuconfig OPENSSL
 	tristate
 	select LIBC_DL
 	select GCCLIBS_GCC_S
+	select CRYPTODEV		if OPENSSL_CRYPTODEV
 	prompt "openssl                       "
 	help
 	  Secure Socket Layer (SSL) binary and related cryptographic tools
@@ -28,4 +29,10 @@ config OPENSSL_BIN
 	help
 	  Whether to build and install OpenSSL binary.
 
+config OPENSSL_CRYPTODEV
+	bool
+	prompt "use cryptodev hw acceleration"
+	help
+	  Enable the BSD cryptodev engine even if we are not using BSD.
+
 endif
diff --git a/rules/openssl.make b/rules/openssl.make
index 9d921d0fa..c0fd0e69b 100644
--- a/rules/openssl.make
+++ b/rules/openssl.make
@@ -68,6 +68,7 @@ OPENSSL_CONF_OPT := \
 	--libdir=/usr/lib \
 	--openssldir=/usr/lib/ssl \
 	shared \
+	$(call ptx/ifdef, PTXCONF_OPENSSL_CRYPTODEV, enable-devcryptoeng, no-devcryptoeng) \
 	no-idea \
 	no-mdc2 \
 	no-rc5 \
-- 
2.22.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ptxdist] [PATCH v2 1/3] cryptodev: new package
  2019-08-12 13:19 ` [ptxdist] [PATCH v2 1/3] cryptodev: new package Ladislav Michl
@ 2019-08-13  7:33   ` Michael Olbrich
  2019-08-13  8:00     ` Ladislav Michl
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Olbrich @ 2019-08-13  7:33 UTC (permalink / raw)
  To: ptxdist

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 <ladis@linux-mips.org>

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 <kai.kang@windriver.com>
> +
> +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;
> +-- 
> +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 <ladis@linux-mips.org>
> +#
> +# 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ptxdist] [PATCH v2 1/3] cryptodev: new package
  2019-08-13  7:33   ` Michael Olbrich
@ 2019-08-13  8:00     ` Ladislav Michl
  2019-08-13  8:10       ` Ladislav Michl
  2019-08-13 10:31       ` Michael Olbrich
  0 siblings, 2 replies; 8+ messages in thread
From: Ladislav Michl @ 2019-08-13  8:00 UTC (permalink / raw)
  To: ptxdist

On Tue, Aug 13, 2019 at 09:33:33AM +0200, Michael Olbrich wrote:
> 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 <ladis@linux-mips.org>
> 
> Please update to the latest kernel module template.

One more question. Header required by openssl and gnutls is copied
during targetinstall stage. Shall we do it manually inside install stage
to satisfy dependencies?

From: Ladislav Michl <ladis@linux-mips.org>
Date: Thu, 22 Jun 2017 23:01:10 +0200
Subject: [PATCH v3 1/3] cryptodev: new package

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 <ladis@linux-mips.org>
---
 Changes:
 - v2: update to 1.10, add upstream git patch.
 - v3: updated to the latest module template

 ...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 <kai.kang@windriver.com>
+
+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;
+-- 
+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 <ladis@linux-mips.org>
+#
+# 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ptxdist] [PATCH v2 1/3] cryptodev: new package
  2019-08-13  8:00     ` Ladislav Michl
@ 2019-08-13  8:10       ` Ladislav Michl
  2019-08-13 10:31       ` Michael Olbrich
  1 sibling, 0 replies; 8+ messages in thread
From: Ladislav Michl @ 2019-08-13  8:10 UTC (permalink / raw)
  To: ptxdist

On Tue, Aug 13, 2019 at 10:00:49AM +0200, Ladislav Michl wrote:
> On Tue, Aug 13, 2019 at 09:33:33AM +0200, Michael Olbrich wrote:
> > 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 <ladis@linux-mips.org>
> > 
> > Please update to the latest kernel module template.
> 
> One more question. Header required by openssl and gnutls is copied
> during targetinstall stage. Shall we do it manually inside install stage
> to satisfy dependencies?
> 
> From: Ladislav Michl <ladis@linux-mips.org>
> Date: Thu, 22 Jun 2017 23:01:10 +0200
> Subject: [PATCH v3 1/3] cryptodev: new package

Argh! Actually append the right patch:

From: Ladislav Michl <ladis@linux-mips.org>
Date: Thu, 22 Jun 2017 23:01:10 +0200
Subject: [PATCH v3 1/3] cryptodev: new package

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 <ladis@linux-mips.org>
---
 Changes:
 - v2: update to 1.10, add upstream git patch.
 - v3: updated to the latest module template

 ...x-module-loading-with-Linux-v5.0-rc5.patch | 58 ++++++++++++++++
 patches/cryptodev-linux-1.10/series           |  1 +
 rules/cryptodev.in                            | 11 +++
 rules/cryptodev.make                          | 69 +++++++++++++++++++
 4 files changed, 139 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 <kai.kang@windriver.com>
+
+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;
+-- 
+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..5b2b78d00
--- /dev/null
+++ b/rules/cryptodev.make
@@ -0,0 +1,69 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2017, 2019 by Ladislav Michl <ladis@linux-mips.org>
+#
+# 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
+# ----------------------------------------------------------------------------
+
+CRYPTODEV_MAKE_OPT = \
+	$(KERNEL_MAKE_OPT) \
+	KERNEL_DIR=$(KERNEL_DIR) \
+	DESTDIR=$(SYSROOT) \
+	prefix=/usr \
+	-C $(CRYPTODEV_DIR)
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/cryptodev.install:
+	@$(call targetinfo)
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/cryptodev.targetinstall:
+	@$(call targetinfo)
+	@$(call compile, CRYPTODEV, $(CRYPTODEV_MAKE_OPT) install)
+	@$(call touch)
+
+# vim: syntax=make
-- 
2.22.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [ptxdist] [PATCH v2 1/3] cryptodev: new package
  2019-08-13  8:00     ` Ladislav Michl
  2019-08-13  8:10       ` Ladislav Michl
@ 2019-08-13 10:31       ` Michael Olbrich
  1 sibling, 0 replies; 8+ messages in thread
From: Michael Olbrich @ 2019-08-13 10:31 UTC (permalink / raw)
  To: ptxdist

On Tue, Aug 13, 2019 at 10:00:49AM +0200, Ladislav Michl wrote:
> On Tue, Aug 13, 2019 at 09:33:33AM +0200, Michael Olbrich wrote:
> > 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 <ladis@linux-mips.org>
> > 
> > Please update to the latest kernel module template.
> 
> One more question. Header required by openssl and gnutls is copied
> during targetinstall stage. Shall we do it manually inside install stage
> to satisfy dependencies?

This should happen during install.

Michael

> From: Ladislav Michl <ladis@linux-mips.org>
> Date: Thu, 22 Jun 2017 23:01:10 +0200
> Subject: [PATCH v3 1/3] cryptodev: new package
> 
> 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 <ladis@linux-mips.org>
> ---
>  Changes:
>  - v2: update to 1.10, add upstream git patch.
>  - v3: updated to the latest module template
> 
>  ...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 <kai.kang@windriver.com>
> +
> +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;
> +-- 
> +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 <ladis@linux-mips.org>
> +#
> +# 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-08-13 10:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-12 13:19 [ptxdist] [PATCH v2 0/3] cryptodev Ladislav Michl
2019-08-12 13:19 ` [ptxdist] [PATCH v2 1/3] cryptodev: new package Ladislav Michl
2019-08-13  7:33   ` Michael Olbrich
2019-08-13  8:00     ` Ladislav Michl
2019-08-13  8:10       ` Ladislav Michl
2019-08-13 10:31       ` Michael Olbrich
2019-08-12 13:20 ` [ptxdist] [PATCH v2 2/3] gnutls: add cryptodev support Ladislav Michl
2019-08-12 13:21 ` [ptxdist] [PATCH v2 3/3] openssl: " Ladislav Michl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox