summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhenhua Luo <zhenhua.luo@freescale.com>2015-04-22 20:13:45 +0800
committerZhenhua Luo <zhenhua.luo@freescale.com>2015-07-22 17:38:00 +0800
commitb2088016a9fbe9add324aa1a7228bc9bfdc5c606 (patch)
treef2959e9dd028ea3b2a68d81b819b7186e4917c44
parentc0590434ae1571602fde9441f447a6fb35967e4c (diff)
downloadmeta-fsl-ppc-b2088016a9fbe9add324aa1a7228bc9bfdc5c606.tar.gz
cryptodev: update to 1.7 plus FSL patches
To avoid build issue when Poky upgrades cryptodev, keep a copy of cryptodev-{linux,modules,tests) recipe in this repository. Based on the upstream, this includes the following FSL patches: 0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch 0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch 0003-PKC-support-added-in-cryptodev-module.patch 0004-Compat-versions-of-PKC-IOCTLs.patch 0005-Asynchronous-interface-changes-in-cryptodev.patch 0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch 0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch 0008-Add-RSA-Key-generation-offloading.patch 0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch 0010-add-support-for-composite-TLS10-SHA1-3DES-algorithm-.patch 0011-add-support-for-TLSv1.1-record-offload.patch 0012-add-support-for-TLSv1.2-record-offload.patch 0013-clean-up-code-layout.patch 0014-remove-redundant-data-copy-for-pkc-operations.patch 0015-fix-pkc-request-deallocation.patch 0016-add-basic-detection-of-asym-features.patch 0017-remove-dead-code.patch 0018-fix-compat-warnings.patch 0019-fix-size_t-print-format.patch 0020-fix-uninitialized-variable-compiler-warning.patch Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com> Signed-off-by: Ting Liu <ting.liu@freescale.com>
-rw-r--r--recipes-kernel/cryptodev/cryptodev-fsl.inc17
-rw-r--r--recipes-kernel/cryptodev/cryptodev-fsl/0001-don-t-advertise-RSA-keygen.patch32
-rw-r--r--recipes-kernel/cryptodev/cryptodev-linux_1.6.bbappend2
-rw-r--r--recipes-kernel/cryptodev/cryptodev-linux_1.7.bb12
-rw-r--r--recipes-kernel/cryptodev/cryptodev-module_1.6.bbappend12
-rw-r--r--recipes-kernel/cryptodev/cryptodev-module_1.7.bb10
-rw-r--r--recipes-kernel/cryptodev/cryptodev-tests_1.7.bb17
-rw-r--r--recipes-kernel/cryptodev/cryptodev_1.7.inc47
-rw-r--r--recipes-kernel/cryptodev/files/0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch (renamed from recipes-kernel/cryptodev/cryptodev-fsl/0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch)8
-rw-r--r--recipes-kernel/cryptodev/files/0001-don-t-advertise-RSA-keygen.patch33
-rw-r--r--recipes-kernel/cryptodev/files/0001-fix-compilation-against-linux-3.19.patch36
-rw-r--r--recipes-kernel/cryptodev/files/0002-Fix-tests-Makefile-usage-of-LDLIBS-vs.-LDFLAGS.patch29
-rw-r--r--recipes-kernel/cryptodev/files/0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch (renamed from recipes-kernel/cryptodev/cryptodev-fsl/0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch)8
-rw-r--r--recipes-kernel/cryptodev/files/0002-tests-Makefile-fix-arg-passing-to-CC-in-implicit-rul.patch28
-rw-r--r--recipes-kernel/cryptodev/files/0003-Disable-installing-header-file-provided-by-another-p.patch29
-rw-r--r--recipes-kernel/cryptodev/files/0003-PKC-support-added-in-cryptodev-module.patch (renamed from recipes-kernel/cryptodev/cryptodev-fsl/0003-PKC-support-added-in-cryptodev-module.patch)8
-rw-r--r--recipes-kernel/cryptodev/files/0004-Add-the-compile-and-install-rules-for-cryptodev-test.patch65
-rw-r--r--recipes-kernel/cryptodev/files/0004-Compat-versions-of-PKC-IOCTLs.patch (renamed from recipes-kernel/cryptodev/cryptodev-fsl/0004-Compat-versions-of-PKC-IOCTLs.patch)8
-rw-r--r--recipes-kernel/cryptodev/files/0005-Asynchronous-interface-changes-in-cryptodev.patch (renamed from recipes-kernel/cryptodev/cryptodev-fsl/0005-Asynchronous-interface-changes-in-cryptodev.patch)8
-rw-r--r--recipes-kernel/cryptodev/files/0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch (renamed from recipes-kernel/cryptodev/cryptodev-fsl/0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch)8
-rw-r--r--recipes-kernel/cryptodev/files/0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch (renamed from recipes-kernel/cryptodev/cryptodev-fsl/0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch)8
-rw-r--r--recipes-kernel/cryptodev/files/0008-Add-RSA-Key-generation-offloading.patch (renamed from recipes-kernel/cryptodev/cryptodev-fsl/0008-Add-RSA-Key-generation-offloading.patch)8
-rw-r--r--recipes-kernel/cryptodev/files/0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch (renamed from recipes-kernel/cryptodev/cryptodev-fsl/0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch)8
-rw-r--r--recipes-kernel/cryptodev/files/0010-add-support-for-composite-TLS10-SHA1-3DES-algorithm-.patch54
-rw-r--r--recipes-kernel/cryptodev/files/0011-add-support-for-TLSv1.1-record-offload.patch76
-rw-r--r--recipes-kernel/cryptodev/files/0012-add-support-for-TLSv1.2-record-offload.patch72
-rw-r--r--recipes-kernel/cryptodev/files/0013-clean-up-code-layout.patch186
-rw-r--r--recipes-kernel/cryptodev/files/0014-remove-redundant-data-copy-for-pkc-operations.patch494
-rw-r--r--recipes-kernel/cryptodev/files/0015-fix-pkc-request-deallocation.patch40
-rw-r--r--recipes-kernel/cryptodev/files/0016-add-basic-detection-of-asym-features.patch37
-rw-r--r--recipes-kernel/cryptodev/files/0017-remove-dead-code.patch67
-rw-r--r--recipes-kernel/cryptodev/files/0018-fix-compat-warnings.patch64
-rw-r--r--recipes-kernel/cryptodev/files/0019-fix-size_t-print-format.patch61
-rw-r--r--recipes-kernel/cryptodev/files/0020-fix-uninitialized-variable-compiler-warning.patch38
34 files changed, 1531 insertions, 99 deletions
diff --git a/recipes-kernel/cryptodev/cryptodev-fsl.inc b/recipes-kernel/cryptodev/cryptodev-fsl.inc
deleted file mode 100644
index e32e350..0000000
--- a/recipes-kernel/cryptodev/cryptodev-fsl.inc
+++ /dev/null
@@ -1,17 +0,0 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/cryptodev-fsl:"
2
3SRC_URI_qoriq-ppc = "git://github.com/cryptodev-linux/cryptodev-linux.git \
4 file://0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch \
5 file://0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch \
6 file://0003-PKC-support-added-in-cryptodev-module.patch \
7 file://0004-Compat-versions-of-PKC-IOCTLs.patch \
8 file://0005-Asynchronous-interface-changes-in-cryptodev.patch \
9 file://0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch \
10 file://0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch \
11 file://0008-Add-RSA-Key-generation-offloading.patch \
12 file://0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch \
13"
14SRCREV_qoriq-ppc = "6aa62a2c320b04f55fdfe0ed015c3d9b48997239"
15
16S_qoriq-ppc = "${WORKDIR}/git"
17
diff --git a/recipes-kernel/cryptodev/cryptodev-fsl/0001-don-t-advertise-RSA-keygen.patch b/recipes-kernel/cryptodev/cryptodev-fsl/0001-don-t-advertise-RSA-keygen.patch
deleted file mode 100644
index 3d7c608..0000000
--- a/recipes-kernel/cryptodev/cryptodev-fsl/0001-don-t-advertise-RSA-keygen.patch
+++ /dev/null
@@ -1,32 +0,0 @@
1From b6e2a3747e3cffdf3cc515b0ce35d6bcdcb051c5 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@freescale.com>
3Date: Tue, 9 Dec 2014 16:41:25 +0200
4Subject: [PATCH] don't advertise RSA keygen
5
6This is supposed to avoid RSA keygen operations when they are not
7available. Since no testing can be done, the patch should be applied
8selectively (for example when offloading through pkc driver on C293)
9
10Change-Id: I60765f46fd7a39053d42e075d2ec71b032b2ed8a
11Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
12---
13 ioctl.c | 3 +--
14 1 file changed, 1 insertion(+), 2 deletions(-)
15
16diff --git a/ioctl.c b/ioctl.c
17index e907167..3239093 100644
18--- a/ioctl.c
19+++ b/ioctl.c
20@@ -961,8 +961,7 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
21 case CIOCASYMFEAT:
22 return put_user(CRF_MOD_EXP_CRT | CRF_MOD_EXP | CRF_DSA_SIGN |
23 CRF_DSA_VERIFY | CRF_DH_COMPUTE_KEY |
24- CRF_DSA_GENERATE_KEY | CRF_DH_GENERATE_KEY |
25- CRF_RSA_GENERATE_KEY, p);
26+ CRF_DSA_GENERATE_KEY | CRF_DH_GENERATE_KEY, p);
27 case CRIOGET:
28 fd = clonefd(filp);
29 ret = put_user(fd, p);
30--
312.2.0
32
diff --git a/recipes-kernel/cryptodev/cryptodev-linux_1.6.bbappend b/recipes-kernel/cryptodev/cryptodev-linux_1.6.bbappend
deleted file mode 100644
index 3cbbb3d..0000000
--- a/recipes-kernel/cryptodev/cryptodev-linux_1.6.bbappend
+++ /dev/null
@@ -1,2 +0,0 @@
1require recipes-kernel/cryptodev/cryptodev-fsl.inc
2
diff --git a/recipes-kernel/cryptodev/cryptodev-linux_1.7.bb b/recipes-kernel/cryptodev/cryptodev-linux_1.7.bb
new file mode 100644
index 0000000..92ccd71
--- /dev/null
+++ b/recipes-kernel/cryptodev/cryptodev-linux_1.7.bb
@@ -0,0 +1,12 @@
1require cryptodev_${PV}.inc
2
3SUMMARY = "A /dev/crypto device driver header file"
4
5do_compile[noexec] = "1"
6
7# Just install cryptodev.h which is the only header file needed to be exported
8do_install() {
9 install -D ${S}/crypto/cryptodev.h ${D}${includedir}/crypto/cryptodev.h
10}
11
12ALLOW_EMPTY_${PN} = "1"
diff --git a/recipes-kernel/cryptodev/cryptodev-module_1.6.bbappend b/recipes-kernel/cryptodev/cryptodev-module_1.6.bbappend
deleted file mode 100644
index 2bf012c..0000000
--- a/recipes-kernel/cryptodev/cryptodev-module_1.6.bbappend
+++ /dev/null
@@ -1,12 +0,0 @@
1require recipes-kernel/cryptodev/cryptodev-fsl.inc
2
3inherit qoriq_build_64bit_kernel
4
5do_install_append_qoriq-ppc () {
6 rm -fr ${D}/usr
7}
8
9# Currently pkc-host does not support RSA_KEYGEN, remove this
10# if it is fixed.
11SRC_URI_append_qoriq-ppc = "${@base_contains('DISTRO_FEATURES', 'c29x_pkc', ' file://0001-don-t-advertise-RSA-keygen.patch', '', d)}"
12
diff --git a/recipes-kernel/cryptodev/cryptodev-module_1.7.bb b/recipes-kernel/cryptodev/cryptodev-module_1.7.bb
new file mode 100644
index 0000000..e6b1f27
--- /dev/null
+++ b/recipes-kernel/cryptodev/cryptodev-module_1.7.bb
@@ -0,0 +1,10 @@
1require cryptodev_${PV}.inc
2
3SUMMARY = "A /dev/crypto device driver kernel module"
4
5inherit module qoriq_build_64bit_kernel
6
7# Header file provided by a separate package
8DEPENDS += "cryptodev-linux"
9
10EXTRA_OEMAKE='KERNEL_DIR="${STAGING_KERNEL_DIR}" PREFIX="${D}"'
diff --git a/recipes-kernel/cryptodev/cryptodev-tests_1.7.bb b/recipes-kernel/cryptodev/cryptodev-tests_1.7.bb
new file mode 100644
index 0000000..128ccc9
--- /dev/null
+++ b/recipes-kernel/cryptodev/cryptodev-tests_1.7.bb
@@ -0,0 +1,17 @@
1require cryptodev_${PV}.inc
2
3SUMMARY = "A test suite for /dev/crypto device driver"
4DEPENDS = "openssl"
5
6EXTRA_OEMAKE='KERNEL_DIR="${STAGING_KERNEL_DIR}" PREFIX="${D}"'
7
8do_compile() {
9 oe_runmake testprogs
10}
11
12do_install() {
13 oe_runmake install_tests
14}
15
16FILES_${PN}-dbg += "${bindir}/tests_cryptodev/.debug"
17FILES_${PN} = "${bindir}/tests_cryptodev/*"
diff --git a/recipes-kernel/cryptodev/cryptodev_1.7.inc b/recipes-kernel/cryptodev/cryptodev_1.7.inc
new file mode 100644
index 0000000..6b65f72
--- /dev/null
+++ b/recipes-kernel/cryptodev/cryptodev_1.7.inc
@@ -0,0 +1,47 @@
1HOMEPAGE = "http://cryptodev-linux.org/"
2
3RCONFLICTS_${PN} = "ocf-linux"
4RREPLACES_${PN} = "ocf-linux"
5
6LICENSE = "GPLv2"
7LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
8
9SRC_URI = "http://download.gna.org/cryptodev-linux/cryptodev-linux-${PV}.tar.gz"
10SRC_URI[md5sum] = "0b63b3481cf2c90386b35f057481d36b"
11SRC_URI[sha256sum] = "41880533b53de4d7b3f054e230f576988dafb8eed7bef5ebcf6422bb2e3a3b25"
12
13# Upstream hotfixes and yocto specific patches
14SRC_URI_append = " \
15file://0001-fix-compilation-against-linux-3.19.patch \
16file://0002-tests-Makefile-fix-arg-passing-to-CC-in-implicit-rul.patch \
17file://0003-Disable-installing-header-file-provided-by-another-p.patch \
18file://0004-Add-the-compile-and-install-rules-for-cryptodev-test.patch \
19"
20# SDK patches
21SRC_URI_append = " file://0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch \
22file://0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch \
23file://0003-PKC-support-added-in-cryptodev-module.patch \
24file://0004-Compat-versions-of-PKC-IOCTLs.patch \
25file://0005-Asynchronous-interface-changes-in-cryptodev.patch \
26file://0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch \
27file://0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch \
28file://0008-Add-RSA-Key-generation-offloading.patch \
29file://0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch \
30file://0010-add-support-for-composite-TLS10-SHA1-3DES-algorithm-.patch \
31file://0011-add-support-for-TLSv1.1-record-offload.patch \
32file://0012-add-support-for-TLSv1.2-record-offload.patch \
33file://0013-clean-up-code-layout.patch \
34file://0014-remove-redundant-data-copy-for-pkc-operations.patch \
35file://0015-fix-pkc-request-deallocation.patch \
36file://0016-add-basic-detection-of-asym-features.patch \
37file://0017-remove-dead-code.patch \
38file://0018-fix-compat-warnings.patch \
39file://0019-fix-size_t-print-format.patch \
40file://0020-fix-uninitialized-variable-compiler-warning.patch \
41"
42
43# NOTE: remove this patch and all traces of DISTRO_FEATURE c29x_pkc
44# if pkc-host does not need customized cryptodev patches anymore
45SRC_URI_append = "${@base_contains('DISTRO_FEATURES', 'c29x_pkc', ' file://0001-don-t-advertise-RSA-keygen.patch', '', d)}"
46
47S = "${WORKDIR}/cryptodev-linux-${PV}"
diff --git a/recipes-kernel/cryptodev/cryptodev-fsl/0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch b/recipes-kernel/cryptodev/files/0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch
index 796e548..7d957ec 100644
--- a/recipes-kernel/cryptodev/cryptodev-fsl/0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch
+++ b/recipes-kernel/cryptodev/files/0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch
@@ -1,7 +1,7 @@
1From 715ade8236f40cf811c39f9538dfd60803967fcd Mon Sep 17 00:00:00 2001 1From c653e3a70499c6bb66b57c1788d2d38ca9b8a07e Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@freescale.com> 2From: Cristian Stoica <cristian.stoica@freescale.com>
3Date: Thu, 29 Aug 2013 16:52:30 +0300 3Date: Thu, 29 Aug 2013 16:52:30 +0300
4Subject: [PATCH 1/9] add support for composite TLS10(SHA1,AES) algorithm 4Subject: [PATCH 01/15] add support for composite TLS10(SHA1,AES) algorithm
5 offload 5 offload
6 6
7This adds support for composite algorithm offload as a primitive 7This adds support for composite algorithm offload as a primitive
@@ -32,7 +32,7 @@ index 7fb9c7d..c0e8cd4 100644
32 }; 32 };
33 33
34diff --git a/ioctl.c b/ioctl.c 34diff --git a/ioctl.c b/ioctl.c
35index 5a55a76..f9b9b2e 100644 35index b23f5fd..a3f8379 100644
36--- a/ioctl.c 36--- a/ioctl.c
37+++ b/ioctl.c 37+++ b/ioctl.c
38@@ -159,6 +159,11 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) 38@@ -159,6 +159,11 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
@@ -48,5 +48,5 @@ index 5a55a76..f9b9b2e 100644
48 alg_name = "ecb(cipher_null)"; 48 alg_name = "ecb(cipher_null)";
49 stream = 1; 49 stream = 1;
50-- 50--
511.8.3.1 512.3.5
52 52
diff --git a/recipes-kernel/cryptodev/files/0001-don-t-advertise-RSA-keygen.patch b/recipes-kernel/cryptodev/files/0001-don-t-advertise-RSA-keygen.patch
new file mode 100644
index 0000000..10d6c8b
--- /dev/null
+++ b/recipes-kernel/cryptodev/files/0001-don-t-advertise-RSA-keygen.patch
@@ -0,0 +1,33 @@
1From d30c9c64aca4a7905e1b7eb3e28e1c616191bd34 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@freescale.com>
3Date: Tue, 9 Dec 2014 16:41:25 +0200
4Subject: [PATCH] don't advertise RSA keygen
5
6Disable RSA keygen operations when they are not available.
7
8Currently no testing can be done and this patch should be applied
9selectively on platforms that have incomplete support for RSA operations
10(for example pkc driver on C293)
11
12Change-Id: Ic8df014623410c3cf4b0b217a246efcea8f2eeef
13Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
14---
15 ioctl.c | 2 +-
16 1 file changed, 1 insertion(+), 1 deletion(-)
17
18diff --git a/ioctl.c b/ioctl.c
19index 53dbf64..27dc66e 100644
20--- a/ioctl.c
21+++ b/ioctl.c
22@@ -979,7 +979,7 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
23 case CIOCASYMFEAT:
24 ses = 0;
25 if (crypto_has_alg("pkc(rsa)", 0, 0))
26- ses = CRF_MOD_EXP_CRT | CRF_MOD_EXP | CRF_RSA_GENERATE_KEY;
27+ ses = CRF_MOD_EXP_CRT | CRF_MOD_EXP ;
28 if (crypto_has_alg("pkc(dsa)", 0, 0))
29 ses |= CRF_DSA_SIGN | CRF_DSA_VERIFY | CRF_DSA_GENERATE_KEY;
30 if (crypto_has_alg("pkc(dh)", 0, 0))
31--
322.3.5
33
diff --git a/recipes-kernel/cryptodev/files/0001-fix-compilation-against-linux-3.19.patch b/recipes-kernel/cryptodev/files/0001-fix-compilation-against-linux-3.19.patch
new file mode 100644
index 0000000..ab276d2
--- /dev/null
+++ b/recipes-kernel/cryptodev/files/0001-fix-compilation-against-linux-3.19.patch
@@ -0,0 +1,36 @@
1From 5054d20d45571cc85339351fde52f872eeb82206 Mon Sep 17 00:00:00 2001
2From: Phil Sutter <phil@nwl.cc>
3Date: Tue, 10 Feb 2015 04:57:05 +0100
4Subject: [PATCH 1/4] fix compilation against linux-3.19
5
6Commit f938612dd97d481b8b5bf960c992ae577f081c17 in linux.git removes
7get_unused_fd() macro. This patch changes the calling code to use it's
8content 'get_unused_fd_flags(0)' instead. Checking for when
9get_unused_fd_flags was introduced shows it's been there since 2.6.23 at
10least, so probably no need to make this change conditional on the target
11kernel version.
12
13Original patch by Ricardo Ribalda Delgado for Open Embedded, reported by
14Oleg Rakhmanov.
15
16Signed-off-by: Phil Sutter <phil@nwl.cc>
17---
18 ioctl.c | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21diff --git a/ioctl.c b/ioctl.c
22index 5a55a76..b23f5fd 100644
23--- a/ioctl.c
24+++ b/ioctl.c
25@@ -546,7 +546,7 @@ static int
26 clonefd(struct file *filp)
27 {
28 int ret;
29- ret = get_unused_fd();
30+ ret = get_unused_fd_flags(0);
31 if (ret >= 0) {
32 get_file(filp);
33 fd_install(ret, filp);
34--
352.3.5
36
diff --git a/recipes-kernel/cryptodev/files/0002-Fix-tests-Makefile-usage-of-LDLIBS-vs.-LDFLAGS.patch b/recipes-kernel/cryptodev/files/0002-Fix-tests-Makefile-usage-of-LDLIBS-vs.-LDFLAGS.patch
new file mode 100644
index 0000000..f5ab8b4
--- /dev/null
+++ b/recipes-kernel/cryptodev/files/0002-Fix-tests-Makefile-usage-of-LDLIBS-vs.-LDFLAGS.patch
@@ -0,0 +1,29 @@
1From 47ff1eb9bb4f872c1d731b93d334ee5865bf3439 Mon Sep 17 00:00:00 2001
2From: Denys Dmytriyenko <denys@ti.com>
3Date: Sun, 6 Apr 2014 22:16:30 -0400
4Subject: [PATCH] Fix tests Makefile usage of LDLIBS vs. LDFLAGS
5
6Libraries must come after objects, as link order matters, especially
7when using linker flags like -Wl,--as-needed.
8
9Signed-off-by: Denys Dmytriyenko <denys@ti.com>
10
11Upstream-Status: Pending
12---
13 tests/Makefile | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-)
15
16diff --git a/tests/Makefile b/tests/Makefile
17index cd202af..67c3c83 100644
18--- a/tests/Makefile
19+++ b/tests/Makefile
20@@ -39,5 +39,5 @@ testprogs: $(hostprogs)
21 clean:
22 rm -f *.o *~ $(hostprogs)
23
24-${comp_progs}: LDFLAGS += -lssl -lcrypto
25+${comp_progs}: LDLIBS += -lssl -lcrypto
26 ${comp_progs}: %: %.o openssl_wrapper.o
27--
281.9.1
29
diff --git a/recipes-kernel/cryptodev/cryptodev-fsl/0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch b/recipes-kernel/cryptodev/files/0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch
index 086a97f..08d9231 100644
--- a/recipes-kernel/cryptodev/cryptodev-fsl/0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch
+++ b/recipes-kernel/cryptodev/files/0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch
@@ -1,7 +1,7 @@
1From 4b766c93e4ee19248dd66bbebb61fb5cc9c8a012 Mon Sep 17 00:00:00 2001 1From 71b317347179225693c6d41b740d387ae2c25061 Mon Sep 17 00:00:00 2001
2From: Horia Geanta <horia.geanta@freescale.com> 2From: Horia Geanta <horia.geanta@freescale.com>
3Date: Wed, 4 Dec 2013 15:43:41 +0200 3Date: Wed, 4 Dec 2013 15:43:41 +0200
4Subject: [PATCH 2/9] add support for COMPAT_CIOCAUTHCRYPT ioctl() 4Subject: [PATCH 02/15] add support for COMPAT_CIOCAUTHCRYPT ioctl()
5 5
6Upstream-status: Pending 6Upstream-status: Pending
7 7
@@ -169,7 +169,7 @@ index d7660fa..8e687e7 100644
169 struct fcrypt *fcr, void __user *arg); 169 struct fcrypt *fcr, void __user *arg);
170 int kcaop_to_user(struct kernel_crypt_auth_op *kcaop, 170 int kcaop_to_user(struct kernel_crypt_auth_op *kcaop,
171diff --git a/ioctl.c b/ioctl.c 171diff --git a/ioctl.c b/ioctl.c
172index f9b9b2e..1563c75 100644 172index a3f8379..5a44807 100644
173--- a/ioctl.c 173--- a/ioctl.c
174+++ b/ioctl.c 174+++ b/ioctl.c
175@@ -998,6 +998,7 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) 175@@ -998,6 +998,7 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_)
@@ -203,5 +203,5 @@ index f9b9b2e..1563c75 100644
203 case COMPAT_CIOCASYNCCRYPT: 203 case COMPAT_CIOCASYNCCRYPT:
204 if (unlikely(ret = compat_kcop_from_user(&kcop, fcr, arg))) 204 if (unlikely(ret = compat_kcop_from_user(&kcop, fcr, arg)))
205-- 205--
2061.8.3.1 2062.3.5
207 207
diff --git a/recipes-kernel/cryptodev/files/0002-tests-Makefile-fix-arg-passing-to-CC-in-implicit-rul.patch b/recipes-kernel/cryptodev/files/0002-tests-Makefile-fix-arg-passing-to-CC-in-implicit-rul.patch
new file mode 100644
index 0000000..68c48e0
--- /dev/null
+++ b/recipes-kernel/cryptodev/files/0002-tests-Makefile-fix-arg-passing-to-CC-in-implicit-rul.patch
@@ -0,0 +1,28 @@
1From da730106c2558c8e0c8e1b1b1812d32ef9574ab7 Mon Sep 17 00:00:00 2001
2From: Phil Sutter <phil@nwl.cc>
3Date: Sat, 11 Apr 2015 12:45:05 +0200
4Subject: [PATCH 2/4] tests/Makefile: fix arg passing to CC in implicit rule
5
6GCC docs suggest passing -lfoo after object files referring to functions
7in libfoo. Therefore use LDLIBS to specify libraries, which puts them at
8the right place when make calls CC implicitly.
9
10Signed-off-by: Phil Sutter <phil@nwl.cc>
11---
12 tests/Makefile | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15diff --git a/tests/Makefile b/tests/Makefile
16index c9f04e8..20c52ba 100644
17--- a/tests/Makefile
18+++ b/tests/Makefile
19@@ -31,5 +31,5 @@ check: $(hostprogs)
20 clean:
21 rm -f *.o *~ $(hostprogs)
22
23-${comp_progs}: LDFLAGS += -lssl -lcrypto
24+${comp_progs}: LDLIBS += -lssl -lcrypto
25 ${comp_progs}: %: %.o openssl_wrapper.o
26--
272.3.5
28
diff --git a/recipes-kernel/cryptodev/files/0003-Disable-installing-header-file-provided-by-another-p.patch b/recipes-kernel/cryptodev/files/0003-Disable-installing-header-file-provided-by-another-p.patch
new file mode 100644
index 0000000..e384950
--- /dev/null
+++ b/recipes-kernel/cryptodev/files/0003-Disable-installing-header-file-provided-by-another-p.patch
@@ -0,0 +1,29 @@
1From c618f882c283511dd4f7547113a1117c4785f56f Mon Sep 17 00:00:00 2001
2From: Denys Dmytriyenko <denys@ti.com>
3Date: Sun, 6 Apr 2014 19:51:39 -0400
4Subject: [PATCH 3/4] Disable installing header file provided by another
5 package
6
7Signed-off-by: Denys Dmytriyenko <denys@ti.com>
8
9Upstream-Status: Inappropriate [ OE specific ]
10---
11 Makefile | 2 --
12 1 file changed, 2 deletions(-)
13
14diff --git a/Makefile b/Makefile
15index 31c4b3f..855bb54 100644
16--- a/Makefile
17+++ b/Makefile
18@@ -31,8 +31,6 @@ install: modules_install
19
20 modules_install:
21 make -C $(KERNEL_DIR) SUBDIRS=`pwd` modules_install
22- @echo "Installing cryptodev.h in $(PREFIX)/usr/include/crypto ..."
23- @install -D crypto/cryptodev.h $(PREFIX)/usr/include/crypto/cryptodev.h
24
25 clean:
26 make -C $(KERNEL_DIR) SUBDIRS=`pwd` clean
27--
282.3.5
29
diff --git a/recipes-kernel/cryptodev/cryptodev-fsl/0003-PKC-support-added-in-cryptodev-module.patch b/recipes-kernel/cryptodev/files/0003-PKC-support-added-in-cryptodev-module.patch
index a4f7816..46f2432 100644
--- a/recipes-kernel/cryptodev/cryptodev-fsl/0003-PKC-support-added-in-cryptodev-module.patch
+++ b/recipes-kernel/cryptodev/files/0003-PKC-support-added-in-cryptodev-module.patch
@@ -1,7 +1,7 @@
1From 5b57fc2124cef0acc3c7e8de376ebd9aa4f1fdd3 Mon Sep 17 00:00:00 2001 1From fc9ee6ed33c76372de6e3748d2e951fa10f7c47e Mon Sep 17 00:00:00 2001
2From: Yashpal Dutta <yashpal.dutta@freescale.com> 2From: Yashpal Dutta <yashpal.dutta@freescale.com>
3Date: Fri, 7 Mar 2014 06:16:09 +0545 3Date: Fri, 7 Mar 2014 06:16:09 +0545
4Subject: [PATCH 3/9] PKC support added in cryptodev module 4Subject: [PATCH 03/15] PKC support added in cryptodev module
5 5
6Upstream-status: Pending 6Upstream-status: Pending
7 7
@@ -231,7 +231,7 @@ index 8e687e7..fdbcc61 100644
231 struct csession { 231 struct csession {
232 struct list_head entry; 232 struct list_head entry;
233diff --git a/ioctl.c b/ioctl.c 233diff --git a/ioctl.c b/ioctl.c
234index 1563c75..782d7fe 100644 234index 5a44807..69980e3 100644
235--- a/ioctl.c 235--- a/ioctl.c
236+++ b/ioctl.c 236+++ b/ioctl.c
237@@ -4,6 +4,7 @@ 237@@ -4,6 +4,7 @@
@@ -894,5 +894,5 @@ index 57e5c38..0b7951e 100644
894 { 894 {
895 struct csession *ses_ptr; 895 struct csession *ses_ptr;
896-- 896--
8971.8.3.1 8972.3.5
898 898
diff --git a/recipes-kernel/cryptodev/files/0004-Add-the-compile-and-install-rules-for-cryptodev-test.patch b/recipes-kernel/cryptodev/files/0004-Add-the-compile-and-install-rules-for-cryptodev-test.patch
new file mode 100644
index 0000000..25a52a9
--- /dev/null
+++ b/recipes-kernel/cryptodev/files/0004-Add-the-compile-and-install-rules-for-cryptodev-test.patch
@@ -0,0 +1,65 @@
1From 188f30f6233d05eb62b58bf6d94a16bcbeeae0ee Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@freescale.com>
3Date: Mon, 27 Apr 2015 15:26:14 +0300
4Subject: [PATCH 4/4] Add the compile and install rules for cryptodev tests
5
6Change-Id: Ica10dc563c77220dcf0e0993515230df8a86c34d
7Signed-off-by: Yu Zongchun <b40527@freescale.com>
8---
9 Makefile | 6 ++++++
10 tests/Makefile | 8 ++++++++
11 2 files changed, 14 insertions(+)
12
13diff --git a/Makefile b/Makefile
14index 855bb54..5497037 100644
15--- a/Makefile
16+++ b/Makefile
17@@ -32,6 +32,9 @@ install: modules_install
18 modules_install:
19 make -C $(KERNEL_DIR) SUBDIRS=`pwd` modules_install
20
21+install_tests:
22+ make -C tests install DESTDIR=$(PREFIX)
23+
24 clean:
25 make -C $(KERNEL_DIR) SUBDIRS=`pwd` clean
26 rm -f $(hostprogs) *~
27@@ -40,6 +43,9 @@ clean:
28 check:
29 CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) make -C tests check
30
31+testprogs:
32+ KERNEL_DIR=$(KERNEL_DIR) make -C tests testprogs
33+
34 CPOPTS =
35 ifneq (${SHOW_TYPES},)
36 CPOPTS += --show-types
37diff --git a/tests/Makefile b/tests/Makefile
38index 20c52ba..67c3c83 100644
39--- a/tests/Makefile
40+++ b/tests/Makefile
41@@ -19,6 +19,12 @@ example-async-hmac-objs := async_hmac.o
42 example-async-speed-objs := async_speed.o
43 example-hashcrypt-speed-objs := hashcrypt_speed.c
44
45+install:
46+ install -d $(DESTDIR)/usr/bin/tests_cryptodev
47+ for bin in $(hostprogs); do \
48+ install -m 755 $${bin} $(DESTDIR)/usr/bin/tests_cryptodev/; \
49+ done
50+
51 check: $(hostprogs)
52 ./cipher
53 ./hmac
54@@ -28,6 +34,8 @@ check: $(hostprogs)
55 ./cipher-gcm
56 ./cipher-aead
57
58+testprogs: $(hostprogs)
59+
60 clean:
61 rm -f *.o *~ $(hostprogs)
62
63--
642.3.5
65
diff --git a/recipes-kernel/cryptodev/cryptodev-fsl/0004-Compat-versions-of-PKC-IOCTLs.patch b/recipes-kernel/cryptodev/files/0004-Compat-versions-of-PKC-IOCTLs.patch
index 2eedcc7..2f35768 100644
--- a/recipes-kernel/cryptodev/cryptodev-fsl/0004-Compat-versions-of-PKC-IOCTLs.patch
+++ b/recipes-kernel/cryptodev/files/0004-Compat-versions-of-PKC-IOCTLs.patch
@@ -1,7 +1,7 @@
1From 5435dfd329cd90837ce36c6dadc26166c7906cab Mon Sep 17 00:00:00 2001 1From b109fbdb64de6be0dc2f0d2ef108cead34652495 Mon Sep 17 00:00:00 2001
2From: Yashpal Dutta <yashpal.dutta@freescale.com> 2From: Yashpal Dutta <yashpal.dutta@freescale.com>
3Date: Fri, 7 Mar 2014 06:52:13 +0545 3Date: Fri, 7 Mar 2014 06:52:13 +0545
4Subject: [PATCH 4/9] Compat versions of PKC IOCTLs 4Subject: [PATCH 04/15] Compat versions of PKC IOCTLs
5 5
6Upstream-status: Pending 6Upstream-status: Pending
7 7
@@ -50,7 +50,7 @@ index fdbcc61..cf54dac 100644
50 #endif /* CONFIG_COMPAT */ 50 #endif /* CONFIG_COMPAT */
51 51
52diff --git a/ioctl.c b/ioctl.c 52diff --git a/ioctl.c b/ioctl.c
53index 782d7fe..3baf3e6 100644 53index 69980e3..9431025 100644
54--- a/ioctl.c 54--- a/ioctl.c
55+++ b/ioctl.c 55+++ b/ioctl.c
56@@ -1081,6 +1081,68 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) 56@@ -1081,6 +1081,68 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
@@ -196,5 +196,5 @@ index 782d7fe..3baf3e6 100644
196 return -EINVAL; 196 return -EINVAL;
197 } 197 }
198-- 198--
1991.8.3.1 1992.3.5
200 200
diff --git a/recipes-kernel/cryptodev/cryptodev-fsl/0005-Asynchronous-interface-changes-in-cryptodev.patch b/recipes-kernel/cryptodev/files/0005-Asynchronous-interface-changes-in-cryptodev.patch
index 2f88eda..8827fb0 100644
--- a/recipes-kernel/cryptodev/cryptodev-fsl/0005-Asynchronous-interface-changes-in-cryptodev.patch
+++ b/recipes-kernel/cryptodev/files/0005-Asynchronous-interface-changes-in-cryptodev.patch
@@ -1,7 +1,7 @@
1From ddc4179a454cea79c8385fd6756d20cbf3c6dcb5 Mon Sep 17 00:00:00 2001 1From 7594d5375d998eb25241750b623661ff021697d3 Mon Sep 17 00:00:00 2001
2From: Yashpal Dutta <yashpal.dutta@freescale.com> 2From: Yashpal Dutta <yashpal.dutta@freescale.com>
3Date: Fri, 7 Mar 2014 07:24:00 +0545 3Date: Fri, 7 Mar 2014 07:24:00 +0545
4Subject: [PATCH 5/9] Asynchronous interface changes in cryptodev 4Subject: [PATCH 05/15] Asynchronous interface changes in cryptodev
5 5
6Upstream-status: Pending 6Upstream-status: Pending
7 7
@@ -90,7 +90,7 @@ index cf54dac..5347cae 100644
90 #endif /* CONFIG_COMPAT */ 90 #endif /* CONFIG_COMPAT */
91 91
92diff --git a/ioctl.c b/ioctl.c 92diff --git a/ioctl.c b/ioctl.c
93index 3baf3e6..2eb7f03 100644 93index 9431025..e2f407f 100644
94--- a/ioctl.c 94--- a/ioctl.c
95+++ b/ioctl.c 95+++ b/ioctl.c
96@@ -105,8 +105,6 @@ void cryptodev_complete_asym(struct crypto_async_request *req, int err) 96@@ -105,8 +105,6 @@ void cryptodev_complete_asym(struct crypto_async_request *req, int err)
@@ -209,5 +209,5 @@ index 3baf3e6..2eb7f03 100644
209 return ret; 209 return ret;
210 default: 210 default:
211-- 211--
2121.8.3.1 2122.3.5
213 213
diff --git a/recipes-kernel/cryptodev/cryptodev-fsl/0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch b/recipes-kernel/cryptodev/files/0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch
index e70a057..89cace3 100644
--- a/recipes-kernel/cryptodev/cryptodev-fsl/0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch
+++ b/recipes-kernel/cryptodev/files/0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch
@@ -1,7 +1,7 @@
1From 30fc86a09109f169815befc2cd8bbfcae79fe7e0 Mon Sep 17 00:00:00 2001 1From eccd6277b067cd85094eb057225cc0a983300b9f Mon Sep 17 00:00:00 2001
2From: Yashpal Dutta <yashpal.dutta@freescale.com> 2From: Yashpal Dutta <yashpal.dutta@freescale.com>
3Date: Fri, 7 Mar 2014 07:53:53 +0545 3Date: Fri, 7 Mar 2014 07:53:53 +0545
4Subject: [PATCH 6/9] ECC_KEYGEN and DLC_KEYGEN supported in cryptodev module 4Subject: [PATCH 06/15] ECC_KEYGEN and DLC_KEYGEN supported in cryptodev module
5 5
6Upstream-status: Pending 6Upstream-status: Pending
7 7
@@ -50,7 +50,7 @@ index 4436fbf..275a55c 100644
50 /* ioctl's. Compatible with old linux cryptodev.h 50 /* ioctl's. Compatible with old linux cryptodev.h
51 */ 51 */
52diff --git a/ioctl.c b/ioctl.c 52diff --git a/ioctl.c b/ioctl.c
53index 2eb7f03..c813c8c 100644 53index e2f407f..1f0741a 100644
54--- a/ioctl.c 54--- a/ioctl.c
55+++ b/ioctl.c 55+++ b/ioctl.c
56@@ -726,6 +726,23 @@ static int crypto_async_fetch_asym(struct cryptodev_pkc *pkc) 56@@ -726,6 +726,23 @@ static int crypto_async_fetch_asym(struct cryptodev_pkc *pkc)
@@ -208,5 +208,5 @@ index 0b7951e..c901bc7 100644
208 err: 208 err:
209 return ret; 209 return ret;
210-- 210--
2111.8.3.1 2112.3.5
212 212
diff --git a/recipes-kernel/cryptodev/cryptodev-fsl/0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch b/recipes-kernel/cryptodev/files/0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch
index 93a2248..a76aca4 100644
--- a/recipes-kernel/cryptodev/cryptodev-fsl/0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch
+++ b/recipes-kernel/cryptodev/files/0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch
@@ -1,7 +1,7 @@
1From d60b9dbf53d63092fd292c00bb03c250c26703cf Mon Sep 17 00:00:00 2001 1From 78c01e1882def52c72966c0e86913950ec201af9 Mon Sep 17 00:00:00 2001
2From: Yashpal Dutta <yashpal.dutta@freescale.com> 2From: Yashpal Dutta <yashpal.dutta@freescale.com>
3Date: Fri, 7 Mar 2014 08:49:15 +0545 3Date: Fri, 7 Mar 2014 08:49:15 +0545
4Subject: [PATCH 7/9] RCU stall fixed in PKC asynchronous interface 4Subject: [PATCH 07/15] RCU stall fixed in PKC asynchronous interface
5 5
6Upstream-status: Pending 6Upstream-status: Pending
7 7
@@ -12,7 +12,7 @@ Signed-off-by: Yashpal Dutta <yashpal.dutta@freescale.com>
12 2 files changed, 38 insertions(+), 28 deletions(-) 12 2 files changed, 38 insertions(+), 28 deletions(-)
13 13
14diff --git a/ioctl.c b/ioctl.c 14diff --git a/ioctl.c b/ioctl.c
15index c813c8c..7e4c671 100644 15index 1f0741a..e4e16a8 100644
16--- a/ioctl.c 16--- a/ioctl.c
17+++ b/ioctl.c 17+++ b/ioctl.c
18@@ -108,10 +108,9 @@ void cryptodev_complete_asym(struct crypto_async_request *req, int err) 18@@ -108,10 +108,9 @@ void cryptodev_complete_asym(struct crypto_async_request *req, int err)
@@ -234,5 +234,5 @@ index c901bc7..2747706 100644
234 if (!buf) 234 if (!buf)
235 return -ENOMEM; 235 return -ENOMEM;
236-- 236--
2371.8.3.1 2372.3.5
238 238
diff --git a/recipes-kernel/cryptodev/cryptodev-fsl/0008-Add-RSA-Key-generation-offloading.patch b/recipes-kernel/cryptodev/files/0008-Add-RSA-Key-generation-offloading.patch
index affb2e7..d251c66 100644
--- a/recipes-kernel/cryptodev/cryptodev-fsl/0008-Add-RSA-Key-generation-offloading.patch
+++ b/recipes-kernel/cryptodev/files/0008-Add-RSA-Key-generation-offloading.patch
@@ -1,7 +1,7 @@
1From af5e4289f60c38ab17adab14c82d6204d155f25f Mon Sep 17 00:00:00 2001 1From 5127db3483a2e4f6dc13330bea7237931c5f15a0 Mon Sep 17 00:00:00 2001
2From: Hou Zhiqiang <B48286@freescale.com> 2From: Hou Zhiqiang <B48286@freescale.com>
3Date: Wed, 19 Mar 2014 14:02:46 +0800 3Date: Wed, 19 Mar 2014 14:02:46 +0800
4Subject: [PATCH 8/9] Add RSA Key generation offloading 4Subject: [PATCH 08/15] Add RSA Key generation offloading
5 5
6Upstream-status: Pending 6Upstream-status: Pending
7 7
@@ -47,7 +47,7 @@ index 275a55c..d0cc542 100644
47 #define CRF_DSA_VERIFY (1 << CRK_DSA_VERIFY) 47 #define CRF_DSA_VERIFY (1 << CRK_DSA_VERIFY)
48 #define CRF_DH_COMPUTE_KEY (1 << CRK_DH_COMPUTE_KEY) 48 #define CRF_DH_COMPUTE_KEY (1 << CRK_DH_COMPUTE_KEY)
49diff --git a/ioctl.c b/ioctl.c 49diff --git a/ioctl.c b/ioctl.c
50index 7e4c671..14888d6 100644 50index e4e16a8..3762a47 100644
51--- a/ioctl.c 51--- a/ioctl.c
52+++ b/ioctl.c 52+++ b/ioctl.c
53@@ -957,7 +957,8 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) 53@@ -957,7 +957,8 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
@@ -166,5 +166,5 @@ index 2747706..14dcf40 100644
166 err: 166 err:
167 return ret; 167 return ret;
168-- 168--
1691.8.3.1 1692.3.5
170 170
diff --git a/recipes-kernel/cryptodev/cryptodev-fsl/0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch b/recipes-kernel/cryptodev/files/0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch
index 32757ca..2213fae 100644
--- a/recipes-kernel/cryptodev/cryptodev-fsl/0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch
+++ b/recipes-kernel/cryptodev/files/0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch
@@ -1,7 +1,7 @@
1From e791b55b03d295ee11476382a7bd93ab131e2e52 Mon Sep 17 00:00:00 2001 1From 800af48d0c26830943ca2308dd426b5b09811750 Mon Sep 17 00:00:00 2001
2From: Yashpal Dutta <yashpal.dutta@freescale.com> 2From: Yashpal Dutta <yashpal.dutta@freescale.com>
3Date: Thu, 17 Apr 2014 07:08:47 +0545 3Date: Thu, 17 Apr 2014 07:08:47 +0545
4Subject: [PATCH 9/9] Fixed compilation error of openssl with fsl cryptodev 4Subject: [PATCH 09/15] Fixed compilation error of openssl with fsl cryptodev
5 5
6Upstream-status: Pending 6Upstream-status: Pending
7 7
@@ -110,7 +110,7 @@ index 5347cae..c83c885 100644
110 compat_uptr_t cookie; 110 compat_uptr_t cookie;
111 }; 111 };
112diff --git a/ioctl.c b/ioctl.c 112diff --git a/ioctl.c b/ioctl.c
113index 14888d6..20ab4ca 100644 113index 3762a47..c97320b 100644
114--- a/ioctl.c 114--- a/ioctl.c
115+++ b/ioctl.c 115+++ b/ioctl.c
116@@ -4,7 +4,7 @@ 116@@ -4,7 +4,7 @@
@@ -156,5 +156,5 @@ index 14dcf40..6365911 100644
156 * This file is part of linux cryptodev. 156 * This file is part of linux cryptodev.
157 * 157 *
158-- 158--
1592.2.0 1592.3.5
160 160
diff --git a/recipes-kernel/cryptodev/files/0010-add-support-for-composite-TLS10-SHA1-3DES-algorithm-.patch b/recipes-kernel/cryptodev/files/0010-add-support-for-composite-TLS10-SHA1-3DES-algorithm-.patch
new file mode 100644
index 0000000..2032159
--- /dev/null
+++ b/recipes-kernel/cryptodev/files/0010-add-support-for-composite-TLS10-SHA1-3DES-algorithm-.patch
@@ -0,0 +1,54 @@
1From 55ee0ae703a68db74a492f5910937260502b9602 Mon Sep 17 00:00:00 2001
2From: Tudor Ambarus <tudor.ambarus@freescale.com>
3Date: Tue, 10 Jun 2014 08:27:59 +0300
4Subject: [PATCH 10/15] add support for composite TLS10(SHA1,3DES) algorithm
5 offload
6
7This adds support for composite algorithm offload in a single crypto
8(cipher + hmac) operation.
9
10It requires either software or hardware TLS support in the Linux kernel
11and can be used with Freescale B*, P* and T* platforms that have support
12for hardware TLS acceleration.
13
14Change-Id: Ibce0ceb4174809c9c96b453cd3202bc5220ff084
15Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com>
16Reviewed-on: http://git.am.freescale.net:8181/34000
17Reviewed-by: Cristian Stoica <cristian.stoica@freescale.com>
18Tested-by: Cristian Stoica <cristian.stoica@freescale.com>
19---
20 crypto/cryptodev.h | 1 +
21 ioctl.c | 5 +++++
22 2 files changed, 6 insertions(+)
23
24diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h
25index e7edd97..07f40b2 100644
26--- a/crypto/cryptodev.h
27+++ b/crypto/cryptodev.h
28@@ -55,6 +55,7 @@ enum cryptodev_crypto_op_t {
29 CRYPTO_SHA2_512,
30 CRYPTO_SHA2_224_HMAC,
31 CRYPTO_TLS10_AES_CBC_HMAC_SHA1,
32+ CRYPTO_TLS10_3DES_CBC_HMAC_SHA1,
33 CRYPTO_ALGORITHM_ALL, /* Keep updated - see below */
34 };
35
36diff --git a/ioctl.c b/ioctl.c
37index c97320b..574e913 100644
38--- a/ioctl.c
39+++ b/ioctl.c
40@@ -191,6 +191,11 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
41 stream = 0;
42 aead = 1;
43 break;
44+ case CRYPTO_TLS10_3DES_CBC_HMAC_SHA1:
45+ alg_name = "tls10(hmac(sha1),cbc(des3_ede))";
46+ stream = 0;
47+ aead = 1;
48+ break;
49 case CRYPTO_NULL:
50 alg_name = "ecb(cipher_null)";
51 stream = 1;
52--
532.3.5
54
diff --git a/recipes-kernel/cryptodev/files/0011-add-support-for-TLSv1.1-record-offload.patch b/recipes-kernel/cryptodev/files/0011-add-support-for-TLSv1.1-record-offload.patch
new file mode 100644
index 0000000..37862b5
--- /dev/null
+++ b/recipes-kernel/cryptodev/files/0011-add-support-for-TLSv1.1-record-offload.patch
@@ -0,0 +1,76 @@
1From 06cca15fd0412ae872c2b2c5d50216e1eb34fc50 Mon Sep 17 00:00:00 2001
2From: Tudor Ambarus <tudor.ambarus@freescale.com>
3Date: Tue, 31 Mar 2015 16:15:47 +0300
4Subject: [PATCH 11/15] add support for TLSv1.1 record offload
5
6This adds support for composite algorithm offload in a single crypto
7(cipher + hmac) operation.
8
9Supported cipher suites:
10- 3des-ede-cbc-sha
11- aes-128-cbc-hmac-sha
12- aes-256-cbc-hmac-sha
13
14It requires either software or hardware TLS support in the Linux kernel
15and can be used with Freescale B*, P* and T* platforms that have support
16for hardware TLS acceleration.
17
18Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com>
19Change-Id: Ia5f3fa7ec090d5643d71b0f608c68a274ec6b51f
20Reviewed-on: http://git.am.freescale.net:8181/33998
21Reviewed-by: Cristian Stoica <cristian.stoica@freescale.com>
22Tested-by: Cristian Stoica <cristian.stoica@freescale.com>
23---
24 crypto/cryptodev.h | 4 +++-
25 ioctl.c | 14 ++++++++++++--
26 2 files changed, 15 insertions(+), 3 deletions(-)
27
28diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h
29index 07f40b2..61e8599 100644
30--- a/crypto/cryptodev.h
31+++ b/crypto/cryptodev.h
32@@ -54,8 +54,10 @@ enum cryptodev_crypto_op_t {
33 CRYPTO_SHA2_384,
34 CRYPTO_SHA2_512,
35 CRYPTO_SHA2_224_HMAC,
36- CRYPTO_TLS10_AES_CBC_HMAC_SHA1,
37 CRYPTO_TLS10_3DES_CBC_HMAC_SHA1,
38+ CRYPTO_TLS10_AES_CBC_HMAC_SHA1,
39+ CRYPTO_TLS11_3DES_CBC_HMAC_SHA1,
40+ CRYPTO_TLS11_AES_CBC_HMAC_SHA1,
41 CRYPTO_ALGORITHM_ALL, /* Keep updated - see below */
42 };
43
44diff --git a/ioctl.c b/ioctl.c
45index 574e913..ba82387 100644
46--- a/ioctl.c
47+++ b/ioctl.c
48@@ -186,13 +186,23 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
49 stream = 1;
50 aead = 1;
51 break;
52+ case CRYPTO_TLS10_3DES_CBC_HMAC_SHA1:
53+ alg_name = "tls10(hmac(sha1),cbc(des3_ede))";
54+ stream = 0;
55+ aead = 1;
56+ break;
57 case CRYPTO_TLS10_AES_CBC_HMAC_SHA1:
58 alg_name = "tls10(hmac(sha1),cbc(aes))";
59 stream = 0;
60 aead = 1;
61 break;
62- case CRYPTO_TLS10_3DES_CBC_HMAC_SHA1:
63- alg_name = "tls10(hmac(sha1),cbc(des3_ede))";
64+ case CRYPTO_TLS11_3DES_CBC_HMAC_SHA1:
65+ alg_name = "tls11(hmac(sha1),cbc(des3_ede))";
66+ stream = 0;
67+ aead = 1;
68+ break;
69+ case CRYPTO_TLS11_AES_CBC_HMAC_SHA1:
70+ alg_name = "tls11(hmac(sha1),cbc(aes))";
71 stream = 0;
72 aead = 1;
73 break;
74--
752.3.5
76
diff --git a/recipes-kernel/cryptodev/files/0012-add-support-for-TLSv1.2-record-offload.patch b/recipes-kernel/cryptodev/files/0012-add-support-for-TLSv1.2-record-offload.patch
new file mode 100644
index 0000000..6aa672a
--- /dev/null
+++ b/recipes-kernel/cryptodev/files/0012-add-support-for-TLSv1.2-record-offload.patch
@@ -0,0 +1,72 @@
1From 15999e402dd7472cafe51be3fd0ce66433ca924b Mon Sep 17 00:00:00 2001
2From: Tudor Ambarus <tudor.ambarus@freescale.com>
3Date: Tue, 31 Mar 2015 16:16:28 +0300
4Subject: [PATCH 12/15] add support for TLSv1.2 record offload
5
6This adds support for composite algorithm offload in a single crypto
7(cipher + hmac) operation.
8
9Supported cipher suites:
10- 3des-ede-cbc-sha
11- aes-128-cbc-hmac-sha
12- aes-256-cbc-hmac-sha
13- aes-128-cbc-hmac-sha256
14- aes-256-cbc-hmac-sha256
15
16It requires either software or hardware TLS support in the Linux kernel
17and can be used with Freescale B*, P* and T* platforms that have support
18for hardware TLS acceleration.
19
20Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com>
21Change-Id: I21f45993505fc3dad09848a13aa20f778a7c2de0
22Reviewed-on: http://git.am.freescale.net:8181/33999
23Reviewed-by: Cristian Stoica <cristian.stoica@freescale.com>
24Tested-by: Cristian Stoica <cristian.stoica@freescale.com>
25---
26 crypto/cryptodev.h | 3 +++
27 ioctl.c | 15 +++++++++++++++
28 2 files changed, 18 insertions(+)
29
30diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h
31index 61e8599..f6058ca 100644
32--- a/crypto/cryptodev.h
33+++ b/crypto/cryptodev.h
34@@ -58,6 +58,9 @@ enum cryptodev_crypto_op_t {
35 CRYPTO_TLS10_AES_CBC_HMAC_SHA1,
36 CRYPTO_TLS11_3DES_CBC_HMAC_SHA1,
37 CRYPTO_TLS11_AES_CBC_HMAC_SHA1,
38+ CRYPTO_TLS12_3DES_CBC_HMAC_SHA1,
39+ CRYPTO_TLS12_AES_CBC_HMAC_SHA1,
40+ CRYPTO_TLS12_AES_CBC_HMAC_SHA256,
41 CRYPTO_ALGORITHM_ALL, /* Keep updated - see below */
42 };
43
44diff --git a/ioctl.c b/ioctl.c
45index ba82387..fb4c4e3 100644
46--- a/ioctl.c
47+++ b/ioctl.c
48@@ -206,6 +206,21 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
49 stream = 0;
50 aead = 1;
51 break;
52+ case CRYPTO_TLS12_3DES_CBC_HMAC_SHA1:
53+ alg_name = "tls12(hmac(sha1),cbc(des3_ede))";
54+ stream = 0;
55+ aead = 1;
56+ break;
57+ case CRYPTO_TLS12_AES_CBC_HMAC_SHA1:
58+ alg_name = "tls12(hmac(sha1),cbc(aes))";
59+ stream = 0;
60+ aead = 1;
61+ break;
62+ case CRYPTO_TLS12_AES_CBC_HMAC_SHA256:
63+ alg_name = "tls12(hmac(sha256),cbc(aes))";
64+ stream = 0;
65+ aead = 1;
66+ break;
67 case CRYPTO_NULL:
68 alg_name = "ecb(cipher_null)";
69 stream = 1;
70--
712.3.5
72
diff --git a/recipes-kernel/cryptodev/files/0013-clean-up-code-layout.patch b/recipes-kernel/cryptodev/files/0013-clean-up-code-layout.patch
new file mode 100644
index 0000000..86cf6a2
--- /dev/null
+++ b/recipes-kernel/cryptodev/files/0013-clean-up-code-layout.patch
@@ -0,0 +1,186 @@
1From 39abcb9cea60540528e848d6c66169c36d666861 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@freescale.com>
3Date: Fri, 20 Feb 2015 12:46:58 +0200
4Subject: [PATCH 13/15] clean-up code layout
5
6Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
7Change-Id: I92c2f4baeed9470a2c3c42b592d878e65918b0af
8Reviewed-on: http://git.am.freescale.net:8181/34222
9---
10 cryptlib.c | 11 ++++-------
11 ioctl.c | 55 +++++++++++++++++++++----------------------------------
12 main.c | 4 +---
13 3 files changed, 26 insertions(+), 44 deletions(-)
14
15diff --git a/cryptlib.c b/cryptlib.c
16index ec6693e..21e691b 100644
17--- a/cryptlib.c
18+++ b/cryptlib.c
19@@ -434,7 +434,7 @@ int cryptodev_hash_final(struct hash_data *hdata, void *output)
20 return waitfor(hdata->async.result, ret);
21 }
22
23-int cryptodev_pkc_offload(struct cryptodev_pkc *pkc)
24+int cryptodev_pkc_offload(struct cryptodev_pkc *pkc)
25 {
26 int ret = 0;
27 struct pkc_request *pkc_req = &pkc->req, *pkc_requested;
28@@ -445,8 +445,7 @@ int cryptodev_pkc_offload(struct cryptodev_pkc *pkc)
29 case RSA_PRIV_FORM1:
30 case RSA_PRIV_FORM2:
31 case RSA_PRIV_FORM3:
32- pkc->s = crypto_alloc_pkc("pkc(rsa)",
33- CRYPTO_ALG_TYPE_PKC_RSA, 0);
34+ pkc->s = crypto_alloc_pkc("pkc(rsa)", CRYPTO_ALG_TYPE_PKC_RSA, 0);
35 break;
36 case DSA_SIGN:
37 case DSA_VERIFY:
38@@ -454,13 +453,11 @@ int cryptodev_pkc_offload(struct cryptodev_pkc *pkc)
39 case ECDSA_VERIFY:
40 case DLC_KEYGEN:
41 case ECC_KEYGEN:
42- pkc->s = crypto_alloc_pkc("pkc(dsa)",
43- CRYPTO_ALG_TYPE_PKC_DSA, 0);
44+ pkc->s = crypto_alloc_pkc("pkc(dsa)", CRYPTO_ALG_TYPE_PKC_DSA, 0);
45 break;
46 case DH_COMPUTE_KEY:
47 case ECDH_COMPUTE_KEY:
48- pkc->s = crypto_alloc_pkc("pkc(dh)",
49- CRYPTO_ALG_TYPE_PKC_DH, 0);
50+ pkc->s = crypto_alloc_pkc("pkc(dh)", CRYPTO_ALG_TYPE_PKC_DH, 0);
51 break;
52 default:
53 return -EINVAL;
54diff --git a/ioctl.c b/ioctl.c
55index fb4c4e3..ee0486c 100644
56--- a/ioctl.c
57+++ b/ioctl.c
58@@ -714,16 +714,13 @@ static int crypto_async_fetch_asym(struct cryptodev_pkc *pkc)
59 case CRK_MOD_EXP:
60 {
61 struct rsa_pub_req_s *rsa_req = &pkc_req->req_u.rsa_pub_req;
62- copy_to_user(ckop->crk_param[3].crp_p, rsa_req->g,
63- rsa_req->g_len);
64+ copy_to_user(ckop->crk_param[3].crp_p, rsa_req->g, rsa_req->g_len);
65 }
66 break;
67 case CRK_MOD_EXP_CRT:
68 {
69- struct rsa_priv_frm3_req_s *rsa_req =
70- &pkc_req->req_u.rsa_priv_f3;
71- copy_to_user(ckop->crk_param[6].crp_p,
72- rsa_req->f, rsa_req->f_len);
73+ struct rsa_priv_frm3_req_s *rsa_req = &pkc_req->req_u.rsa_priv_f3;
74+ copy_to_user(ckop->crk_param[6].crp_p, rsa_req->f, rsa_req->f_len);
75 }
76 break;
77 case CRK_DSA_SIGN:
78@@ -731,15 +728,11 @@ static int crypto_async_fetch_asym(struct cryptodev_pkc *pkc)
79 struct dsa_sign_req_s *dsa_req = &pkc_req->req_u.dsa_sign;
80
81 if (pkc_req->type == ECDSA_SIGN) {
82- copy_to_user(ckop->crk_param[6].crp_p,
83- dsa_req->c, dsa_req->d_len);
84- copy_to_user(ckop->crk_param[7].crp_p,
85- dsa_req->d, dsa_req->d_len);
86+ copy_to_user(ckop->crk_param[6].crp_p, dsa_req->c, dsa_req->d_len);
87+ copy_to_user(ckop->crk_param[7].crp_p, dsa_req->d, dsa_req->d_len);
88 } else {
89- copy_to_user(ckop->crk_param[5].crp_p,
90- dsa_req->c, dsa_req->d_len);
91- copy_to_user(ckop->crk_param[6].crp_p,
92- dsa_req->d, dsa_req->d_len);
93+ copy_to_user(ckop->crk_param[5].crp_p, dsa_req->c, dsa_req->d_len);
94+ copy_to_user(ckop->crk_param[6].crp_p, dsa_req->d, dsa_req->d_len);
95 }
96 }
97 break;
98@@ -749,11 +742,9 @@ static int crypto_async_fetch_asym(struct cryptodev_pkc *pkc)
99 {
100 struct dh_key_req_s *dh_req = &pkc_req->req_u.dh_req;
101 if (pkc_req->type == ECDH_COMPUTE_KEY)
102- copy_to_user(ckop->crk_param[4].crp_p,
103- dh_req->z, dh_req->z_len);
104+ copy_to_user(ckop->crk_param[4].crp_p, dh_req->z, dh_req->z_len);
105 else
106- copy_to_user(ckop->crk_param[3].crp_p,
107- dh_req->z, dh_req->z_len);
108+ copy_to_user(ckop->crk_param[3].crp_p, dh_req->z, dh_req->z_len);
109 }
110 break;
111 case CRK_DSA_GENERATE_KEY:
112@@ -763,14 +754,14 @@ static int crypto_async_fetch_asym(struct cryptodev_pkc *pkc)
113
114 if (pkc_req->type == ECC_KEYGEN) {
115 copy_to_user(ckop->crk_param[4].crp_p, key_req->pub_key,
116- key_req->pub_key_len);
117- copy_to_user(ckop->crk_param[5].crp_p,
118- key_req->priv_key, key_req->priv_key_len);
119+ key_req->pub_key_len);
120+ copy_to_user(ckop->crk_param[5].crp_p, key_req->priv_key,
121+ key_req->priv_key_len);
122 } else {
123- copy_to_user(ckop->crk_param[3].crp_p,
124- key_req->pub_key, key_req->pub_key_len);
125- copy_to_user(ckop->crk_param[4].crp_p,
126- key_req->priv_key, key_req->priv_key_len);
127+ copy_to_user(ckop->crk_param[3].crp_p, key_req->pub_key,
128+ key_req->pub_key_len);
129+ copy_to_user(ckop->crk_param[4].crp_p, key_req->priv_key,
130+ key_req->priv_key_len);
131 }
132 }
133 default:
134@@ -1113,16 +1104,14 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
135 if (!list_empty(&pcr->asym_completed_list)) {
136 /* Run a loop in the list for upto elements
137 and copy their response back */
138- pkc =
139- list_first_entry(&pcr->asym_completed_list,
140+ pkc = list_first_entry(&pcr->asym_completed_list,
141 struct cryptodev_pkc, list);
142 list_del(&pkc->list);
143 spin_unlock_bh(&pcr->completion_lock);
144 ret = crypto_async_fetch_asym(pkc);
145 if (!ret) {
146 cookie_list.cookie_available++;
147- cookie_list.cookie[i] =
148- pkc->kop.kop.cookie;
149+ cookie_list.cookie[i] = pkc->kop.kop.cookie;
150 cookie_list.status[i] = pkc->result.err;
151 }
152 kfree(pkc);
153@@ -1133,12 +1122,10 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
154 }
155
156 /* Reflect the updated request to user-space */
157- if (cookie_list.cookie_available)
158- copy_to_user(arg, &cookie_list,
159- sizeof(struct pkc_cookie_list_s));
160- else {
161+ if (cookie_list.cookie_available) {
162+ copy_to_user(arg, &cookie_list, sizeof(struct pkc_cookie_list_s));
163+ } else {
164 struct pkc_cookie_list_s *user_ck_list = (void *)arg;
165-
166 put_user(0, &(user_ck_list->cookie_available));
167 }
168 ret = cookie_list.cookie_available;
169diff --git a/main.c b/main.c
170index 6365911..af66553 100644
171--- a/main.c
172+++ b/main.c
173@@ -666,9 +666,7 @@ int crypto_bn_modexp(struct cryptodev_pkc *pkc)
174 if (pkc->type == SYNCHRONOUS) {
175 if (rc)
176 goto err;
177-
178- copy_to_user(cop->crk_param[3].crp_p, rsa_req->g,
179- rsa_req->g_len);
180+ copy_to_user(cop->crk_param[3].crp_p, rsa_req->g, rsa_req->g_len);
181 } else {
182 if (rc != -EINPROGRESS && rc != 0)
183 goto err;
184--
1852.3.5
186
diff --git a/recipes-kernel/cryptodev/files/0014-remove-redundant-data-copy-for-pkc-operations.patch b/recipes-kernel/cryptodev/files/0014-remove-redundant-data-copy-for-pkc-operations.patch
new file mode 100644
index 0000000..b9e9d2b
--- /dev/null
+++ b/recipes-kernel/cryptodev/files/0014-remove-redundant-data-copy-for-pkc-operations.patch
@@ -0,0 +1,494 @@
1From 34e765977633b5f81845c0183af6d388d8225f00 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@freescale.com>
3Date: Mon, 23 Feb 2015 12:14:07 +0200
4Subject: [PATCH 14/15] remove redundant data copy for pkc operations
5
6This patch removes a copy of a pkc request that was
7allocated on the hot-path. The copy was not necessary
8and was just slowing things down.
9
10Change-Id: I3ad85f78c188f100ab9fc03a5777bb704a9dcb63
11Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
12Reviewed-on: http://git.am.freescale.net:8181/34223
13---
14 cryptlib.c | 49 +++----------------
15 cryptlib.h | 3 +-
16 ioctl.c | 17 +++----
17 main.c | 162 +++++++++++++++++++++++++++++++++++++------------------------
18 4 files changed, 113 insertions(+), 118 deletions(-)
19
20diff --git a/cryptlib.c b/cryptlib.c
21index 21e691b..5882a30 100644
22--- a/cryptlib.c
23+++ b/cryptlib.c
24@@ -436,59 +436,22 @@ int cryptodev_hash_final(struct hash_data *hdata, void *output)
25
26 int cryptodev_pkc_offload(struct cryptodev_pkc *pkc)
27 {
28- int ret = 0;
29- struct pkc_request *pkc_req = &pkc->req, *pkc_requested;
30-
31- switch (pkc_req->type) {
32- case RSA_KEYGEN:
33- case RSA_PUB:
34- case RSA_PRIV_FORM1:
35- case RSA_PRIV_FORM2:
36- case RSA_PRIV_FORM3:
37- pkc->s = crypto_alloc_pkc("pkc(rsa)", CRYPTO_ALG_TYPE_PKC_RSA, 0);
38- break;
39- case DSA_SIGN:
40- case DSA_VERIFY:
41- case ECDSA_SIGN:
42- case ECDSA_VERIFY:
43- case DLC_KEYGEN:
44- case ECC_KEYGEN:
45- pkc->s = crypto_alloc_pkc("pkc(dsa)", CRYPTO_ALG_TYPE_PKC_DSA, 0);
46- break;
47- case DH_COMPUTE_KEY:
48- case ECDH_COMPUTE_KEY:
49- pkc->s = crypto_alloc_pkc("pkc(dh)", CRYPTO_ALG_TYPE_PKC_DH, 0);
50- break;
51- default:
52- return -EINVAL;
53- }
54-
55- if (IS_ERR_OR_NULL(pkc->s))
56- return -EINVAL;
57+ int ret;
58
59 init_completion(&pkc->result.completion);
60- pkc_requested = pkc_request_alloc(pkc->s, GFP_KERNEL);
61-
62- if (unlikely(IS_ERR_OR_NULL(pkc_requested))) {
63- ret = -ENOMEM;
64- goto error;
65- }
66- pkc_requested->type = pkc_req->type;
67- pkc_requested->curve_type = pkc_req->curve_type;
68- memcpy(&pkc_requested->req_u, &pkc_req->req_u, sizeof(pkc_req->req_u));
69- pkc_request_set_callback(pkc_requested, CRYPTO_TFM_REQ_MAY_BACKLOG,
70+ pkc_request_set_callback(pkc->req, CRYPTO_TFM_REQ_MAY_BACKLOG,
71 cryptodev_complete_asym, pkc);
72- ret = crypto_pkc_op(pkc_requested);
73+ ret = crypto_pkc_op(pkc->req);
74 if (ret != -EINPROGRESS && ret != 0)
75- goto error2;
76+ goto error;
77
78 if (pkc->type == SYNCHRONOUS)
79 ret = waitfor(&pkc->result, ret);
80
81 return ret;
82-error2:
83- kfree(pkc_requested);
84+
85 error:
86+ kfree(pkc->req);
87 crypto_free_pkc(pkc->s);
88 return ret;
89 }
90diff --git a/cryptlib.h b/cryptlib.h
91index 7ffa54c..4fac0c8 100644
92--- a/cryptlib.h
93+++ b/cryptlib.h
94@@ -110,8 +110,7 @@ struct cryptodev_pkc {
95 struct crypto_pkc *s; /* Transform pointer from CryptoAPI */
96 struct cryptodev_result result; /* Result to be updated by
97 completion handler */
98- struct pkc_request req; /* PKC request structure allocated
99- from CryptoAPI */
100+ struct pkc_request *req; /* PKC request allocated from CryptoAPI */
101 enum offload_type type; /* Synchronous Vs Asynchronous request */
102 /*
103 * cookie used for transfering tranparent information from async
104diff --git a/ioctl.c b/ioctl.c
105index ee0486c..797b73c 100644
106--- a/ioctl.c
107+++ b/ioctl.c
108@@ -708,26 +708,25 @@ static int crypto_async_fetch_asym(struct cryptodev_pkc *pkc)
109 int ret = 0;
110 struct kernel_crypt_kop *kop = &pkc->kop;
111 struct crypt_kop *ckop = &kop->kop;
112- struct pkc_request *pkc_req = &pkc->req;
113
114 switch (ckop->crk_op) {
115 case CRK_MOD_EXP:
116 {
117- struct rsa_pub_req_s *rsa_req = &pkc_req->req_u.rsa_pub_req;
118+ struct rsa_pub_req_s *rsa_req = &pkc->req->req_u.rsa_pub_req;
119 copy_to_user(ckop->crk_param[3].crp_p, rsa_req->g, rsa_req->g_len);
120 }
121 break;
122 case CRK_MOD_EXP_CRT:
123 {
124- struct rsa_priv_frm3_req_s *rsa_req = &pkc_req->req_u.rsa_priv_f3;
125+ struct rsa_priv_frm3_req_s *rsa_req = &pkc->req->req_u.rsa_priv_f3;
126 copy_to_user(ckop->crk_param[6].crp_p, rsa_req->f, rsa_req->f_len);
127 }
128 break;
129 case CRK_DSA_SIGN:
130 {
131- struct dsa_sign_req_s *dsa_req = &pkc_req->req_u.dsa_sign;
132+ struct dsa_sign_req_s *dsa_req = &pkc->req->req_u.dsa_sign;
133
134- if (pkc_req->type == ECDSA_SIGN) {
135+ if (pkc->req->type == ECDSA_SIGN) {
136 copy_to_user(ckop->crk_param[6].crp_p, dsa_req->c, dsa_req->d_len);
137 copy_to_user(ckop->crk_param[7].crp_p, dsa_req->d, dsa_req->d_len);
138 } else {
139@@ -740,8 +739,8 @@ static int crypto_async_fetch_asym(struct cryptodev_pkc *pkc)
140 break;
141 case CRK_DH_COMPUTE_KEY:
142 {
143- struct dh_key_req_s *dh_req = &pkc_req->req_u.dh_req;
144- if (pkc_req->type == ECDH_COMPUTE_KEY)
145+ struct dh_key_req_s *dh_req = &pkc->req->req_u.dh_req;
146+ if (pkc->req->type == ECDH_COMPUTE_KEY)
147 copy_to_user(ckop->crk_param[4].crp_p, dh_req->z, dh_req->z_len);
148 else
149 copy_to_user(ckop->crk_param[3].crp_p, dh_req->z, dh_req->z_len);
150@@ -750,9 +749,9 @@ static int crypto_async_fetch_asym(struct cryptodev_pkc *pkc)
151 case CRK_DSA_GENERATE_KEY:
152 case CRK_DH_GENERATE_KEY:
153 {
154- struct keygen_req_s *key_req = &pkc_req->req_u.keygen;
155+ struct keygen_req_s *key_req = &pkc->req->req_u.keygen;
156
157- if (pkc_req->type == ECC_KEYGEN) {
158+ if (pkc->req->type == ECC_KEYGEN) {
159 copy_to_user(ckop->crk_param[4].crp_p, key_req->pub_key,
160 key_req->pub_key_len);
161 copy_to_user(ckop->crk_param[5].crp_p, key_req->priv_key,
162diff --git a/main.c b/main.c
163index af66553..ed1c69a 100644
164--- a/main.c
165+++ b/main.c
166@@ -186,8 +186,7 @@ int crypto_kop_dsasign(struct cryptodev_pkc *pkc)
167 {
168 struct kernel_crypt_kop *kop = &pkc->kop;
169 struct crypt_kop *cop = &kop->kop;
170- struct pkc_request *pkc_req = &pkc->req;
171- struct dsa_sign_req_s *dsa_req = &pkc_req->req_u.dsa_sign;
172+ struct dsa_sign_req_s *dsa_req = &pkc->req->req_u.dsa_sign;
173 int rc, buf_size;
174 uint8_t *buf;
175
176@@ -210,10 +209,7 @@ int crypto_kop_dsasign(struct cryptodev_pkc *pkc)
177 if (cop->crk_iparams == 6) {
178 dsa_req->ab_len = (cop->crk_param[5].crp_nbits + 7)/8;
179 buf_size += dsa_req->ab_len;
180- pkc_req->type = ECDSA_SIGN;
181- pkc_req->curve_type = cop->curve_type;
182- } else {
183- pkc_req->type = DSA_SIGN;
184+ pkc->req->curve_type = cop->curve_type;
185 }
186
187 buf = kmalloc(buf_size, GFP_DMA);
188@@ -269,7 +265,6 @@ int crypto_kop_dsaverify(struct cryptodev_pkc *pkc)
189 {
190 struct kernel_crypt_kop *kop = &pkc->kop;
191 struct crypt_kop *cop = &kop->kop;
192- struct pkc_request *pkc_req;
193 struct dsa_verify_req_s *dsa_req;
194 int rc, buf_size;
195 uint8_t *buf;
196@@ -281,8 +276,7 @@ int crypto_kop_dsaverify(struct cryptodev_pkc *pkc)
197 !cop->crk_param[7].crp_nbits))
198 return -EINVAL;
199
200- pkc_req = &pkc->req;
201- dsa_req = &pkc_req->req_u.dsa_verify;
202+ dsa_req = &pkc->req->req_u.dsa_verify;
203 dsa_req->m_len = (cop->crk_param[0].crp_nbits + 7)/8;
204 dsa_req->q_len = (cop->crk_param[1].crp_nbits + 7)/8;
205 dsa_req->r_len = (cop->crk_param[2].crp_nbits + 7)/8;
206@@ -295,10 +289,7 @@ int crypto_kop_dsaverify(struct cryptodev_pkc *pkc)
207 if (cop->crk_iparams == 8) {
208 dsa_req->ab_len = (cop->crk_param[5].crp_nbits + 7)/8;
209 buf_size += dsa_req->ab_len;
210- pkc_req->type = ECDSA_VERIFY;
211- pkc_req->curve_type = cop->curve_type;
212- } else {
213- pkc_req->type = DSA_VERIFY;
214+ pkc->req->curve_type = cop->curve_type;
215 }
216
217 buf = kmalloc(buf_size, GFP_DMA);
218@@ -351,7 +342,6 @@ int crypto_kop_rsa_keygen(struct cryptodev_pkc *pkc)
219 {
220 struct kernel_crypt_kop *kop = &pkc->kop;
221 struct crypt_kop *cop = &kop->kop;
222- struct pkc_request *pkc_req;
223 struct rsa_keygen_req_s *key_req;
224 int rc, buf_size;
225 uint8_t *buf;
226@@ -362,9 +352,7 @@ int crypto_kop_rsa_keygen(struct cryptodev_pkc *pkc)
227 !cop->crk_param[6].crp_nbits)
228 return -EINVAL;
229
230- pkc_req = &pkc->req;
231- pkc_req->type = RSA_KEYGEN;
232- key_req = &pkc_req->req_u.rsa_keygen;
233+ key_req = &pkc->req->req_u.rsa_keygen;
234 key_req->n_len = (cop->crk_param[2].crp_nbits + 7)/8;
235 key_req->p_len = (cop->crk_param[0].crp_nbits + 7) / 8;
236 key_req->q_len = (cop->crk_param[1].crp_nbits + 7) / 8;
237@@ -427,7 +415,6 @@ int crypto_kop_keygen(struct cryptodev_pkc *pkc)
238 {
239 struct kernel_crypt_kop *kop = &pkc->kop;
240 struct crypt_kop *cop = &kop->kop;
241- struct pkc_request *pkc_req;
242 struct keygen_req_s *key_req;
243 int rc, buf_size;
244 uint8_t *buf;
245@@ -437,8 +424,7 @@ int crypto_kop_keygen(struct cryptodev_pkc *pkc)
246 !cop->crk_param[4].crp_nbits)
247 return -EINVAL;
248
249- pkc_req = &pkc->req;
250- key_req = &pkc_req->req_u.keygen;
251+ key_req = &pkc->req->req_u.keygen;
252 key_req->q_len = (cop->crk_param[0].crp_nbits + 7)/8;
253 key_req->r_len = (cop->crk_param[1].crp_nbits + 7)/8;
254 key_req->g_len = (cop->crk_param[2].crp_nbits + 7)/8;
255@@ -447,7 +433,6 @@ int crypto_kop_keygen(struct cryptodev_pkc *pkc)
256 key_req->priv_key_len = (cop->crk_param[4].crp_nbits + 7)/8;
257 buf_size = key_req->q_len + key_req->r_len + key_req->g_len +
258 key_req->pub_key_len + key_req->priv_key_len;
259- pkc_req->type = DLC_KEYGEN;
260 } else {
261 key_req->ab_len = (cop->crk_param[3].crp_nbits + 7)/8;
262 key_req->pub_key_len = (cop->crk_param[4].crp_nbits + 7)/8;
263@@ -455,8 +440,7 @@ int crypto_kop_keygen(struct cryptodev_pkc *pkc)
264 buf_size = key_req->q_len + key_req->r_len + key_req->g_len +
265 key_req->pub_key_len + key_req->priv_key_len +
266 key_req->ab_len;
267- pkc_req->type = ECC_KEYGEN;
268- pkc_req->curve_type = cop->curve_type;
269+ pkc->req->curve_type = cop->curve_type;
270 }
271
272 buf = kmalloc(buf_size, GFP_DMA);
273@@ -508,26 +492,22 @@ int crypto_kop_dh_key(struct cryptodev_pkc *pkc)
274 {
275 struct kernel_crypt_kop *kop = &pkc->kop;
276 struct crypt_kop *cop = &kop->kop;
277- struct pkc_request *pkc_req;
278 struct dh_key_req_s *dh_req;
279 int buf_size;
280 uint8_t *buf;
281 int rc = -EINVAL;
282
283- pkc_req = &pkc->req;
284- dh_req = &pkc_req->req_u.dh_req;
285+ dh_req = &pkc->req->req_u.dh_req;
286 dh_req->s_len = (cop->crk_param[0].crp_nbits + 7)/8;
287 dh_req->pub_key_len = (cop->crk_param[1].crp_nbits + 7)/8;
288 dh_req->q_len = (cop->crk_param[2].crp_nbits + 7)/8;
289 buf_size = dh_req->q_len + dh_req->pub_key_len + dh_req->s_len;
290 if (cop->crk_iparams == 4) {
291- pkc_req->type = ECDH_COMPUTE_KEY;
292 dh_req->ab_len = (cop->crk_param[3].crp_nbits + 7)/8;
293 dh_req->z_len = (cop->crk_param[4].crp_nbits + 7)/8;
294 buf_size += dh_req->ab_len;
295 } else {
296 dh_req->z_len = (cop->crk_param[3].crp_nbits + 7)/8;
297- pkc_req->type = DH_COMPUTE_KEY;
298 }
299 buf_size += dh_req->z_len;
300 buf = kmalloc(buf_size, GFP_DMA);
301@@ -539,7 +519,7 @@ int crypto_kop_dh_key(struct cryptodev_pkc *pkc)
302 dh_req->z = dh_req->pub_key + dh_req->pub_key_len;
303 if (cop->crk_iparams == 4) {
304 dh_req->ab = dh_req->z + dh_req->z_len;
305- pkc_req->curve_type = cop->curve_type;
306+ pkc->req->curve_type = cop->curve_type;
307 copy_from_user(dh_req->ab, cop->crk_param[3].crp_p,
308 dh_req->ab_len);
309 }
310@@ -573,7 +553,6 @@ int crypto_modexp_crt(struct cryptodev_pkc *pkc)
311 {
312 struct kernel_crypt_kop *kop = &pkc->kop;
313 struct crypt_kop *cop = &kop->kop;
314- struct pkc_request *pkc_req;
315 struct rsa_priv_frm3_req_s *rsa_req;
316 int rc;
317 uint8_t *buf;
318@@ -583,9 +562,7 @@ int crypto_modexp_crt(struct cryptodev_pkc *pkc)
319 !cop->crk_param[4].crp_nbits || !cop->crk_param[5].crp_nbits)
320 return -EINVAL;
321
322- pkc_req = &pkc->req;
323- pkc_req->type = RSA_PRIV_FORM3;
324- rsa_req = &pkc_req->req_u.rsa_priv_f3;
325+ rsa_req = &pkc->req->req_u.rsa_priv_f3;
326 rsa_req->p_len = (cop->crk_param[0].crp_nbits + 7)/8;
327 rsa_req->q_len = (cop->crk_param[1].crp_nbits + 7)/8;
328 rsa_req->g_len = (cop->crk_param[2].crp_nbits + 7)/8;
329@@ -632,7 +609,6 @@ err:
330
331 int crypto_bn_modexp(struct cryptodev_pkc *pkc)
332 {
333- struct pkc_request *pkc_req;
334 struct rsa_pub_req_s *rsa_req;
335 int rc;
336 struct kernel_crypt_kop *kop = &pkc->kop;
337@@ -643,9 +619,7 @@ int crypto_bn_modexp(struct cryptodev_pkc *pkc)
338 !cop->crk_param[2].crp_nbits || !cop->crk_param[3].crp_nbits)
339 return -EINVAL;
340
341- pkc_req = &pkc->req;
342- pkc_req->type = RSA_PUB;
343- rsa_req = &pkc_req->req_u.rsa_pub_req;
344+ rsa_req = &pkc->req->req_u.rsa_pub_req;
345 rsa_req->f_len = (cop->crk_param[0].crp_nbits + 7)/8;
346 rsa_req->e_len = (cop->crk_param[1].crp_nbits + 7)/8;
347 rsa_req->n_len = (cop->crk_param[2].crp_nbits + 7)/8;
348@@ -680,56 +654,116 @@ err:
349 return rc;
350 }
351
352+static struct {
353+ char *alg_name;
354+ u32 type;
355+ u32 mask;
356+} pkc_alg_list[] = {
357+ {"pkc(rsa)", CRYPTO_ALG_TYPE_PKC_RSA, 0},
358+ {"pkc(dsa)", CRYPTO_ALG_TYPE_PKC_DSA, 0},
359+ {"pkc(dh)", CRYPTO_ALG_TYPE_PKC_DH, 0},
360+};
361+
362 int crypto_run_asym(struct cryptodev_pkc *pkc)
363 {
364- int ret = -EINVAL;
365+ int err = -EINVAL;
366+ int id;
367 struct kernel_crypt_kop *kop = &pkc->kop;
368+ enum pkc_req_type pkc_req_type;
369+ int (*call_next_action)(struct cryptodev_pkc *pkc);
370
371 switch (kop->kop.crk_op) {
372 case CRK_MOD_EXP:
373 if (kop->kop.crk_iparams != 3 && kop->kop.crk_oparams != 1)
374- goto err;
375-
376- ret = crypto_bn_modexp(pkc);
377+ return err;
378+ pkc_req_type = RSA_PUB;
379+ id = 0;
380+ call_next_action = crypto_bn_modexp;
381 break;
382 case CRK_MOD_EXP_CRT:
383 if (kop->kop.crk_iparams != 6 && kop->kop.crk_oparams != 1)
384- goto err;
385-
386- ret = crypto_modexp_crt(pkc);
387+ return err;
388+ pkc_req_type = RSA_PRIV_FORM3;
389+ id = 0;
390+ call_next_action = crypto_modexp_crt;
391 break;
392 case CRK_DSA_SIGN:
393- if ((kop->kop.crk_iparams != 5 && kop->kop.crk_iparams != 6) ||
394- kop->kop.crk_oparams != 2)
395- goto err;
396-
397- ret = crypto_kop_dsasign(pkc);
398+ if (kop->kop.crk_oparams != 2)
399+ return err;
400+ else if (kop->kop.crk_iparams == 5)
401+ pkc_req_type = DSA_SIGN;
402+ else if (kop->kop.crk_iparams == 6)
403+ pkc_req_type = ECDSA_SIGN;
404+ else
405+ return err;
406+ id = 1;
407+ call_next_action = crypto_kop_dsasign;
408 break;
409 case CRK_DSA_VERIFY:
410- if ((kop->kop.crk_iparams != 7 && kop->kop.crk_iparams != 8) ||
411- kop->kop.crk_oparams != 0)
412- goto err;
413-
414- ret = crypto_kop_dsaverify(pkc);
415+ if (kop->kop.crk_oparams != 0)
416+ return err;
417+ else if (kop->kop.crk_iparams == 7)
418+ pkc_req_type = DSA_VERIFY;
419+ else if (kop->kop.crk_iparams == 8)
420+ pkc_req_type = ECDSA_VERIFY;
421+ else
422+ return err;
423+ id = 1;
424+ call_next_action = crypto_kop_dsaverify;
425 break;
426 case CRK_DH_COMPUTE_KEY:
427- if ((kop->kop.crk_iparams != 3 && kop->kop.crk_iparams != 4) ||
428- kop->kop.crk_oparams != 1)
429- goto err;
430- ret = crypto_kop_dh_key(pkc);
431+ if (kop->kop.crk_oparams != 1)
432+ return err;
433+ else if (kop->kop.crk_iparams == 3)
434+ pkc_req_type = DH_COMPUTE_KEY;
435+ else if (kop->kop.crk_iparams == 4)
436+ pkc_req_type = ECDH_COMPUTE_KEY;
437+ else
438+ return err;
439+ id = 2;
440+ call_next_action = crypto_kop_dh_key;
441 break;
442 case CRK_DH_GENERATE_KEY:
443 case CRK_DSA_GENERATE_KEY:
444- if ((kop->kop.crk_iparams != 3 && kop->kop.crk_iparams != 4))
445- goto err;
446- ret = crypto_kop_keygen(pkc);
447+ if (kop->kop.crk_iparams == 3)
448+ pkc_req_type = DLC_KEYGEN;
449+ else if (kop->kop.crk_iparams == 4)
450+ pkc_req_type = ECC_KEYGEN;
451+ else
452+ return err;
453+ id = 1;
454+ call_next_action = crypto_kop_keygen;
455 break;
456 case CRK_RSA_GENERATE_KEY:
457- ret = crypto_kop_rsa_keygen(pkc);
458+ pkc_req_type = RSA_KEYGEN;
459+ id = 0;
460+ call_next_action = crypto_kop_rsa_keygen;
461 break;
462+ default:
463+ return err;
464 }
465-err:
466- return ret;
467+ err = -ENOMEM;
468+ pkc->s = crypto_alloc_pkc(pkc_alg_list[id].alg_name,
469+ pkc_alg_list[id].type,
470+ pkc_alg_list[id].mask);
471+ if (IS_ERR_OR_NULL(pkc->s))
472+ return err;
473+
474+ pkc->req = pkc_request_alloc(pkc->s, GFP_KERNEL);
475+ if (IS_ERR_OR_NULL(pkc->req))
476+ goto out_free_tfm;
477+
478+ /* todo - fix alloc-free on error path */
479+ pkc->req->type = pkc_req_type;
480+ err = call_next_action(pkc);
481+ if (pkc->type == SYNCHRONOUS)
482+ kfree(pkc->req);
483+
484+ return err;
485+
486+out_free_tfm:
487+ crypto_free_pkc(pkc->s);
488+ return err;
489 }
490
491 int crypto_run(struct fcrypt *fcr, struct kernel_crypt_op *kcop)
492--
4932.3.5
494
diff --git a/recipes-kernel/cryptodev/files/0015-fix-pkc-request-deallocation.patch b/recipes-kernel/cryptodev/files/0015-fix-pkc-request-deallocation.patch
new file mode 100644
index 0000000..949fe12
--- /dev/null
+++ b/recipes-kernel/cryptodev/files/0015-fix-pkc-request-deallocation.patch
@@ -0,0 +1,40 @@
1From 8361f99c940fbe270fca2112dae3d97c9a5776d6 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@freescale.com>
3Date: Mon, 23 Feb 2015 15:28:22 +0200
4Subject: [PATCH 15/15] fix pkc request deallocation
5
6The request to be freed is actually pkc->req, and should be done inside
7the fetch ioctl for ASYNC (this patch) and in crypt ioctl for SYNC
8operations.
9
10Change-Id: I6f046f2ebeae4cb513a419996ca96b52e37468ed
11Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
12Reviewed-on: http://git.am.freescale.net:8181/34224
13---
14 ioctl.c | 3 +--
15 1 file changed, 1 insertion(+), 2 deletions(-)
16
17diff --git a/ioctl.c b/ioctl.c
18index 797b73c..da3a842 100644
19--- a/ioctl.c
20+++ b/ioctl.c
21@@ -114,8 +114,6 @@ void cryptodev_complete_asym(struct crypto_async_request *req, int err)
22 /* wake for POLLIN */
23 wake_up_interruptible(&pcr->user_waiter);
24 }
25-
26- kfree(req);
27 }
28
29 #define FILL_SG(sg, ptr, len) \
30@@ -1113,6 +1111,7 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
31 cookie_list.cookie[i] = pkc->kop.kop.cookie;
32 cookie_list.status[i] = pkc->result.err;
33 }
34+ kfree(pkc->req);
35 kfree(pkc);
36 } else {
37 spin_unlock_bh(&pcr->completion_lock);
38--
392.3.5
40
diff --git a/recipes-kernel/cryptodev/files/0016-add-basic-detection-of-asym-features.patch b/recipes-kernel/cryptodev/files/0016-add-basic-detection-of-asym-features.patch
new file mode 100644
index 0000000..cefb6dc
--- /dev/null
+++ b/recipes-kernel/cryptodev/files/0016-add-basic-detection-of-asym-features.patch
@@ -0,0 +1,37 @@
1From 586bc4a6cd1014c57364020013062f07a8861e38 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@freescale.com>
3Date: Mon, 20 Apr 2015 13:18:47 +0300
4Subject: [PATCH] add basic detection of asym features
5
6Change-Id: I3b3ba8664bf631a63be1f11e715024509e20f841
7Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
8---
9 ioctl.c | 12 ++++++++----
10 1 file changed, 8 insertions(+), 4 deletions(-)
11
12diff --git a/ioctl.c b/ioctl.c
13index da3a842..53dbf64 100644
14--- a/ioctl.c
15+++ b/ioctl.c
16@@ -977,10 +977,14 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
17
18 switch (cmd) {
19 case CIOCASYMFEAT:
20- return put_user(CRF_MOD_EXP_CRT | CRF_MOD_EXP | CRF_DSA_SIGN |
21- CRF_DSA_VERIFY | CRF_DH_COMPUTE_KEY |
22- CRF_DSA_GENERATE_KEY | CRF_DH_GENERATE_KEY |
23- CRF_RSA_GENERATE_KEY, p);
24+ ses = 0;
25+ if (crypto_has_alg("pkc(rsa)", 0, 0))
26+ ses = CRF_MOD_EXP_CRT | CRF_MOD_EXP | CRF_RSA_GENERATE_KEY;
27+ if (crypto_has_alg("pkc(dsa)", 0, 0))
28+ ses |= CRF_DSA_SIGN | CRF_DSA_VERIFY | CRF_DSA_GENERATE_KEY;
29+ if (crypto_has_alg("pkc(dh)", 0, 0))
30+ ses |= CRF_DH_COMPUTE_KEY |CRF_DH_GENERATE_KEY;
31+ return put_user(ses, p);
32 case CRIOGET:
33 fd = clonefd(filp);
34 ret = put_user(fd, p);
35--
362.3.5
37
diff --git a/recipes-kernel/cryptodev/files/0017-remove-dead-code.patch b/recipes-kernel/cryptodev/files/0017-remove-dead-code.patch
new file mode 100644
index 0000000..b3c36b3
--- /dev/null
+++ b/recipes-kernel/cryptodev/files/0017-remove-dead-code.patch
@@ -0,0 +1,67 @@
1From 0ca641091b4113d73e75d30ef530c88836849308 Mon Sep 17 00:00:00 2001
2From: Tudor Ambarus <tudor.ambarus@freescale.com>
3Date: Fri, 29 May 2015 15:28:47 +0300
4Subject: [PATCH 17/20] remove dead code
5
6Functions kop_to_user and compat_kop_to_user are never used. Delete them
7to avoid compiler warnings.
8
9
10crypto/../../cryptodev-linux/ioctl.c:841:12: warning: 'kop_to_user' defined but not used [-Wunused-function]
11 static int kop_to_user(struct kernel_crypt_kop *kop,
12 ^
13crypto/../../cryptodev-linux/ioctl.c: At top level:
14crypto/../../cryptodev-linux/ioctl.c:1195:12: warning: 'compat_kop_to_user' defined but not used [-Wunused-function]
15 static int compat_kop_to_user(struct kernel_crypt_kop *kop, void __user *arg)
16 ^
17Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com>
18Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
19Change-Id: I6bd8a7eb6144224a20cd400813ab15a7a192dbb1
20Reviewed-on: http://git.am.freescale.net:8181/37440
21---
22 ioctl.c | 22 ----------------------
23 1 file changed, 22 deletions(-)
24
25diff --git a/ioctl.c b/ioctl.c
26index 53dbf64..39635a4 100644
27--- a/ioctl.c
28+++ b/ioctl.c
29@@ -838,16 +838,6 @@ static int kop_from_user(struct kernel_crypt_kop *kop,
30 return fill_kop_from_cop(kop);
31 }
32
33-static int kop_to_user(struct kernel_crypt_kop *kop,
34- void __user *arg)
35-{
36- if (unlikely(copy_to_user(arg, &kop->kop, sizeof(kop->kop)))) {
37- dprintk(1, KERN_ERR, "Cannot copy to userspace\n");
38- return -EFAULT;
39- }
40- return 0;
41-}
42-
43 static int kcop_from_user(struct kernel_crypt_op *kcop,
44 struct fcrypt *fcr, void __user *arg)
45 {
46@@ -1192,18 +1182,6 @@ static inline void crypt_kop_to_compat(struct crypt_kop *kop,
47 compat->curve_type = kop->curve_type;
48 }
49
50-static int compat_kop_to_user(struct kernel_crypt_kop *kop, void __user *arg)
51-{
52- struct compat_crypt_kop compat_kop;
53-
54- crypt_kop_to_compat(&kop->kop, &compat_kop);
55- if (unlikely(copy_to_user(arg, &compat_kop, sizeof(compat_kop)))) {
56- dprintk(1, KERN_ERR, "Cannot copy to userspace\n");
57- return -EFAULT;
58- }
59- return 0;
60-}
61-
62 static inline void
63 compat_to_session_op(struct compat_session_op *compat, struct session_op *sop)
64 {
65--
662.3.5
67
diff --git a/recipes-kernel/cryptodev/files/0018-fix-compat-warnings.patch b/recipes-kernel/cryptodev/files/0018-fix-compat-warnings.patch
new file mode 100644
index 0000000..bf93f5b
--- /dev/null
+++ b/recipes-kernel/cryptodev/files/0018-fix-compat-warnings.patch
@@ -0,0 +1,64 @@
1From 596378a22532908487f2c5e4d717c5ae618c4c7d Mon Sep 17 00:00:00 2001
2From: Tudor Ambarus <tudor.ambarus@freescale.com>
3Date: Tue, 2 Jun 2015 10:44:12 +0300
4Subject: [PATCH 18/20] fix compat warnings
5
6 CC [M] crypto/../../cryptodev-linux/ioctl.o
7crypto/../../cryptodev-linux/ioctl.c: In function 'compat_to_crypt_kop':
8crypto/../../cryptodev-linux/ioctl.c:1161:14: warning: assignment makes pointer from integer without a cast
9 kop->cookie = compat->cookie;
10 ^
11crypto/../../cryptodev-linux/ioctl.c: In function 'crypt_kop_to_compat':
12crypto/../../cryptodev-linux/ioctl.c:1191:17: warning: assignment makes integer from pointer without a cast
13 compat->cookie = kop->cookie;
14 ^
15crypto/../../cryptodev-linux/ioctl.c: In function 'cryptodev_compat_ioctl':
16crypto/../../cryptodev-linux/ioctl.c:1430:28: warning: assignment makes integer from pointer without a cast
17 cookie_list.cookie[i] =
18 ^
19
20Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com>
21Change-Id: Id851408c0c743c01447f3b0ced38fbc1ae94d4db
22Reviewed-on: http://git.am.freescale.net:8181/37442
23Reviewed-by: Cristian Stoica <cristian.stoica@freescale.com>
24Tested-by: Cristian Stoica <cristian.stoica@freescale.com>
25---
26 ioctl.c | 8 ++++----
27 1 file changed, 4 insertions(+), 4 deletions(-)
28
29diff --git a/ioctl.c b/ioctl.c
30index 39635a4..f3ce2f6 100644
31--- a/ioctl.c
32+++ b/ioctl.c
33@@ -1148,7 +1148,7 @@ static inline void compat_to_crypt_kop(struct compat_crypt_kop *compat,
34 }
35
36 kop->curve_type = compat->curve_type;
37- kop->cookie = compat->cookie;
38+ kop->cookie = compat_ptr(compat->cookie);
39 }
40
41 static int compat_kop_from_user(struct kernel_crypt_kop *kop,
42@@ -1178,7 +1178,7 @@ static inline void crypt_kop_to_compat(struct crypt_kop *kop,
43 ptr_to_compat(kop->crk_param[i].crp_p);
44 compat->crk_param[i].crp_nbits = kop->crk_param[i].crp_nbits;
45 }
46- compat->cookie = kop->cookie;
47+ compat->cookie = ptr_to_compat(kop->cookie);
48 compat->curve_type = kop->curve_type;
49 }
50
51@@ -1405,8 +1405,8 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_)
52 ret = crypto_async_fetch_asym(pkc);
53 if (!ret) {
54 cookie_list.cookie_available++;
55- cookie_list.cookie[i] =
56- pkc->kop.kop.cookie;
57+ cookie_list.cookie[i] = ptr_to_compat(
58+ pkc->kop.kop.cookie);
59 }
60 kfree(pkc);
61 } else {
62--
632.3.5
64
diff --git a/recipes-kernel/cryptodev/files/0019-fix-size_t-print-format.patch b/recipes-kernel/cryptodev/files/0019-fix-size_t-print-format.patch
new file mode 100644
index 0000000..a71cff4
--- /dev/null
+++ b/recipes-kernel/cryptodev/files/0019-fix-size_t-print-format.patch
@@ -0,0 +1,61 @@
1From 1d10f06bef0f07980a08b387850c1daf1d3a8e87 Mon Sep 17 00:00:00 2001
2From: Tudor Ambarus <tudor.ambarus@freescale.com>
3Date: Tue, 2 Jun 2015 12:11:12 +0300
4Subject: [PATCH 19/20] fix size_t print format
5
6 CC [M] crypto/../../cryptodev-linux/cryptlib.o
7crypto/../../cryptodev-linux/cryptlib.c: In function 'cryptodev_cipher_init':
8crypto/../../cryptodev-linux/cryptlib.c:146:5: warning: format '%u' expects argument of type 'unsigned int', but argument 6 has type 'size_t' [-Wformat=]
9 ddebug(1, "Wrong keylen '%u' for algorithm '%s'. Use %u to %u.",
10 ^
11crypto/../../cryptodev-linux/cryptlib.c:173:3: warning: format '%u' expects argument of type 'unsigned int', but argument 7 has type 'size_t' [-Wformat=]
12 ddebug(1, "Setting key failed for %s-%u.", alg_name, keylen*8);
13 ^
14crypto/../../cryptodev-linux/cryptlib.c: In function 'cryptodev_hash_init':
15crypto/../../cryptodev-linux/cryptlib.c:340:4: warning: format '%u' expects argument of type 'unsigned int', but argument 7 has type 'size_t' [-Wformat=]
16 ddebug(1, "Setting hmac key failed for %s-%u.",
17 ^
18
19Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com>
20Change-Id: I67f2d79f68b4d62b598073c6a918a110523fadfd
21Reviewed-on: http://git.am.freescale.net:8181/37443
22Reviewed-by: Cristian Stoica <cristian.stoica@freescale.com>
23Tested-by: Cristian Stoica <cristian.stoica@freescale.com>
24---
25 cryptlib.c | 6 +++---
26 1 file changed, 3 insertions(+), 3 deletions(-)
27
28diff --git a/cryptlib.c b/cryptlib.c
29index 5882a30..10f5e1a 100644
30--- a/cryptlib.c
31+++ b/cryptlib.c
32@@ -143,7 +143,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
33 if (alg->max_keysize > 0 &&
34 unlikely((keylen < alg->min_keysize) ||
35 (keylen > alg->max_keysize))) {
36- ddebug(1, "Wrong keylen '%u' for algorithm '%s'. Use %u to %u.",
37+ ddebug(1, "Wrong keylen '%zu' for algorithm '%s'. Use %u to %u.",
38 keylen, alg_name, alg->min_keysize, alg->max_keysize);
39 ret = -EINVAL;
40 goto error;
41@@ -170,7 +170,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
42 }
43
44 if (unlikely(ret)) {
45- ddebug(1, "Setting key failed for %s-%u.", alg_name, keylen*8);
46+ ddebug(1, "Setting key failed for %s-%zu.", alg_name, keylen*8);
47 ret = -EINVAL;
48 goto error;
49 }
50@@ -337,7 +337,7 @@ int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name,
51 if (hmac_mode != 0) {
52 ret = crypto_ahash_setkey(hdata->async.s, mackey, mackeylen);
53 if (unlikely(ret)) {
54- ddebug(1, "Setting hmac key failed for %s-%u.",
55+ ddebug(1, "Setting hmac key failed for %s-%zu.",
56 alg_name, mackeylen*8);
57 ret = -EINVAL;
58 goto error;
59--
602.3.5
61
diff --git a/recipes-kernel/cryptodev/files/0020-fix-uninitialized-variable-compiler-warning.patch b/recipes-kernel/cryptodev/files/0020-fix-uninitialized-variable-compiler-warning.patch
new file mode 100644
index 0000000..a97a2d4
--- /dev/null
+++ b/recipes-kernel/cryptodev/files/0020-fix-uninitialized-variable-compiler-warning.patch
@@ -0,0 +1,38 @@
1From be9f6a0dc90847dbb00307d23f47b8b3fc3ff130 Mon Sep 17 00:00:00 2001
2From: Tudor Ambarus <tudor.ambarus@freescale.com>
3Date: Fri, 29 May 2015 15:49:22 +0300
4Subject: [PATCH 20/20] fix uninitialized variable compiler warning
5
6crypto/../../cryptodev-linux/ioctl.c: In function 'cryptodev_compat_ioctl':
7crypto/../../cryptodev-linux/ioctl.c:1445:2: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
8 return ret;
9 ^
10
11Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com>
12Change-Id: Id5226fc97a3bb880ca6db86df58957122bbaa428
13Reviewed-on: http://git.am.freescale.net:8181/37441
14Reviewed-by: Cristian Stoica <cristian.stoica@freescale.com>
15Tested-by: Cristian Stoica <cristian.stoica@freescale.com>
16---
17 ioctl.c | 3 ++-
18 1 file changed, 2 insertions(+), 1 deletion(-)
19
20diff --git a/ioctl.c b/ioctl.c
21index f3ce2f6..7cd3c56 100644
22--- a/ioctl.c
23+++ b/ioctl.c
24@@ -1387,9 +1387,10 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_)
25 case COMPAT_CIOCASYMFETCHCOOKIE:
26 {
27 struct cryptodev_pkc *pkc;
28- int i = 0;
29+ int i;
30 struct compat_pkc_cookie_list_s cookie_list;
31
32+ ret = 0;
33 cookie_list.cookie_available = 0;
34
35 for (i = 0; i < MAX_COOKIES; i++) {
36--
372.3.5
38