summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristian Stoica <cristian.stoica@nxp.com>2016-01-25 11:19:43 +0200
committerZhenhua Luo <zhenhua.luo@nxp.com>2016-06-23 10:58:51 +0800
commit41d1478e1294d06f0cce58fe847c0b0f1706b808 (patch)
tree8c6c5e2887cc30435ee40e764bb2ede58278d0ac
parente3956ffbc217e468e26c9ce2e8932d3720fabca4 (diff)
downloadmeta-fsl-ppc-41d1478e1294d06f0cce58fe847c0b0f1706b808.tar.gz
cryptodev-qoriq: upgrade to 1.8 plus fsl patches
upstream commit: 87b56e04b24c6d4be145483477eff7d3153290e9 Also: - move all fsl patches on top of cryptodev-1.8 - add CIOCHASH ioctl - fix incorrect tests initializations - modify yocto patches to match updated Makefiles Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
-rw-r--r--recipes-kernel/cryptodev/cryptodev-qoriq-linux_1.8.bb (renamed from recipes-kernel/cryptodev/cryptodev-qoriq-linux_1.7.bb)4
-rw-r--r--recipes-kernel/cryptodev/cryptodev-qoriq-module_1.7.bb14
-rw-r--r--recipes-kernel/cryptodev/cryptodev-qoriq-module_1.8.bb19
-rw-r--r--recipes-kernel/cryptodev/cryptodev-qoriq-tests_1.8.bb (renamed from recipes-kernel/cryptodev/cryptodev-qoriq-tests_1.7.bb)13
-rw-r--r--recipes-kernel/cryptodev/cryptodev-qoriq_1.8.inc (renamed from recipes-kernel/cryptodev/cryptodev-qoriq_1.7.inc)40
-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-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/0004-Add-the-compile-and-install-rules-for-cryptodev-test.patch65
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch (renamed from recipes-kernel/cryptodev/files/0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch)6
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch (renamed from recipes-kernel/cryptodev/files/0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch)6
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0003-PKC-support-added-in-cryptodev-module.patch (renamed from recipes-kernel/cryptodev/files/0003-PKC-support-added-in-cryptodev-module.patch)6
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0004-Compat-versions-of-PKC-IOCTLs.patch (renamed from recipes-kernel/cryptodev/files/0004-Compat-versions-of-PKC-IOCTLs.patch)6
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0005-Asynchronous-interface-changes-in-cryptodev.patch (renamed from recipes-kernel/cryptodev/files/0005-Asynchronous-interface-changes-in-cryptodev.patch)6
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch (renamed from recipes-kernel/cryptodev/files/0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch)6
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch (renamed from recipes-kernel/cryptodev/files/0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch)6
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0008-Add-RSA-Key-generation-offloading.patch (renamed from recipes-kernel/cryptodev/files/0008-Add-RSA-Key-generation-offloading.patch)6
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch (renamed from recipes-kernel/cryptodev/files/0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch)6
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0010-add-support-for-composite-TLS10-SHA1-3DES-algorithm-.patch (renamed from recipes-kernel/cryptodev/files/0010-add-support-for-composite-TLS10-SHA1-3DES-algorithm-.patch)6
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0011-add-support-for-TLSv1.1-record-offload.patch (renamed from recipes-kernel/cryptodev/files/0011-add-support-for-TLSv1.1-record-offload.patch)6
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0012-add-support-for-TLSv1.2-record-offload.patch (renamed from recipes-kernel/cryptodev/files/0012-add-support-for-TLSv1.2-record-offload.patch)6
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0013-clean-up-code-layout.patch (renamed from recipes-kernel/cryptodev/files/0013-clean-up-code-layout.patch)6
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0014-remove-redundant-data-copy-for-pkc-operations.patch (renamed from recipes-kernel/cryptodev/files/0014-remove-redundant-data-copy-for-pkc-operations.patch)6
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0015-fix-pkc-request-deallocation.patch (renamed from recipes-kernel/cryptodev/files/0015-fix-pkc-request-deallocation.patch)6
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0016-add-basic-detection-of-asym-features.patch (renamed from recipes-kernel/cryptodev/files/0016-add-basic-detection-of-asym-features.patch)6
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0017-remove-dead-code.patch (renamed from recipes-kernel/cryptodev/files/0017-remove-dead-code.patch)4
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0018-fix-compat-warnings.patch (renamed from recipes-kernel/cryptodev/files/0018-fix-compat-warnings.patch)4
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0019-fix-size_t-print-format.patch (renamed from recipes-kernel/cryptodev/files/0019-fix-size_t-print-format.patch)4
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0020-fix-uninitialized-variable-compiler-warning.patch (renamed from recipes-kernel/cryptodev/files/0020-fix-uninitialized-variable-compiler-warning.patch)4
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0021-check-return-codes-for-copy-to-from-user-functions.patch (renamed from recipes-kernel/cryptodev/files/0021-check-return-codes-for-copy-to-from-user-functions.patch)4
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0022-fix-double-free-pkc-req-on-error.patch (renamed from recipes-kernel/cryptodev/files/0022-fix-double-free-pkc-req-on-error.patch)4
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0023-remove-MAY_BACKLOG-flag-from-requests.patch (renamed from recipes-kernel/cryptodev/files/0023-remove-MAY_BACKLOG-flag-from-requests.patch)4
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0024-fix-COMPAT_CIOCKEY-ioctl-command-number.patch (renamed from recipes-kernel/cryptodev/files/0024-fix-COMPAT_CIOCKEY-ioctl-command-number.patch)4
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0025-fix-benchmarks-linking.patch25
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0026-fix-Makefile-to-allow-parallel-make-with-j-option.patch56
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0027-use-Linux-kernel-conventions-for-Makefile-variables.patch47
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0028-for-consistency-use-.-instead-of-.-in-makefiles.patch73
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0029-fix-clean-up-on-error-path-for-crypto_create_session.patch117
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0030-remove-code-duplication-in-cryptodev_hash_init.patch59
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0031-fix-comment-typo.patch26
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0032-avoid-calls-to-kmalloc-on-hotpaths.patch220
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0033-avoid-unnecessary-checks-for-hash-clean-up.patch33
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0034-extend-API-with-CIOCHASH-to-support-direct-hash-oper.patch114
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0035-use-directly-crypto-API-digest-operation-for-CIOCHAS.patch315
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0036-add-compat-for-CIOCHASH-operation.patch120
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0037-rewrite-sha_speed.c-to-reduce-code-duplication.patch190
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0038-extend-sha_speed.c-to-test-CIOCHASH.patch143
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0039-fix-memory-leaks-on-error-path-for-CIOCHASH.patch70
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0040-fix-structure-init-in-sha_speed-test.patch53
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0041-add-separate-target-for-building-tests.patch38
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0042-fix-destination-for-staged-installs.patch55
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0043-add-install-target-for-tests.patch46
-rw-r--r--recipes-kernel/cryptodev/yocto_patches/0001-Add-the-compile-and-install-rules-for-cryptodev-test.patch50
-rw-r--r--recipes-kernel/cryptodev/yocto_patches/0001-Disable-installing-header-file-provided-by-another-p.patch29
56 files changed, 1998 insertions, 319 deletions
diff --git a/recipes-kernel/cryptodev/cryptodev-qoriq-linux_1.7.bb b/recipes-kernel/cryptodev/cryptodev-qoriq-linux_1.8.bb
index 58db505..69fb622 100644
--- a/recipes-kernel/cryptodev/cryptodev-qoriq-linux_1.7.bb
+++ b/recipes-kernel/cryptodev/cryptodev-qoriq-linux_1.8.bb
@@ -2,7 +2,7 @@ require cryptodev-qoriq_${PV}.inc
2 2
3SUMMARY = "A /dev/crypto device driver header file" 3SUMMARY = "A /dev/crypto device driver header file"
4 4
5PROVIDES = "cryptodev-linux" 5PROVIDES += "cryptodev-linux"
6 6
7do_compile[noexec] = "1" 7do_compile[noexec] = "1"
8 8
@@ -12,5 +12,3 @@ do_install() {
12} 12}
13 13
14ALLOW_EMPTY_${PN} = "1" 14ALLOW_EMPTY_${PN} = "1"
15
16COMPATIBLE_MACHINE = "(qoriq)"
diff --git a/recipes-kernel/cryptodev/cryptodev-qoriq-module_1.7.bb b/recipes-kernel/cryptodev/cryptodev-qoriq-module_1.7.bb
deleted file mode 100644
index 383b482..0000000
--- a/recipes-kernel/cryptodev/cryptodev-qoriq-module_1.7.bb
+++ /dev/null
@@ -1,14 +0,0 @@
1require cryptodev-qoriq_${PV}.inc
2
3SUMMARY = "A /dev/crypto device driver kernel module"
4
5PROVIDES = "cryptodev-module"
6
7inherit module qoriq_build_64bit_kernel
8
9# Header file provided by a separate package
10DEPENDS += "cryptodev-linux"
11
12EXTRA_OEMAKE='KERNEL_DIR="${STAGING_KERNEL_DIR}" PREFIX="${D}"'
13
14COMPATIBLE_MACHINE = "(qoriq)"
diff --git a/recipes-kernel/cryptodev/cryptodev-qoriq-module_1.8.bb b/recipes-kernel/cryptodev/cryptodev-qoriq-module_1.8.bb
new file mode 100644
index 0000000..e51c452
--- /dev/null
+++ b/recipes-kernel/cryptodev/cryptodev-qoriq-module_1.8.bb
@@ -0,0 +1,19 @@
1require cryptodev-qoriq_${PV}.inc
2
3SUMMARY = "A /dev/crypto device driver kernel module"
4
5inherit module qoriq_build_64bit_kernel
6
7PROVIDES += "cryptodev-module"
8
9# Header file provided by a separate package
10DEPENDS += "cryptodev-linux"
11
12SRC_URI_append = " \
13file://0001-Disable-installing-header-file-provided-by-another-p.patch \
14"
15
16EXTRA_OEMAKE='KERNEL_DIR="${STAGING_KERNEL_DIR}" DESTDIR="${D}"'
17
18RCONFLICTS_${PN} = "ocf-linux"
19RREPLACES_${PN} = "ocf-linux"
diff --git a/recipes-kernel/cryptodev/cryptodev-qoriq-tests_1.7.bb b/recipes-kernel/cryptodev/cryptodev-qoriq-tests_1.8.bb
index a60ea98..18bc3c5 100644
--- a/recipes-kernel/cryptodev/cryptodev-qoriq-tests_1.7.bb
+++ b/recipes-kernel/cryptodev/cryptodev-qoriq-tests_1.8.bb
@@ -1,11 +1,16 @@
1require cryptodev-qoriq_${PV}.inc 1require cryptodev-qoriq_${PV}.inc
2 2
3SUMMARY = "A test suite for /dev/crypto device driver" 3SUMMARY = "A test suite for /dev/crypto device driver"
4DEPENDS = "openssl"
5 4
6PROVIDES = "cryptodev-tests" 5DEPENDS += "openssl"
7 6
8EXTRA_OEMAKE='KERNEL_DIR="${STAGING_KERNEL_DIR}" PREFIX="${D}"' 7PROVIDES += "cryptodev-tests"
8
9SRC_URI_append = " \
10file://0001-Add-the-compile-and-install-rules-for-cryptodev-test.patch \
11"
12
13EXTRA_OEMAKE='KERNEL_DIR="${STAGING_EXECPREFIXDIR}" DESTDIR="${D}"'
9 14
10do_compile() { 15do_compile() {
11 oe_runmake testprogs 16 oe_runmake testprogs
@@ -17,5 +22,3 @@ do_install() {
17 22
18FILES_${PN}-dbg += "${bindir}/tests_cryptodev/.debug" 23FILES_${PN}-dbg += "${bindir}/tests_cryptodev/.debug"
19FILES_${PN} = "${bindir}/tests_cryptodev/*" 24FILES_${PN} = "${bindir}/tests_cryptodev/*"
20
21COMPATIBLE_MACHINE = "(qoriq)"
diff --git a/recipes-kernel/cryptodev/cryptodev-qoriq_1.7.inc b/recipes-kernel/cryptodev/cryptodev-qoriq_1.8.inc
index e4700db..7e9b4a6 100644
--- a/recipes-kernel/cryptodev/cryptodev-qoriq_1.7.inc
+++ b/recipes-kernel/cryptodev/cryptodev-qoriq_1.8.inc
@@ -1,8 +1,5 @@
1HOMEPAGE = "http://cryptodev-linux.org/" 1HOMEPAGE = "http://cryptodev-linux.org/"
2 2
3RCONFLICTS_${PN} = "ocf-linux"
4RREPLACES_${PN} = "ocf-linux"
5
6LICENSE = "GPLv2" 3LICENSE = "GPLv2"
7LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" 4LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
8 5
@@ -15,17 +12,14 @@ python() {
15 d.appendVar("RREPLACES_%s" % p, p.replace('cryptodev-qoriq', 'cryptodev')) 12 d.appendVar("RREPLACES_%s" % p, p.replace('cryptodev-qoriq', 'cryptodev'))
16} 13}
17 14
15FILESEXTRAPATHS_prepend := "${THISDIR}/sdk_patches:"
16FILESEXTRAPATHS_prepend := "${THISDIR}/yocto_patches:"
17
18SRC_URI = "http://download.gna.org/cryptodev-linux/cryptodev-linux-${PV}.tar.gz" 18SRC_URI = "http://download.gna.org/cryptodev-linux/cryptodev-linux-${PV}.tar.gz"
19SRC_URI[md5sum] = "0b63b3481cf2c90386b35f057481d36b" 19
20SRC_URI[sha256sum] = "41880533b53de4d7b3f054e230f576988dafb8eed7bef5ebcf6422bb2e3a3b25" 20SRC_URI[md5sum] = "02644cc4cd02301e0b503a332eb2f0b5"
21 21SRC_URI[sha256sum] = "67fabde9fb67b286a96c4f45b594b0eccd0f761b495705c18f2ae9461b831376"
22# Upstream hotfixes and yocto specific patches 22
23SRC_URI_append = " \
24file://0001-fix-compilation-against-linux-3.19.patch \
25file://0002-tests-Makefile-fix-arg-passing-to-CC-in-implicit-rul.patch \
26file://0003-Disable-installing-header-file-provided-by-another-p.patch \
27file://0004-Add-the-compile-and-install-rules-for-cryptodev-test.patch \
28"
29# SDK patches 23# SDK patches
30SRC_URI_append = " file://0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch \ 24SRC_URI_append = " file://0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch \
31file://0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch \ 25file://0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch \
@@ -51,6 +45,25 @@ file://0021-check-return-codes-for-copy-to-from-user-functions.patch \
51file://0022-fix-double-free-pkc-req-on-error.patch \ 45file://0022-fix-double-free-pkc-req-on-error.patch \
52file://0023-remove-MAY_BACKLOG-flag-from-requests.patch \ 46file://0023-remove-MAY_BACKLOG-flag-from-requests.patch \
53file://0024-fix-COMPAT_CIOCKEY-ioctl-command-number.patch \ 47file://0024-fix-COMPAT_CIOCKEY-ioctl-command-number.patch \
48file://0025-fix-benchmarks-linking.patch \
49file://0026-fix-Makefile-to-allow-parallel-make-with-j-option.patch \
50file://0027-use-Linux-kernel-conventions-for-Makefile-variables.patch \
51file://0028-for-consistency-use-.-instead-of-.-in-makefiles.patch \
52file://0029-fix-clean-up-on-error-path-for-crypto_create_session.patch \
53file://0030-remove-code-duplication-in-cryptodev_hash_init.patch \
54file://0031-fix-comment-typo.patch \
55file://0032-avoid-calls-to-kmalloc-on-hotpaths.patch \
56file://0033-avoid-unnecessary-checks-for-hash-clean-up.patch \
57file://0034-extend-API-with-CIOCHASH-to-support-direct-hash-oper.patch \
58file://0035-use-directly-crypto-API-digest-operation-for-CIOCHAS.patch \
59file://0036-add-compat-for-CIOCHASH-operation.patch \
60file://0037-rewrite-sha_speed.c-to-reduce-code-duplication.patch \
61file://0038-extend-sha_speed.c-to-test-CIOCHASH.patch \
62file://0039-fix-memory-leaks-on-error-path-for-CIOCHASH.patch \
63file://0040-fix-structure-init-in-sha_speed-test.patch \
64file://0041-add-separate-target-for-building-tests.patch \
65file://0042-fix-destination-for-staged-installs.patch \
66file://0043-add-install-target-for-tests.patch \
54" 67"
55 68
56# NOTE: remove this patch and all traces of DISTRO_FEATURE c29x_pkc 69# NOTE: remove this patch and all traces of DISTRO_FEATURE c29x_pkc
@@ -60,3 +73,4 @@ SRC_URI_append = "${@bb.utils.contains('DISTRO_FEATURES', 'c29x_pkc', ' file://0
60S = "${WORKDIR}/cryptodev-linux-${PV}" 73S = "${WORKDIR}/cryptodev-linux-${PV}"
61 74
62CLEANBROKEN = "1" 75CLEANBROKEN = "1"
76COMPATIBLE_MACHINE = "(qoriq)"
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
deleted file mode 100644
index 10d6c8b..0000000
--- a/recipes-kernel/cryptodev/files/0001-don-t-advertise-RSA-keygen.patch
+++ /dev/null
@@ -1,33 +0,0 @@
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
deleted file mode 100644
index ab276d2..0000000
--- a/recipes-kernel/cryptodev/files/0001-fix-compilation-against-linux-3.19.patch
+++ /dev/null
@@ -1,36 +0,0 @@
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
deleted file mode 100644
index f5ab8b4..0000000
--- a/recipes-kernel/cryptodev/files/0002-Fix-tests-Makefile-usage-of-LDLIBS-vs.-LDFLAGS.patch
+++ /dev/null
@@ -1,29 +0,0 @@
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/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
deleted file mode 100644
index 68c48e0..0000000
--- a/recipes-kernel/cryptodev/files/0002-tests-Makefile-fix-arg-passing-to-CC-in-implicit-rul.patch
+++ /dev/null
@@ -1,28 +0,0 @@
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
deleted file mode 100644
index e384950..0000000
--- a/recipes-kernel/cryptodev/files/0003-Disable-installing-header-file-provided-by-another-p.patch
+++ /dev/null
@@ -1,29 +0,0 @@
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/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
deleted file mode 100644
index 25a52a9..0000000
--- a/recipes-kernel/cryptodev/files/0004-Add-the-compile-and-install-rules-for-cryptodev-test.patch
+++ /dev/null
@@ -1,65 +0,0 @@
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/files/0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch b/recipes-kernel/cryptodev/sdk_patches/0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch
index 7d957ec..b8d2a00 100644
--- a/recipes-kernel/cryptodev/files/0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch
@@ -1,7 +1,7 @@
1From c653e3a70499c6bb66b57c1788d2d38ca9b8a07e Mon Sep 17 00:00:00 2001 1From 25a68839e3aab5acebcbe51f7fbe9d2d26216bc0 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 01/15] add support for composite TLS10(SHA1,AES) algorithm 4Subject: [PATCH 01/38] 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
@@ -48,5 +48,5 @@ index b23f5fd..a3f8379 100644
48 alg_name = "ecb(cipher_null)"; 48 alg_name = "ecb(cipher_null)";
49 stream = 1; 49 stream = 1;
50-- 50--
512.3.5 512.7.0
52 52
diff --git a/recipes-kernel/cryptodev/files/0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch b/recipes-kernel/cryptodev/sdk_patches/0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch
index 08d9231..d83da97 100644
--- a/recipes-kernel/cryptodev/files/0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch
@@ -1,7 +1,7 @@
1From 71b317347179225693c6d41b740d387ae2c25061 Mon Sep 17 00:00:00 2001 1From d9f27d08708556e22e1b1dc87b0495896879ca66 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 02/15] add support for COMPAT_CIOCAUTHCRYPT ioctl() 4Subject: [PATCH 02/38] add support for COMPAT_CIOCAUTHCRYPT ioctl()
5 5
6Upstream-status: Pending 6Upstream-status: Pending
7 7
@@ -203,5 +203,5 @@ index a3f8379..5a44807 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--
2062.3.5 2062.7.0
207 207
diff --git a/recipes-kernel/cryptodev/files/0003-PKC-support-added-in-cryptodev-module.patch b/recipes-kernel/cryptodev/sdk_patches/0003-PKC-support-added-in-cryptodev-module.patch
index 46f2432..ffa0b45 100644
--- a/recipes-kernel/cryptodev/files/0003-PKC-support-added-in-cryptodev-module.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0003-PKC-support-added-in-cryptodev-module.patch
@@ -1,7 +1,7 @@
1From fc9ee6ed33c76372de6e3748d2e951fa10f7c47e Mon Sep 17 00:00:00 2001 1From 2bda43095b511e0052b3bc27b216ff9909cc03d2 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 03/15] PKC support added in cryptodev module 4Subject: [PATCH 03/38] PKC support added in cryptodev module
5 5
6Upstream-status: Pending 6Upstream-status: Pending
7 7
@@ -894,5 +894,5 @@ index 57e5c38..0b7951e 100644
894 { 894 {
895 struct csession *ses_ptr; 895 struct csession *ses_ptr;
896-- 896--
8972.3.5 8972.7.0
898 898
diff --git a/recipes-kernel/cryptodev/files/0004-Compat-versions-of-PKC-IOCTLs.patch b/recipes-kernel/cryptodev/sdk_patches/0004-Compat-versions-of-PKC-IOCTLs.patch
index 2f35768..e963f58 100644
--- a/recipes-kernel/cryptodev/files/0004-Compat-versions-of-PKC-IOCTLs.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0004-Compat-versions-of-PKC-IOCTLs.patch
@@ -1,7 +1,7 @@
1From b109fbdb64de6be0dc2f0d2ef108cead34652495 Mon Sep 17 00:00:00 2001 1From e0e5c1bfb21888bf9f87f72ac8cdf7eee951f619 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 04/15] Compat versions of PKC IOCTLs 4Subject: [PATCH 04/38] Compat versions of PKC IOCTLs
5 5
6Upstream-status: Pending 6Upstream-status: Pending
7 7
@@ -196,5 +196,5 @@ index 69980e3..9431025 100644
196 return -EINVAL; 196 return -EINVAL;
197 } 197 }
198-- 198--
1992.3.5 1992.7.0
200 200
diff --git a/recipes-kernel/cryptodev/files/0005-Asynchronous-interface-changes-in-cryptodev.patch b/recipes-kernel/cryptodev/sdk_patches/0005-Asynchronous-interface-changes-in-cryptodev.patch
index 8827fb0..5b96e84 100644
--- a/recipes-kernel/cryptodev/files/0005-Asynchronous-interface-changes-in-cryptodev.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0005-Asynchronous-interface-changes-in-cryptodev.patch
@@ -1,7 +1,7 @@
1From 7594d5375d998eb25241750b623661ff021697d3 Mon Sep 17 00:00:00 2001 1From d98f979d76c30058da24e62220f19c5b8c627819 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 05/15] Asynchronous interface changes in cryptodev 4Subject: [PATCH 05/38] Asynchronous interface changes in cryptodev
5 5
6Upstream-status: Pending 6Upstream-status: Pending
7 7
@@ -209,5 +209,5 @@ index 9431025..e2f407f 100644
209 return ret; 209 return ret;
210 default: 210 default:
211-- 211--
2122.3.5 2122.7.0
213 213
diff --git a/recipes-kernel/cryptodev/files/0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch b/recipes-kernel/cryptodev/sdk_patches/0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch
index 89cace3..978efd1 100644
--- a/recipes-kernel/cryptodev/files/0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch
@@ -1,7 +1,7 @@
1From eccd6277b067cd85094eb057225cc0a983300b9f Mon Sep 17 00:00:00 2001 1From b92d23a790d9634d52db3b9a5e1882fde620b073 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 06/15] ECC_KEYGEN and DLC_KEYGEN supported in cryptodev module 4Subject: [PATCH 06/38] ECC_KEYGEN and DLC_KEYGEN supported in cryptodev module
5 5
6Upstream-status: Pending 6Upstream-status: Pending
7 7
@@ -208,5 +208,5 @@ index 0b7951e..c901bc7 100644
208 err: 208 err:
209 return ret; 209 return ret;
210-- 210--
2112.3.5 2112.7.0
212 212
diff --git a/recipes-kernel/cryptodev/files/0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch b/recipes-kernel/cryptodev/sdk_patches/0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch
index a76aca4..cfaabae 100644
--- a/recipes-kernel/cryptodev/files/0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch
@@ -1,7 +1,7 @@
1From 78c01e1882def52c72966c0e86913950ec201af9 Mon Sep 17 00:00:00 2001 1From 00a8ac310a33767eac0a07e32597c1a6f467315f 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 07/15] RCU stall fixed in PKC asynchronous interface 4Subject: [PATCH 07/38] RCU stall fixed in PKC asynchronous interface
5 5
6Upstream-status: Pending 6Upstream-status: Pending
7 7
@@ -234,5 +234,5 @@ index c901bc7..2747706 100644
234 if (!buf) 234 if (!buf)
235 return -ENOMEM; 235 return -ENOMEM;
236-- 236--
2372.3.5 2372.7.0
238 238
diff --git a/recipes-kernel/cryptodev/files/0008-Add-RSA-Key-generation-offloading.patch b/recipes-kernel/cryptodev/sdk_patches/0008-Add-RSA-Key-generation-offloading.patch
index d251c66..ef4ea09 100644
--- a/recipes-kernel/cryptodev/files/0008-Add-RSA-Key-generation-offloading.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0008-Add-RSA-Key-generation-offloading.patch
@@ -1,7 +1,7 @@
1From 5127db3483a2e4f6dc13330bea7237931c5f15a0 Mon Sep 17 00:00:00 2001 1From a2cbb5fcc2d6f3734b5ed2826e828d852cfdf8ba 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 08/15] Add RSA Key generation offloading 4Subject: [PATCH 08/38] Add RSA Key generation offloading
5 5
6Upstream-status: Pending 6Upstream-status: Pending
7 7
@@ -166,5 +166,5 @@ index 2747706..14dcf40 100644
166 err: 166 err:
167 return ret; 167 return ret;
168-- 168--
1692.3.5 1692.7.0
170 170
diff --git a/recipes-kernel/cryptodev/files/0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch b/recipes-kernel/cryptodev/sdk_patches/0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch
index 2213fae..47fd2e1 100644
--- a/recipes-kernel/cryptodev/files/0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch
@@ -1,7 +1,7 @@
1From 800af48d0c26830943ca2308dd426b5b09811750 Mon Sep 17 00:00:00 2001 1From 263483d1023f6c1c35b5488b9b79796ee2605e9b 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 09/15] Fixed compilation error of openssl with fsl cryptodev 4Subject: [PATCH 09/38] Fixed compilation error of openssl with fsl cryptodev
5 5
6Upstream-status: Pending 6Upstream-status: Pending
7 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.3.5 1592.7.0
160 160
diff --git a/recipes-kernel/cryptodev/files/0010-add-support-for-composite-TLS10-SHA1-3DES-algorithm-.patch b/recipes-kernel/cryptodev/sdk_patches/0010-add-support-for-composite-TLS10-SHA1-3DES-algorithm-.patch
index 2032159..352a45d 100644
--- a/recipes-kernel/cryptodev/files/0010-add-support-for-composite-TLS10-SHA1-3DES-algorithm-.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0010-add-support-for-composite-TLS10-SHA1-3DES-algorithm-.patch
@@ -1,7 +1,7 @@
1From 55ee0ae703a68db74a492f5910937260502b9602 Mon Sep 17 00:00:00 2001 1From 269564f4e00fa907388ccfa046b930b3c4eef4dc Mon Sep 17 00:00:00 2001
2From: Tudor Ambarus <tudor.ambarus@freescale.com> 2From: Tudor Ambarus <tudor.ambarus@freescale.com>
3Date: Tue, 10 Jun 2014 08:27:59 +0300 3Date: Tue, 10 Jun 2014 08:27:59 +0300
4Subject: [PATCH 10/15] add support for composite TLS10(SHA1,3DES) algorithm 4Subject: [PATCH 10/38] add support for composite TLS10(SHA1,3DES) algorithm
5 offload 5 offload
6 6
7This adds support for composite algorithm offload in a single crypto 7This adds support for composite algorithm offload in a single crypto
@@ -50,5 +50,5 @@ index c97320b..574e913 100644
50 alg_name = "ecb(cipher_null)"; 50 alg_name = "ecb(cipher_null)";
51 stream = 1; 51 stream = 1;
52-- 52--
532.3.5 532.7.0
54 54
diff --git a/recipes-kernel/cryptodev/files/0011-add-support-for-TLSv1.1-record-offload.patch b/recipes-kernel/cryptodev/sdk_patches/0011-add-support-for-TLSv1.1-record-offload.patch
index 37862b5..34d6ade 100644
--- a/recipes-kernel/cryptodev/files/0011-add-support-for-TLSv1.1-record-offload.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0011-add-support-for-TLSv1.1-record-offload.patch
@@ -1,7 +1,7 @@
1From 06cca15fd0412ae872c2b2c5d50216e1eb34fc50 Mon Sep 17 00:00:00 2001 1From 73c20be9ae1ed57d8c428c86471f42d953e79fba Mon Sep 17 00:00:00 2001
2From: Tudor Ambarus <tudor.ambarus@freescale.com> 2From: Tudor Ambarus <tudor.ambarus@freescale.com>
3Date: Tue, 31 Mar 2015 16:15:47 +0300 3Date: Tue, 31 Mar 2015 16:15:47 +0300
4Subject: [PATCH 11/15] add support for TLSv1.1 record offload 4Subject: [PATCH 11/38] add support for TLSv1.1 record offload
5 5
6This adds support for composite algorithm offload in a single crypto 6This adds support for composite algorithm offload in a single crypto
7(cipher + hmac) operation. 7(cipher + hmac) operation.
@@ -72,5 +72,5 @@ index 574e913..ba82387 100644
72 aead = 1; 72 aead = 1;
73 break; 73 break;
74-- 74--
752.3.5 752.7.0
76 76
diff --git a/recipes-kernel/cryptodev/files/0012-add-support-for-TLSv1.2-record-offload.patch b/recipes-kernel/cryptodev/sdk_patches/0012-add-support-for-TLSv1.2-record-offload.patch
index 6aa672a..b7a7268 100644
--- a/recipes-kernel/cryptodev/files/0012-add-support-for-TLSv1.2-record-offload.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0012-add-support-for-TLSv1.2-record-offload.patch
@@ -1,7 +1,7 @@
1From 15999e402dd7472cafe51be3fd0ce66433ca924b Mon Sep 17 00:00:00 2001 1From f1a519d9eed072bd45a45d251603c64f942814fb Mon Sep 17 00:00:00 2001
2From: Tudor Ambarus <tudor.ambarus@freescale.com> 2From: Tudor Ambarus <tudor.ambarus@freescale.com>
3Date: Tue, 31 Mar 2015 16:16:28 +0300 3Date: Tue, 31 Mar 2015 16:16:28 +0300
4Subject: [PATCH 12/15] add support for TLSv1.2 record offload 4Subject: [PATCH 12/38] add support for TLSv1.2 record offload
5 5
6This adds support for composite algorithm offload in a single crypto 6This adds support for composite algorithm offload in a single crypto
7(cipher + hmac) operation. 7(cipher + hmac) operation.
@@ -68,5 +68,5 @@ index ba82387..fb4c4e3 100644
68 alg_name = "ecb(cipher_null)"; 68 alg_name = "ecb(cipher_null)";
69 stream = 1; 69 stream = 1;
70-- 70--
712.3.5 712.7.0
72 72
diff --git a/recipes-kernel/cryptodev/files/0013-clean-up-code-layout.patch b/recipes-kernel/cryptodev/sdk_patches/0013-clean-up-code-layout.patch
index 86cf6a2..a6884fa 100644
--- a/recipes-kernel/cryptodev/files/0013-clean-up-code-layout.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0013-clean-up-code-layout.patch
@@ -1,7 +1,7 @@
1From 39abcb9cea60540528e848d6c66169c36d666861 Mon Sep 17 00:00:00 2001 1From 5a87b9d5f2295ed0fd36a41c8376e01eb0df62b2 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@freescale.com> 2From: Cristian Stoica <cristian.stoica@freescale.com>
3Date: Fri, 20 Feb 2015 12:46:58 +0200 3Date: Fri, 20 Feb 2015 12:46:58 +0200
4Subject: [PATCH 13/15] clean-up code layout 4Subject: [PATCH 13/38] clean-up code layout
5 5
6Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com> 6Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
7Change-Id: I92c2f4baeed9470a2c3c42b592d878e65918b0af 7Change-Id: I92c2f4baeed9470a2c3c42b592d878e65918b0af
@@ -182,5 +182,5 @@ index 6365911..af66553 100644
182 if (rc != -EINPROGRESS && rc != 0) 182 if (rc != -EINPROGRESS && rc != 0)
183 goto err; 183 goto err;
184-- 184--
1852.3.5 1852.7.0
186 186
diff --git a/recipes-kernel/cryptodev/files/0014-remove-redundant-data-copy-for-pkc-operations.patch b/recipes-kernel/cryptodev/sdk_patches/0014-remove-redundant-data-copy-for-pkc-operations.patch
index b9e9d2b..58d37fa 100644
--- a/recipes-kernel/cryptodev/files/0014-remove-redundant-data-copy-for-pkc-operations.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0014-remove-redundant-data-copy-for-pkc-operations.patch
@@ -1,7 +1,7 @@
1From 34e765977633b5f81845c0183af6d388d8225f00 Mon Sep 17 00:00:00 2001 1From a4d88e5379ddb7d9bceac3141f508b8173d1e902 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@freescale.com> 2From: Cristian Stoica <cristian.stoica@freescale.com>
3Date: Mon, 23 Feb 2015 12:14:07 +0200 3Date: Mon, 23 Feb 2015 12:14:07 +0200
4Subject: [PATCH 14/15] remove redundant data copy for pkc operations 4Subject: [PATCH 14/38] remove redundant data copy for pkc operations
5 5
6This patch removes a copy of a pkc request that was 6This patch removes a copy of a pkc request that was
7allocated on the hot-path. The copy was not necessary 7allocated on the hot-path. The copy was not necessary
@@ -490,5 +490,5 @@ index af66553..ed1c69a 100644
490 490
491 int crypto_run(struct fcrypt *fcr, struct kernel_crypt_op *kcop) 491 int crypto_run(struct fcrypt *fcr, struct kernel_crypt_op *kcop)
492-- 492--
4932.3.5 4932.7.0
494 494
diff --git a/recipes-kernel/cryptodev/files/0015-fix-pkc-request-deallocation.patch b/recipes-kernel/cryptodev/sdk_patches/0015-fix-pkc-request-deallocation.patch
index 949fe12..ef18992 100644
--- a/recipes-kernel/cryptodev/files/0015-fix-pkc-request-deallocation.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0015-fix-pkc-request-deallocation.patch
@@ -1,7 +1,7 @@
1From 8361f99c940fbe270fca2112dae3d97c9a5776d6 Mon Sep 17 00:00:00 2001 1From 212e418fa7b70c8ba79446006001c574cb9d42f8 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@freescale.com> 2From: Cristian Stoica <cristian.stoica@freescale.com>
3Date: Mon, 23 Feb 2015 15:28:22 +0200 3Date: Mon, 23 Feb 2015 15:28:22 +0200
4Subject: [PATCH 15/15] fix pkc request deallocation 4Subject: [PATCH 15/38] fix pkc request deallocation
5 5
6The request to be freed is actually pkc->req, and should be done inside 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 7the fetch ioctl for ASYNC (this patch) and in crypt ioctl for SYNC
@@ -36,5 +36,5 @@ index 797b73c..da3a842 100644
36 } else { 36 } else {
37 spin_unlock_bh(&pcr->completion_lock); 37 spin_unlock_bh(&pcr->completion_lock);
38-- 38--
392.3.5 392.7.0
40 40
diff --git a/recipes-kernel/cryptodev/files/0016-add-basic-detection-of-asym-features.patch b/recipes-kernel/cryptodev/sdk_patches/0016-add-basic-detection-of-asym-features.patch
index cefb6dc..9301349 100644
--- a/recipes-kernel/cryptodev/files/0016-add-basic-detection-of-asym-features.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0016-add-basic-detection-of-asym-features.patch
@@ -1,7 +1,7 @@
1From 586bc4a6cd1014c57364020013062f07a8861e38 Mon Sep 17 00:00:00 2001 1From 4ce4081d9abef651473e9d7e089a0748f77db631 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@freescale.com> 2From: Cristian Stoica <cristian.stoica@freescale.com>
3Date: Mon, 20 Apr 2015 13:18:47 +0300 3Date: Mon, 20 Apr 2015 13:18:47 +0300
4Subject: [PATCH] add basic detection of asym features 4Subject: [PATCH 16/38] add basic detection of asym features
5 5
6Change-Id: I3b3ba8664bf631a63be1f11e715024509e20f841 6Change-Id: I3b3ba8664bf631a63be1f11e715024509e20f841
7Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com> 7Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
@@ -33,5 +33,5 @@ index da3a842..53dbf64 100644
33 fd = clonefd(filp); 33 fd = clonefd(filp);
34 ret = put_user(fd, p); 34 ret = put_user(fd, p);
35-- 35--
362.3.5 362.7.0
37 37
diff --git a/recipes-kernel/cryptodev/files/0017-remove-dead-code.patch b/recipes-kernel/cryptodev/sdk_patches/0017-remove-dead-code.patch
index b3c36b3..07c389c 100644
--- a/recipes-kernel/cryptodev/files/0017-remove-dead-code.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0017-remove-dead-code.patch
@@ -1,7 +1,7 @@
1From 0ca641091b4113d73e75d30ef530c88836849308 Mon Sep 17 00:00:00 2001 1From 0ca641091b4113d73e75d30ef530c88836849308 Mon Sep 17 00:00:00 2001
2From: Tudor Ambarus <tudor.ambarus@freescale.com> 2From: Tudor Ambarus <tudor.ambarus@freescale.com>
3Date: Fri, 29 May 2015 15:28:47 +0300 3Date: Fri, 29 May 2015 15:28:47 +0300
4Subject: [PATCH 17/20] remove dead code 4Subject: [PATCH 17/38] remove dead code
5 5
6Functions kop_to_user and compat_kop_to_user are never used. Delete them 6Functions kop_to_user and compat_kop_to_user are never used. Delete them
7to avoid compiler warnings. 7to avoid compiler warnings.
@@ -63,5 +63,5 @@ index 53dbf64..39635a4 100644
63 compat_to_session_op(struct compat_session_op *compat, struct session_op *sop) 63 compat_to_session_op(struct compat_session_op *compat, struct session_op *sop)
64 { 64 {
65-- 65--
662.3.5 662.7.0
67 67
diff --git a/recipes-kernel/cryptodev/files/0018-fix-compat-warnings.patch b/recipes-kernel/cryptodev/sdk_patches/0018-fix-compat-warnings.patch
index bf93f5b..b0fcf0f 100644
--- a/recipes-kernel/cryptodev/files/0018-fix-compat-warnings.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0018-fix-compat-warnings.patch
@@ -1,7 +1,7 @@
1From 596378a22532908487f2c5e4d717c5ae618c4c7d Mon Sep 17 00:00:00 2001 1From 596378a22532908487f2c5e4d717c5ae618c4c7d Mon Sep 17 00:00:00 2001
2From: Tudor Ambarus <tudor.ambarus@freescale.com> 2From: Tudor Ambarus <tudor.ambarus@freescale.com>
3Date: Tue, 2 Jun 2015 10:44:12 +0300 3Date: Tue, 2 Jun 2015 10:44:12 +0300
4Subject: [PATCH 18/20] fix compat warnings 4Subject: [PATCH 18/38] fix compat warnings
5 5
6 CC [M] crypto/../../cryptodev-linux/ioctl.o 6 CC [M] crypto/../../cryptodev-linux/ioctl.o
7crypto/../../cryptodev-linux/ioctl.c: In function 'compat_to_crypt_kop': 7crypto/../../cryptodev-linux/ioctl.c: In function 'compat_to_crypt_kop':
@@ -60,5 +60,5 @@ index 39635a4..f3ce2f6 100644
60 kfree(pkc); 60 kfree(pkc);
61 } else { 61 } else {
62-- 62--
632.3.5 632.7.0
64 64
diff --git a/recipes-kernel/cryptodev/files/0019-fix-size_t-print-format.patch b/recipes-kernel/cryptodev/sdk_patches/0019-fix-size_t-print-format.patch
index a71cff4..fdf8c5d 100644
--- a/recipes-kernel/cryptodev/files/0019-fix-size_t-print-format.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0019-fix-size_t-print-format.patch
@@ -1,7 +1,7 @@
1From 1d10f06bef0f07980a08b387850c1daf1d3a8e87 Mon Sep 17 00:00:00 2001 1From 1d10f06bef0f07980a08b387850c1daf1d3a8e87 Mon Sep 17 00:00:00 2001
2From: Tudor Ambarus <tudor.ambarus@freescale.com> 2From: Tudor Ambarus <tudor.ambarus@freescale.com>
3Date: Tue, 2 Jun 2015 12:11:12 +0300 3Date: Tue, 2 Jun 2015 12:11:12 +0300
4Subject: [PATCH 19/20] fix size_t print format 4Subject: [PATCH 19/38] fix size_t print format
5 5
6 CC [M] crypto/../../cryptodev-linux/cryptlib.o 6 CC [M] crypto/../../cryptodev-linux/cryptlib.o
7crypto/../../cryptodev-linux/cryptlib.c: In function 'cryptodev_cipher_init': 7crypto/../../cryptodev-linux/cryptlib.c: In function 'cryptodev_cipher_init':
@@ -57,5 +57,5 @@ index 5882a30..10f5e1a 100644
57 ret = -EINVAL; 57 ret = -EINVAL;
58 goto error; 58 goto error;
59-- 59--
602.3.5 602.7.0
61 61
diff --git a/recipes-kernel/cryptodev/files/0020-fix-uninitialized-variable-compiler-warning.patch b/recipes-kernel/cryptodev/sdk_patches/0020-fix-uninitialized-variable-compiler-warning.patch
index a97a2d4..dddd77e 100644
--- a/recipes-kernel/cryptodev/files/0020-fix-uninitialized-variable-compiler-warning.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0020-fix-uninitialized-variable-compiler-warning.patch
@@ -1,7 +1,7 @@
1From be9f6a0dc90847dbb00307d23f47b8b3fc3ff130 Mon Sep 17 00:00:00 2001 1From be9f6a0dc90847dbb00307d23f47b8b3fc3ff130 Mon Sep 17 00:00:00 2001
2From: Tudor Ambarus <tudor.ambarus@freescale.com> 2From: Tudor Ambarus <tudor.ambarus@freescale.com>
3Date: Fri, 29 May 2015 15:49:22 +0300 3Date: Fri, 29 May 2015 15:49:22 +0300
4Subject: [PATCH 20/20] fix uninitialized variable compiler warning 4Subject: [PATCH 20/38] fix uninitialized variable compiler warning
5 5
6crypto/../../cryptodev-linux/ioctl.c: In function 'cryptodev_compat_ioctl': 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] 7crypto/../../cryptodev-linux/ioctl.c:1445:2: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
@@ -34,5 +34,5 @@ index f3ce2f6..7cd3c56 100644
34 34
35 for (i = 0; i < MAX_COOKIES; i++) { 35 for (i = 0; i < MAX_COOKIES; i++) {
36-- 36--
372.3.5 372.7.0
38 38
diff --git a/recipes-kernel/cryptodev/files/0021-check-return-codes-for-copy-to-from-user-functions.patch b/recipes-kernel/cryptodev/sdk_patches/0021-check-return-codes-for-copy-to-from-user-functions.patch
index 558d045..2cace5f 100644
--- a/recipes-kernel/cryptodev/files/0021-check-return-codes-for-copy-to-from-user-functions.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0021-check-return-codes-for-copy-to-from-user-functions.patch
@@ -1,7 +1,7 @@
1From 4078382cfc69c0f5e582d485fe8cc778f9e458d1 Mon Sep 17 00:00:00 2001 1From 4078382cfc69c0f5e582d485fe8cc778f9e458d1 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@freescale.com> 2From: Cristian Stoica <cristian.stoica@freescale.com>
3Date: Mon, 21 Sep 2015 16:39:52 +0300 3Date: Mon, 21 Sep 2015 16:39:52 +0300
4Subject: [PATCH 21/23] check return codes for copy to/from user functions 4Subject: [PATCH 21/38] check return codes for copy to/from user functions
5 5
6- these functions may fail and we should check their return codes. 6- these functions may fail and we should check their return codes.
7- fix an unintended fall-through in CRK_DSA_GENERATE_KEY 7- fix an unintended fall-through in CRK_DSA_GENERATE_KEY
@@ -394,5 +394,5 @@ index ed1c69a..e5adb93 100644
394 if (rc != -EINPROGRESS && rc != 0) 394 if (rc != -EINPROGRESS && rc != 0)
395 goto err; 395 goto err;
396-- 396--
3972.3.5 3972.7.0
398 398
diff --git a/recipes-kernel/cryptodev/files/0022-fix-double-free-pkc-req-on-error.patch b/recipes-kernel/cryptodev/sdk_patches/0022-fix-double-free-pkc-req-on-error.patch
index 6e747e0..7bc177e 100644
--- a/recipes-kernel/cryptodev/files/0022-fix-double-free-pkc-req-on-error.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0022-fix-double-free-pkc-req-on-error.patch
@@ -1,7 +1,7 @@
1From 85146b8429ba11bd0be68c24c17dd77b21ec8c25 Mon Sep 17 00:00:00 2001 1From 85146b8429ba11bd0be68c24c17dd77b21ec8c25 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@freescale.com> 2From: Cristian Stoica <cristian.stoica@freescale.com>
3Date: Mon, 12 Oct 2015 23:03:28 +0300 3Date: Mon, 12 Oct 2015 23:03:28 +0300
4Subject: [PATCH 22/23] fix double free pkc->req on error 4Subject: [PATCH 22/38] fix double free pkc->req on error
5 5
6Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com> 6Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
7--- 7---
@@ -22,5 +22,5 @@ index e5adb93..ec11129 100644
22 22
23 return err; 23 return err;
24-- 24--
252.3.5 252.7.0
26 26
diff --git a/recipes-kernel/cryptodev/files/0023-remove-MAY_BACKLOG-flag-from-requests.patch b/recipes-kernel/cryptodev/sdk_patches/0023-remove-MAY_BACKLOG-flag-from-requests.patch
index 32c3ddd..5674e03 100644
--- a/recipes-kernel/cryptodev/files/0023-remove-MAY_BACKLOG-flag-from-requests.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0023-remove-MAY_BACKLOG-flag-from-requests.patch
@@ -1,7 +1,7 @@
1From 7d0d0deb255f8c59b0cf6d3944ee2e3be4133b4c Mon Sep 17 00:00:00 2001 1From 7d0d0deb255f8c59b0cf6d3944ee2e3be4133b4c Mon Sep 17 00:00:00 2001
2From: Alex Porosanu <alexandru.porosanu@freescale.com> 2From: Alex Porosanu <alexandru.porosanu@freescale.com>
3Date: Mon, 19 Oct 2015 11:53:11 +0300 3Date: Mon, 19 Oct 2015 11:53:11 +0300
4Subject: [PATCH 23/23] remove MAY_BACKLOG flag from requests 4Subject: [PATCH 23/38] remove MAY_BACKLOG flag from requests
5 5
6cryptodev doesn't implement the backlogging mechanism properly, 6cryptodev doesn't implement the backlogging mechanism properly,
7since it misses the possibility of sleeping and waiting for 7since it misses the possibility of sleeping and waiting for
@@ -65,5 +65,5 @@ index 10f5e1a..eba4616 100644
65 if (ret != -EINPROGRESS && ret != 0) 65 if (ret != -EINPROGRESS && ret != 0)
66 goto error; 66 goto error;
67-- 67--
682.3.5 682.7.0
69 69
diff --git a/recipes-kernel/cryptodev/files/0024-fix-COMPAT_CIOCKEY-ioctl-command-number.patch b/recipes-kernel/cryptodev/sdk_patches/0024-fix-COMPAT_CIOCKEY-ioctl-command-number.patch
index 8d0bd8b..7277086 100644
--- a/recipes-kernel/cryptodev/files/0024-fix-COMPAT_CIOCKEY-ioctl-command-number.patch
+++ b/recipes-kernel/cryptodev/sdk_patches/0024-fix-COMPAT_CIOCKEY-ioctl-command-number.patch
@@ -1,7 +1,7 @@
1From 53e4d0fe4a334dae3df32b2053e4ebdfda2e9148 Mon Sep 17 00:00:00 2001 1From 53e4d0fe4a334dae3df32b2053e4ebdfda2e9148 Mon Sep 17 00:00:00 2001
2From: Tudor Ambarus <tudor.ambarus@freescale.com> 2From: Tudor Ambarus <tudor.ambarus@freescale.com>
3Date: Tue, 27 Oct 2015 15:51:02 +0200 3Date: Tue, 27 Oct 2015 15:51:02 +0200
4Subject: [PATCH] fix COMPAT_CIOCKEY ioctl command number 4Subject: [PATCH 24/38] fix COMPAT_CIOCKEY ioctl command number
5 5
6CIOCKEY and COMPAT_CIOCKEY had different command numbers, 6CIOCKEY and COMPAT_CIOCKEY had different command numbers,
7so that 32-bit applications got EINVAL error on 64-bit kernel. 7so that 32-bit applications got EINVAL error on 64-bit kernel.
@@ -25,5 +25,5 @@ index c83c885..cb005d7 100644
25 #define COMPAT_CIOCASYNCFETCH _IOR('c', 108, struct compat_crypt_op) 25 #define COMPAT_CIOCASYNCFETCH _IOR('c', 108, struct compat_crypt_op)
26 #define COMPAT_CIOCAUTHCRYPT _IOWR('c', 109, struct compat_crypt_auth_op) 26 #define COMPAT_CIOCAUTHCRYPT _IOWR('c', 109, struct compat_crypt_auth_op)
27-- 27--
282.3.3 282.7.0
29 29
diff --git a/recipes-kernel/cryptodev/sdk_patches/0025-fix-benchmarks-linking.patch b/recipes-kernel/cryptodev/sdk_patches/0025-fix-benchmarks-linking.patch
new file mode 100644
index 0000000..608c681
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0025-fix-benchmarks-linking.patch
@@ -0,0 +1,25 @@
1From 978cfcf9253c409520c0f168f8caa249f50a8843 Mon Sep 17 00:00:00 2001
2From: Fridolin Pokorny <fpokorny@redhat.com>
3Date: Fri, 8 Jan 2016 09:38:29 +0100
4Subject: [PATCH 25/38] fix benchmarks linking
5
6---
7 lib/Makefile | 2 +-
8 1 file changed, 1 insertion(+), 1 deletion(-)
9
10diff --git a/lib/Makefile b/lib/Makefile
11index af87795..3bedc34 100644
12--- a/lib/Makefile
13+++ b/lib/Makefile
14@@ -3,7 +3,7 @@ CFLAGS=-g -O2 -Wall
15 all: benchmark
16
17 benchmark: main.c libthreshold.a
18- gcc $(CFLAGS) -DDEBUG -o $@ $^ -lssl libthreshold.a
19+ gcc $(CFLAGS) -DDEBUG -o $@ $^ -lssl -lcrypto libthreshold.a
20
21 .o:
22 gcc $(CCFLAGS) -c $< -o $@
23--
242.7.0
25
diff --git a/recipes-kernel/cryptodev/sdk_patches/0026-fix-Makefile-to-allow-parallel-make-with-j-option.patch b/recipes-kernel/cryptodev/sdk_patches/0026-fix-Makefile-to-allow-parallel-make-with-j-option.patch
new file mode 100644
index 0000000..b8cf4e1
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0026-fix-Makefile-to-allow-parallel-make-with-j-option.patch
@@ -0,0 +1,56 @@
1From d96ae48c87f80af1a202c2d2e837bf477edc0fb7 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Thu, 10 Dec 2015 12:42:18 +0200
4Subject: [PATCH 26/38] fix Makefile to allow parallel make with -j option
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Recursive make commands should always use the variable MAKE, not the
10explicit command name ‘make’
11
12Documented in section "5.7.1 How the MAKE Variable Works" of GNU Make manual
13
14Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
15---
16 Makefile | 10 +++++-----
17 1 file changed, 5 insertions(+), 5 deletions(-)
18
19diff --git a/Makefile b/Makefile
20index 9e56e9d..2f50210 100644
21--- a/Makefile
22+++ b/Makefile
23@@ -22,7 +22,7 @@ KERNEL_MAKE_OPTS += CROSS_COMPILE=${CROSS_COMPILE}
24 endif
25
26 build: version.h
27- make ${KERNEL_MAKE_OPTS} modules
28+ $(MAKE) $(KERNEL_MAKE_OPTS) modules
29
30 version.h: Makefile
31 @echo "#define VERSION \"$(VERSION)\"" > version.h
32@@ -30,17 +30,17 @@ version.h: Makefile
33 install: modules_install
34
35 modules_install:
36- make -C $(KERNEL_DIR) SUBDIRS=`pwd` modules_install
37+ $(MAKE) -C $(KERNEL_DIR) SUBDIRS=`pwd` modules_install
38 @echo "Installing cryptodev.h in $(PREFIX)/usr/include/crypto ..."
39 @install -D crypto/cryptodev.h $(PREFIX)/usr/include/crypto/cryptodev.h
40
41 clean:
42- make -C $(KERNEL_DIR) SUBDIRS=`pwd` clean
43+ $(MAKE) -C $(KERNEL_DIR) SUBDIRS=`pwd` clean
44 rm -f $(hostprogs) *~
45- CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) make -C tests clean
46+ CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) $(MAKE) -C tests clean
47
48 check:
49- CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) make -C tests check
50+ CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) $(MAKE) -C tests check
51
52 CPOPTS =
53 ifneq (${SHOW_TYPES},)
54--
552.7.0
56
diff --git a/recipes-kernel/cryptodev/sdk_patches/0027-use-Linux-kernel-conventions-for-Makefile-variables.patch b/recipes-kernel/cryptodev/sdk_patches/0027-use-Linux-kernel-conventions-for-Makefile-variables.patch
new file mode 100644
index 0000000..ad18da8
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0027-use-Linux-kernel-conventions-for-Makefile-variables.patch
@@ -0,0 +1,47 @@
1From e51bf208fbd3796238ff4d721e8d070f711f8c56 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Thu, 10 Dec 2015 12:42:19 +0200
4Subject: [PATCH 27/38] use Linux kernel conventions for Makefile variables
5
6The kernel Makefile specifies to use M=... instead of SUBDIR=... for
7external modules.
8
9PWD variable is already set in a POSIX system and calling `pwd` to find
10it is redundant.
11
12Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
13---
14 Makefile | 6 +++---
15 1 file changed, 3 insertions(+), 3 deletions(-)
16
17diff --git a/Makefile b/Makefile
18index 2f50210..7c7e193 100644
19--- a/Makefile
20+++ b/Makefile
21@@ -13,7 +13,7 @@ cryptodev-objs = ioctl.o main.o cryptlib.o authenc.o zc.o util.o
22
23 obj-m += cryptodev.o
24
25-KERNEL_MAKE_OPTS := -C ${KERNEL_DIR} SUBDIRS=`pwd`
26+KERNEL_MAKE_OPTS := -C $(KERNEL_DIR) M=$(PWD)
27 ifneq (${ARCH},)
28 KERNEL_MAKE_OPTS += ARCH=${ARCH}
29 endif
30@@ -30,12 +30,12 @@ version.h: Makefile
31 install: modules_install
32
33 modules_install:
34- $(MAKE) -C $(KERNEL_DIR) SUBDIRS=`pwd` modules_install
35+ $(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules_install
36 @echo "Installing cryptodev.h in $(PREFIX)/usr/include/crypto ..."
37 @install -D crypto/cryptodev.h $(PREFIX)/usr/include/crypto/cryptodev.h
38
39 clean:
40- $(MAKE) -C $(KERNEL_DIR) SUBDIRS=`pwd` clean
41+ $(MAKE) -C $(KERNEL_DIR) M=$(PWD) clean
42 rm -f $(hostprogs) *~
43 CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) $(MAKE) -C tests clean
44
45--
462.7.0
47
diff --git a/recipes-kernel/cryptodev/sdk_patches/0028-for-consistency-use-.-instead-of-.-in-makefiles.patch b/recipes-kernel/cryptodev/sdk_patches/0028-for-consistency-use-.-instead-of-.-in-makefiles.patch
new file mode 100644
index 0000000..756ca33
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0028-for-consistency-use-.-instead-of-.-in-makefiles.patch
@@ -0,0 +1,73 @@
1From 22b63631de17507c12355c30e408dbd88350bb3a Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Thu, 10 Dec 2015 12:42:20 +0200
4Subject: [PATCH 28/38] for consistency, use $(...) instead of ${...} in
5 makefiles
6
7Both syntax rules are equaly valid and mixing them is permitted but
8looks inconsistent.
9
10See section "6.1 Basics of Variable References" of GNU make manual
11
12Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
13---
14 Makefile | 16 ++++++++--------
15 tests/Makefile | 2 +-
16 2 files changed, 9 insertions(+), 9 deletions(-)
17
18diff --git a/Makefile b/Makefile
19index 7c7e193..7f8df37 100644
20--- a/Makefile
21+++ b/Makefile
22@@ -14,11 +14,11 @@ cryptodev-objs = ioctl.o main.o cryptlib.o authenc.o zc.o util.o
23 obj-m += cryptodev.o
24
25 KERNEL_MAKE_OPTS := -C $(KERNEL_DIR) M=$(PWD)
26-ifneq (${ARCH},)
27-KERNEL_MAKE_OPTS += ARCH=${ARCH}
28+ifneq ($(ARCH),)
29+KERNEL_MAKE_OPTS += ARCH=$(ARCH)
30 endif
31-ifneq (${CROSS_COMPILE},)
32-KERNEL_MAKE_OPTS += CROSS_COMPILE=${CROSS_COMPILE}
33+ifneq ($(CROSS_COMPILE),)
34+KERNEL_MAKE_OPTS += CROSS_COMPILE=$(CROSS_COMPILE)
35 endif
36
37 build: version.h
38@@ -43,15 +43,15 @@ check:
39 CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) $(MAKE) -C tests check
40
41 CPOPTS =
42-ifneq (${SHOW_TYPES},)
43+ifneq ($(SHOW_TYPES),)
44 CPOPTS += --show-types
45 endif
46-ifneq (${IGNORE_TYPES},)
47-CPOPTS += --ignore ${IGNORE_TYPES}
48+ifneq ($(IGNORE_TYPES),)
49+CPOPTS += --ignore $(IGNORE_TYPES)
50 endif
51
52 checkpatch:
53- $(KERNEL_DIR)/scripts/checkpatch.pl ${CPOPTS} --file *.c *.h
54+ $(KERNEL_DIR)/scripts/checkpatch.pl $(CPOPTS) --file *.c *.h
55
56 VERSIONTAG = refs/tags/cryptodev-linux-$(VERSION)
57 FILEBASE = cryptodev-linux-$(VERSION)
58diff --git a/tests/Makefile b/tests/Makefile
59index 20c52ba..3155da9 100644
60--- a/tests/Makefile
61+++ b/tests/Makefile
62@@ -6,7 +6,7 @@ comp_progs := cipher_comp hash_comp hmac_comp
63
64 hostprogs := cipher cipher-aead hmac speed async_cipher async_hmac \
65 async_speed sha_speed hashcrypt_speed fullspeed cipher-gcm \
66- cipher-aead-srtp ${comp_progs}
67+ cipher-aead-srtp $(comp_progs)
68
69 example-cipher-objs := cipher.o
70 example-cipher-aead-objs := cipher-aead.o
71--
722.7.0
73
diff --git a/recipes-kernel/cryptodev/sdk_patches/0029-fix-clean-up-on-error-path-for-crypto_create_session.patch b/recipes-kernel/cryptodev/sdk_patches/0029-fix-clean-up-on-error-path-for-crypto_create_session.patch
new file mode 100644
index 0000000..67e4a89
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0029-fix-clean-up-on-error-path-for-crypto_create_session.patch
@@ -0,0 +1,117 @@
1From 294abaaa4540ec340ed6046a784c9789c8724420 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Mon, 11 Jan 2016 17:45:50 +0200
4Subject: [PATCH 29/38] fix clean-up on error path for crypto_create_session
5
6This patch fixes clean-up on error path for failed allocations of
7ses_new->pages or ses_new->sg. In these cases, allocations made in
8cryptodev_hash_init have not been undone resulting in possible memory
9leaks.
10
11We take advantage of the initializations with zeros of the session
12structure to trim the code to a single clean-up path.
13
14Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
15---
16 ioctl.c | 28 +++++++++++++++-------------
17 1 file changed, 15 insertions(+), 13 deletions(-)
18
19diff --git a/ioctl.c b/ioctl.c
20index b23f5fd..c781f9d 100644
21--- a/ioctl.c
22+++ b/ioctl.c
23@@ -228,7 +228,8 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
24 return -EINVAL;
25 }
26
27- /* Create a session and put it to the list. */
28+ /* Create a session and put it to the list. Zeroing the structure helps
29+ * also with a single exit point in case of errors */
30 ses_new = kzalloc(sizeof(*ses_new), GFP_KERNEL);
31 if (!ses_new)
32 return -ENOMEM;
33@@ -240,19 +241,19 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
34 if (unlikely(ret < 0)) {
35 ddebug(1, "Setting key failed for %s-%zu.",
36 alg_name, (size_t)sop->keylen*8);
37- goto error_cipher;
38+ goto session_error;
39 }
40
41 ret = cryptodev_get_cipher_key(keys.ckey, sop, aead);
42 if (unlikely(ret < 0))
43- goto error_cipher;
44+ goto session_error;
45
46 ret = cryptodev_cipher_init(&ses_new->cdata, alg_name, keys.ckey,
47 keylen, stream, aead);
48 if (ret < 0) {
49 ddebug(1, "Failed to load cipher for %s", alg_name);
50 ret = -EINVAL;
51- goto error_cipher;
52+ goto session_error;
53 }
54 }
55
56@@ -261,13 +262,13 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
57 ddebug(1, "Setting key failed for %s-%zu.",
58 hash_name, (size_t)sop->mackeylen*8);
59 ret = -EINVAL;
60- goto error_hash;
61+ goto session_error;
62 }
63
64 if (sop->mackey && unlikely(copy_from_user(keys.mkey, sop->mackey,
65 sop->mackeylen))) {
66 ret = -EFAULT;
67- goto error_hash;
68+ goto session_error;
69 }
70
71 ret = cryptodev_hash_init(&ses_new->hdata, hash_name, hmac_mode,
72@@ -275,7 +276,7 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
73 if (ret != 0) {
74 ddebug(1, "Failed to load hash for %s", hash_name);
75 ret = -EINVAL;
76- goto error_hash;
77+ goto session_error;
78 }
79 }
80
81@@ -292,7 +293,7 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
82 if (ses_new->sg == NULL || ses_new->pages == NULL) {
83 ddebug(0, "Memory error");
84 ret = -ENOMEM;
85- goto error_hash;
86+ goto session_error;
87 }
88
89 /* put the new session to the list */
90@@ -316,18 +317,19 @@ restart:
91
92 /* Fill in some values for the user. */
93 sop->ses = ses_new->sid;
94-
95 return 0;
96
97-error_hash:
98+ /* We count on ses_new to be initialized with zeroes
99+ * Since hdata and cdata are embedded within ses_new, it follows that
100+ * hdata->init and cdata->init are either zero or one as they have been
101+ * initialized or not */
102+session_error:
103+ cryptodev_hash_deinit(&ses_new->hdata);
104 cryptodev_cipher_deinit(&ses_new->cdata);
105 kfree(ses_new->sg);
106 kfree(ses_new->pages);
107-error_cipher:
108 kfree(ses_new);
109-
110 return ret;
111-
112 }
113
114 /* Everything that needs to be done when remowing a session. */
115--
1162.7.0
117
diff --git a/recipes-kernel/cryptodev/sdk_patches/0030-remove-code-duplication-in-cryptodev_hash_init.patch b/recipes-kernel/cryptodev/sdk_patches/0030-remove-code-duplication-in-cryptodev_hash_init.patch
new file mode 100644
index 0000000..1e3ebf3
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0030-remove-code-duplication-in-cryptodev_hash_init.patch
@@ -0,0 +1,59 @@
1From f4534df637b078fce275763bd8bc2a83bfad25e0 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Mon, 11 Jan 2016 18:01:06 +0200
4Subject: [PATCH 30/38] remove code duplication in cryptodev_hash_init
5
6cryptodev_hash_init is concerned mostly with allocating data structures
7for hash operations.
8This patch replaces the call it makes to crypto_ahash_init with
9one to cryptodev_hash_reset to avoid code duplication. This call is made
10now outside of the original function to increase modularity.
11
12Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
13---
14 cryptlib.c | 9 ---------
15 ioctl.c | 5 +++++
16 2 files changed, 5 insertions(+), 9 deletions(-)
17
18diff --git a/cryptlib.c b/cryptlib.c
19index eba4616..4fd29eb 100644
20--- a/cryptlib.c
21+++ b/cryptlib.c
22@@ -362,18 +362,9 @@ int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name,
23
24 ahash_request_set_callback(hdata->async.request, 0,
25 cryptodev_complete, hdata->async.result);
26-
27- ret = crypto_ahash_init(hdata->async.request);
28- if (unlikely(ret)) {
29- derr(0, "error in crypto_hash_init()");
30- goto error_request;
31- }
32-
33 hdata->init = 1;
34 return 0;
35
36-error_request:
37- ahash_request_free(hdata->async.request);
38 error:
39 kfree(hdata->async.result);
40 crypto_free_ahash(hdata->async.s);
41diff --git a/ioctl.c b/ioctl.c
42index b36dd03..a537886 100644
43--- a/ioctl.c
44+++ b/ioctl.c
45@@ -338,6 +338,11 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
46 ret = -EINVAL;
47 goto session_error;
48 }
49+
50+ ret = cryptodev_hash_reset(&ses_new->hdata);
51+ if (ret != 0) {
52+ goto session_error;
53+ }
54 }
55
56 ses_new->alignmask = max(ses_new->cdata.alignmask,
57--
582.7.0
59
diff --git a/recipes-kernel/cryptodev/sdk_patches/0031-fix-comment-typo.patch b/recipes-kernel/cryptodev/sdk_patches/0031-fix-comment-typo.patch
new file mode 100644
index 0000000..cde9552
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0031-fix-comment-typo.patch
@@ -0,0 +1,26 @@
1From 73a2489ba634503a0cc2bb6e84627ceeda0f059f Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Tue, 12 Jan 2016 17:15:56 +0200
4Subject: [PATCH 31/38] fix comment typo
5
6Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
7---
8 ioctl.c | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11diff --git a/ioctl.c b/ioctl.c
12index a537886..7adde75 100644
13--- a/ioctl.c
14+++ b/ioctl.c
15@@ -397,7 +397,7 @@ session_error:
16 return ret;
17 }
18
19-/* Everything that needs to be done when remowing a session. */
20+/* Everything that needs to be done when removing a session. */
21 static inline void
22 crypto_destroy_session(struct csession *ses_ptr)
23 {
24--
252.7.0
26
diff --git a/recipes-kernel/cryptodev/sdk_patches/0032-avoid-calls-to-kmalloc-on-hotpaths.patch b/recipes-kernel/cryptodev/sdk_patches/0032-avoid-calls-to-kmalloc-on-hotpaths.patch
new file mode 100644
index 0000000..2aa5810
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0032-avoid-calls-to-kmalloc-on-hotpaths.patch
@@ -0,0 +1,220 @@
1From 9b513838035c35fd3706bb824edd17d705641439 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Tue, 12 Jan 2016 15:13:15 +0200
4Subject: [PATCH 32/38] avoid calls to kmalloc on hotpaths
5
6We replace a pointer to a small structure with the structure itself to
7avoid unnecessary dynamic allocations at runtime. The embedding
8structure is itself dynamically allocated and we get a slight increase
9in performance from elimination of unnecessary code.
10
11Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
12---
13 cryptlib.c | 42 +++++++++++++-----------------------------
14 cryptlib.h | 14 +++++++-------
15 2 files changed, 20 insertions(+), 36 deletions(-)
16
17diff --git a/cryptlib.c b/cryptlib.c
18index 4fd29eb..5972fc2 100644
19--- a/cryptlib.c
20+++ b/cryptlib.c
21@@ -178,13 +178,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
22 out->stream = stream;
23 out->aead = aead;
24
25- out->async.result = kzalloc(sizeof(*out->async.result), GFP_KERNEL);
26- if (unlikely(!out->async.result)) {
27- ret = -ENOMEM;
28- goto error;
29- }
30-
31- init_completion(&out->async.result->completion);
32+ init_completion(&out->async.result.completion);
33
34 if (aead == 0) {
35 out->async.request = ablkcipher_request_alloc(out->async.s, GFP_KERNEL);
36@@ -195,7 +189,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
37 }
38
39 ablkcipher_request_set_callback(out->async.request, 0,
40- cryptodev_complete, out->async.result);
41+ cryptodev_complete, &out->async.result);
42 } else {
43 out->async.arequest = aead_request_alloc(out->async.as, GFP_KERNEL);
44 if (unlikely(!out->async.arequest)) {
45@@ -205,7 +199,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
46 }
47
48 aead_request_set_callback(out->async.arequest, 0,
49- cryptodev_complete, out->async.result);
50+ cryptodev_complete, &out->async.result);
51 }
52
53 out->init = 1;
54@@ -222,7 +216,6 @@ error:
55 if (out->async.as)
56 crypto_free_aead(out->async.as);
57 }
58- kfree(out->async.result);
59
60 return ret;
61 }
62@@ -242,7 +235,6 @@ void cryptodev_cipher_deinit(struct cipher_data *cdata)
63 crypto_free_aead(cdata->async.as);
64 }
65
66- kfree(cdata->async.result);
67 cdata->init = 0;
68 }
69 }
70@@ -279,7 +271,7 @@ ssize_t cryptodev_cipher_encrypt(struct cipher_data *cdata,
71 {
72 int ret;
73
74- reinit_completion(&cdata->async.result->completion);
75+ reinit_completion(&cdata->async.result.completion);
76
77 if (cdata->aead == 0) {
78 ablkcipher_request_set_crypt(cdata->async.request,
79@@ -293,7 +285,7 @@ ssize_t cryptodev_cipher_encrypt(struct cipher_data *cdata,
80 ret = crypto_aead_encrypt(cdata->async.arequest);
81 }
82
83- return waitfor(cdata->async.result, ret);
84+ return waitfor(&cdata->async.result, ret);
85 }
86
87 ssize_t cryptodev_cipher_decrypt(struct cipher_data *cdata,
88@@ -302,7 +294,7 @@ ssize_t cryptodev_cipher_decrypt(struct cipher_data *cdata,
89 {
90 int ret;
91
92- reinit_completion(&cdata->async.result->completion);
93+ reinit_completion(&cdata->async.result.completion);
94 if (cdata->aead == 0) {
95 ablkcipher_request_set_crypt(cdata->async.request,
96 (struct scatterlist *)src, dst,
97@@ -315,7 +307,7 @@ ssize_t cryptodev_cipher_decrypt(struct cipher_data *cdata,
98 ret = crypto_aead_decrypt(cdata->async.arequest);
99 }
100
101- return waitfor(cdata->async.result, ret);
102+ return waitfor(&cdata->async.result, ret);
103 }
104
105 /* Hash functions */
106@@ -345,13 +337,7 @@ int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name,
107 hdata->digestsize = crypto_ahash_digestsize(hdata->async.s);
108 hdata->alignmask = crypto_ahash_alignmask(hdata->async.s);
109
110- hdata->async.result = kzalloc(sizeof(*hdata->async.result), GFP_KERNEL);
111- if (unlikely(!hdata->async.result)) {
112- ret = -ENOMEM;
113- goto error;
114- }
115-
116- init_completion(&hdata->async.result->completion);
117+ init_completion(&hdata->async.result.completion);
118
119 hdata->async.request = ahash_request_alloc(hdata->async.s, GFP_KERNEL);
120 if (unlikely(!hdata->async.request)) {
121@@ -361,12 +347,11 @@ int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name,
122 }
123
124 ahash_request_set_callback(hdata->async.request, 0,
125- cryptodev_complete, hdata->async.result);
126+ cryptodev_complete, &hdata->async.result);
127 hdata->init = 1;
128 return 0;
129
130 error:
131- kfree(hdata->async.result);
132 crypto_free_ahash(hdata->async.s);
133 return ret;
134 }
135@@ -376,7 +361,6 @@ void cryptodev_hash_deinit(struct hash_data *hdata)
136 if (hdata->init) {
137 if (hdata->async.request)
138 ahash_request_free(hdata->async.request);
139- kfree(hdata->async.result);
140 if (hdata->async.s)
141 crypto_free_ahash(hdata->async.s);
142 hdata->init = 0;
143@@ -402,24 +386,24 @@ ssize_t cryptodev_hash_update(struct hash_data *hdata,
144 {
145 int ret;
146
147- reinit_completion(&hdata->async.result->completion);
148+ reinit_completion(&hdata->async.result.completion);
149 ahash_request_set_crypt(hdata->async.request, sg, NULL, len);
150
151 ret = crypto_ahash_update(hdata->async.request);
152
153- return waitfor(hdata->async.result, ret);
154+ return waitfor(&hdata->async.result, ret);
155 }
156
157 int cryptodev_hash_final(struct hash_data *hdata, void *output)
158 {
159 int ret;
160
161- reinit_completion(&hdata->async.result->completion);
162+ reinit_completion(&hdata->async.result.completion);
163 ahash_request_set_crypt(hdata->async.request, NULL, output, 0);
164
165 ret = crypto_ahash_final(hdata->async.request);
166
167- return waitfor(hdata->async.result, ret);
168+ return waitfor(&hdata->async.result, ret);
169 }
170
171 int cryptodev_pkc_offload(struct cryptodev_pkc *pkc)
172diff --git a/cryptlib.h b/cryptlib.h
173index e1c4e3e..d8e8046 100644
174--- a/cryptlib.h
175+++ b/cryptlib.h
176@@ -6,6 +6,11 @@
177
178 #include <linux/version.h>
179
180+struct cryptodev_result {
181+ struct completion completion;
182+ int err;
183+};
184+
185 struct cipher_data {
186 int init; /* 0 uninitialized */
187 int blocksize;
188@@ -22,7 +27,7 @@ struct cipher_data {
189 struct crypto_aead *as;
190 struct aead_request *arequest;
191
192- struct cryptodev_result *result;
193+ struct cryptodev_result result;
194 uint8_t iv[EALG_MAX_BLOCK_LEN];
195 } async;
196 };
197@@ -85,7 +90,7 @@ struct hash_data {
198 int alignmask;
199 struct {
200 struct crypto_ahash *s;
201- struct cryptodev_result *result;
202+ struct cryptodev_result result;
203 struct ahash_request *request;
204 } async;
205 };
206@@ -104,11 +109,6 @@ enum offload_type {
207 ASYNCHRONOUS
208 };
209
210-struct cryptodev_result {
211- struct completion completion;
212- int err;
213-};
214-
215 struct cryptodev_pkc {
216 struct list_head list; /* To maintain the Jobs in completed
217 cryptodev lists */
218--
2192.7.0
220
diff --git a/recipes-kernel/cryptodev/sdk_patches/0033-avoid-unnecessary-checks-for-hash-clean-up.patch b/recipes-kernel/cryptodev/sdk_patches/0033-avoid-unnecessary-checks-for-hash-clean-up.patch
new file mode 100644
index 0000000..3ce8a5f
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0033-avoid-unnecessary-checks-for-hash-clean-up.patch
@@ -0,0 +1,33 @@
1From 774c6bd169b683ed54ebad164d0ff541e1381a64 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Tue, 12 Jan 2016 17:09:33 +0200
4Subject: [PATCH 33/38] avoid unnecessary checks for hash clean-up
5
6hdata->init is set only after all necessary allocations succeed. On
7clean-up is no longer necessary to make the allocation checks.
8
9Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
10---
11 cryptlib.c | 6 ++----
12 1 file changed, 2 insertions(+), 4 deletions(-)
13
14diff --git a/cryptlib.c b/cryptlib.c
15index 5972fc2..5d1a5a9 100644
16--- a/cryptlib.c
17+++ b/cryptlib.c
18@@ -359,10 +359,8 @@ error:
19 void cryptodev_hash_deinit(struct hash_data *hdata)
20 {
21 if (hdata->init) {
22- if (hdata->async.request)
23- ahash_request_free(hdata->async.request);
24- if (hdata->async.s)
25- crypto_free_ahash(hdata->async.s);
26+ ahash_request_free(hdata->async.request);
27+ crypto_free_ahash(hdata->async.s);
28 hdata->init = 0;
29 }
30 }
31--
322.7.0
33
diff --git a/recipes-kernel/cryptodev/sdk_patches/0034-extend-API-with-CIOCHASH-to-support-direct-hash-oper.patch b/recipes-kernel/cryptodev/sdk_patches/0034-extend-API-with-CIOCHASH-to-support-direct-hash-oper.patch
new file mode 100644
index 0000000..3a1f0c0
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0034-extend-API-with-CIOCHASH-to-support-direct-hash-oper.patch
@@ -0,0 +1,114 @@
1From c43fa74b9ed11f0183d25b21486b71fe02d84de7 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Tue, 15 Dec 2015 15:31:47 +0200
4Subject: [PATCH 34/38] extend API with CIOCHASH to support direct hash
5 operations
6
7Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
8---
9 crypto/cryptodev.h | 16 ++++++++++++++++
10 ioctl.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
11 2 files changed, 65 insertions(+)
12
13diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h
14index f6058ca..c6083f7 100644
15--- a/crypto/cryptodev.h
16+++ b/crypto/cryptodev.h
17@@ -167,6 +167,19 @@ struct crypt_auth_op {
18 __u32 iv_len;
19 };
20
21+/* data container for CIOCHASH operations */
22+struct hash_op_data {
23+ __u32 ses; /* session identifier */
24+ __u32 mac_op; /* cryptodev_crypto_op_t */
25+ __u8 *mackey;
26+ __u32 mackeylen;
27+
28+ __u16 flags; /* see COP_FLAG_* */
29+ __u32 len; /* length of source data */
30+ __u8 *src; /* source data */
31+ __u8 *mac_result;
32+};
33+
34 /* In plain AEAD mode the following are required:
35 * flags : 0
36 * iv : the initialization vector (12 bytes)
37@@ -325,4 +338,7 @@ enum cryptodev_crk_op_t {
38 /* additional ioctls for asynchronous operation for asymmetric ciphers*/
39 #define CIOCASYMASYNCRYPT _IOW('c', 112, struct crypt_kop)
40 #define CIOCASYMFETCHCOOKIE _IOR('c', 113, struct pkc_cookie_list_s)
41+
42+#define CIOCHASH _IOWR('c', 114, struct hash_op_data)
43+
44 #endif /* L_CRYPTODEV_H */
45diff --git a/ioctl.c b/ioctl.c
46index 7adde75..3763954 100644
47--- a/ioctl.c
48+++ b/ioctl.c
49@@ -960,6 +960,7 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
50 void __user *arg = (void __user *)arg_;
51 int __user *p = arg;
52 struct session_op sop;
53+ struct hash_op_data hash_op;
54 struct kernel_crypt_op kcop;
55 struct kernel_crypt_auth_op kcaop;
56 struct crypt_priv *pcr = filp->private_data;
57@@ -1049,6 +1050,54 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
58 }
59
60 return kcop_to_user(&kcop, fcr, arg);
61+ case CIOCHASH:
62+ /* get session */
63+ if (unlikely(copy_from_user(&hash_op, arg, sizeof(struct hash_op_data)))) {
64+ pr_err("copy from user fault\n");
65+ return -EFAULT;
66+ }
67+
68+ sop.cipher = 0;
69+ sop.mac = hash_op.mac_op;
70+ sop.mackey = hash_op.mackey;
71+ sop.mackeylen = hash_op.mackeylen;
72+
73+ /* writes sop.ses as a side-effect */
74+ ret = crypto_create_session(fcr, &sop);
75+ if (unlikely(ret)) {
76+ pr_err("can't get session\n");
77+ return ret;
78+ }
79+
80+ /* do hashing */
81+ kcop.cop.ses = sop.ses;
82+ kcop.cop.flags = hash_op.flags;
83+ kcop.cop.len = hash_op.len;
84+ kcop.cop.src = hash_op.src;
85+ kcop.cop.mac = hash_op.mac_result;
86+ kcop.cop.dst = 0;
87+ kcop.cop.op = 0;
88+ kcop.cop.iv = 0;
89+ kcop.ivlen = 0;
90+ kcop.digestsize = 0; /* will be updated during operation */
91+ kcop.task = current;
92+ kcop.mm = current->mm;
93+
94+ ret = crypto_run(fcr, &kcop);
95+ if (unlikely(ret)) {
96+ dwarning(1, "Error in hash run");
97+ return ret;
98+ }
99+
100+ ret = copy_to_user(kcop.cop.mac, kcop.hash_output, kcop.digestsize);
101+ if (unlikely(ret)) {
102+ dwarning(1, "Error in copy to user");
103+ return ret;
104+ }
105+
106+ /* put session */
107+ ret = crypto_finish_session(fcr, sop.ses);
108+ return 0;
109 case CIOCAUTHCRYPT:
110 if (unlikely(ret = kcaop_from_user(&kcaop, fcr, arg))) {
111 dwarning(1, "Error copying from user");
112--
1132.7.0
114
diff --git a/recipes-kernel/cryptodev/sdk_patches/0035-use-directly-crypto-API-digest-operation-for-CIOCHAS.patch b/recipes-kernel/cryptodev/sdk_patches/0035-use-directly-crypto-API-digest-operation-for-CIOCHAS.patch
new file mode 100644
index 0000000..4745dc9
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0035-use-directly-crypto-API-digest-operation-for-CIOCHAS.patch
@@ -0,0 +1,315 @@
1From f123f38532ae022e818312a9bc04cdb287e9623f Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Thu, 17 Dec 2015 10:34:20 +0200
4Subject: [PATCH 35/38] use directly crypto API 'digest' operation for CIOCHASH
5
6Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
7---
8 crypto/cryptodev.h | 2 +-
9 cryptodev_int.h | 10 ++++
10 ioctl.c | 158 ++++++++++++++++++++++++++++++++++++++++++++---------
11 main.c | 39 ++++++++++++-
12 4 files changed, 179 insertions(+), 30 deletions(-)
13
14diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h
15index c6083f7..9ade102 100644
16--- a/crypto/cryptodev.h
17+++ b/crypto/cryptodev.h
18@@ -169,7 +169,7 @@ struct crypt_auth_op {
19
20 /* data container for CIOCHASH operations */
21 struct hash_op_data {
22- __u32 ses; /* session identifier */
23+ struct csession *ses; /* session identifier */
24 __u32 mac_op; /* cryptodev_crypto_op_t */
25 __u8 *mackey;
26 __u32 mackeylen;
27diff --git a/cryptodev_int.h b/cryptodev_int.h
28index cb005d7..74c295a 100644
29--- a/cryptodev_int.h
30+++ b/cryptodev_int.h
31@@ -164,6 +164,15 @@ struct kernel_crypt_op {
32 struct mm_struct *mm;
33 };
34
35+struct kernel_hash_op {
36+ struct hash_op_data hash_op;
37+
38+ int digestsize;
39+ uint8_t hash_output[AALG_MAX_RESULT_LEN];
40+ struct task_struct *task;
41+ struct mm_struct *mm;
42+};
43+
44 struct kernel_crypt_auth_op {
45 struct crypt_auth_op caop;
46
47@@ -192,6 +201,7 @@ int kcaop_to_user(struct kernel_crypt_auth_op *kcaop,
48 struct fcrypt *fcr, void __user *arg);
49 int crypto_auth_run(struct fcrypt *fcr, struct kernel_crypt_auth_op *kcaop);
50 int crypto_run(struct fcrypt *fcr, struct kernel_crypt_op *kcop);
51+int hash_run(struct kernel_hash_op *khop);
52
53 #include <cryptlib.h>
54
55diff --git a/ioctl.c b/ioctl.c
56index 3763954..a052614 100644
57--- a/ioctl.c
58+++ b/ioctl.c
59@@ -397,7 +397,128 @@ session_error:
60 return ret;
61 }
62
63-/* Everything that needs to be done when removing a session. */
64+static inline void hash_destroy_session(struct csession *ses_ptr)
65+{
66+ cryptodev_hash_deinit(&ses_ptr->hdata);
67+ kfree(ses_ptr->pages);
68+ kfree(ses_ptr->sg);
69+ kfree(ses_ptr);
70+}
71+
72+static int hash_create_session(struct hash_op_data *hash_op)
73+{
74+ struct csession *ses;
75+ int ret = 0;
76+ const char *hash_name;
77+ int hmac_mode = 1;
78+ uint8_t mkey[CRYPTO_HMAC_MAX_KEY_LEN];
79+
80+ switch (hash_op->mac_op) {
81+ case CRYPTO_MD5_HMAC:
82+ hash_name = "hmac(md5)";
83+ break;
84+ case CRYPTO_RIPEMD160_HMAC:
85+ hash_name = "hmac(rmd160)";
86+ break;
87+ case CRYPTO_SHA1_HMAC:
88+ hash_name = "hmac(sha1)";
89+ break;
90+ case CRYPTO_SHA2_224_HMAC:
91+ hash_name = "hmac(sha224)";
92+ break;
93+ case CRYPTO_SHA2_256_HMAC:
94+ hash_name = "hmac(sha256)";
95+ break;
96+ case CRYPTO_SHA2_384_HMAC:
97+ hash_name = "hmac(sha384)";
98+ break;
99+ case CRYPTO_SHA2_512_HMAC:
100+ hash_name = "hmac(sha512)";
101+ break;
102+ /* non-hmac cases */
103+ case CRYPTO_MD5:
104+ hash_name = "md5";
105+ hmac_mode = 0;
106+ break;
107+ case CRYPTO_RIPEMD160:
108+ hash_name = "rmd160";
109+ hmac_mode = 0;
110+ break;
111+ case CRYPTO_SHA1:
112+ hash_name = "sha1";
113+ hmac_mode = 0;
114+ break;
115+ case CRYPTO_SHA2_224:
116+ hash_name = "sha224";
117+ hmac_mode = 0;
118+ break;
119+ case CRYPTO_SHA2_256:
120+ hash_name = "sha256";
121+ hmac_mode = 0;
122+ break;
123+ case CRYPTO_SHA2_384:
124+ hash_name = "sha384";
125+ hmac_mode = 0;
126+ break;
127+ case CRYPTO_SHA2_512:
128+ hash_name = "sha512";
129+ hmac_mode = 0;
130+ break;
131+ default:
132+ ddebug(1, "bad mac: %d", hash_op->mac_op);
133+ return -EINVAL;
134+ }
135+
136+ ses = kzalloc(sizeof(*ses), GFP_KERNEL);
137+ if (!ses) {
138+ return -ENOMEM;
139+ }
140+
141+ if (unlikely(hash_op->mackeylen > CRYPTO_HMAC_MAX_KEY_LEN)) {
142+ ddebug(1, "Setting key failed for %s-%zu.", hash_name,
143+ (size_t)hash_op->mackeylen * 8);
144+ ret = -EINVAL;
145+ goto error_hash;
146+ }
147+
148+ if (hash_op->mackey &&
149+ unlikely(copy_from_user(mkey, hash_op->mackey, hash_op->mackeylen))) {
150+ ret = -EFAULT;
151+ goto error_hash;
152+ }
153+
154+ ret = cryptodev_hash_init(&ses->hdata, hash_name, hmac_mode,
155+ mkey, hash_op->mackeylen);
156+ if (ret != 0) {
157+ ddebug(1, "Failed to load hash for %s", hash_name);
158+ ret = -EINVAL;
159+ goto error_hash;
160+ }
161+
162+ ses->alignmask = ses->hdata.alignmask;
163+ ddebug(2, "got alignmask %d", ses->alignmask);
164+
165+ ses->array_size = DEFAULT_PREALLOC_PAGES;
166+ ddebug(2, "preallocating for %d user pages", ses->array_size);
167+
168+ ses->pages = kzalloc(ses->array_size * sizeof(struct page *), GFP_KERNEL);
169+ ses->sg = kzalloc(ses->array_size * sizeof(struct scatterlist), GFP_KERNEL);
170+ if (ses->sg == NULL || ses->pages == NULL) {
171+ ddebug(0, "Memory error");
172+ ret = -ENOMEM;
173+ goto error_hash;
174+ }
175+
176+ hash_op->ses = ses;
177+ return 0;
178+
179+error_hash:
180+ hash_destroy_session(ses);
181+ return ret;
182+}
183+
184+
185+/* Everything that needs to be done when remowing a session. */
186 static inline void
187 crypto_destroy_session(struct csession *ses_ptr)
188 {
189@@ -960,7 +1081,7 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
190 void __user *arg = (void __user *)arg_;
191 int __user *p = arg;
192 struct session_op sop;
193- struct hash_op_data hash_op;
194+ struct kernel_hash_op khop;
195 struct kernel_crypt_op kcop;
196 struct kernel_crypt_auth_op kcaop;
197 struct crypt_priv *pcr = filp->private_data;
198@@ -1051,52 +1172,35 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
199
200 return kcop_to_user(&kcop, fcr, arg);
201 case CIOCHASH:
202- /* get session */
203- if (unlikely(copy_from_user(&hash_op, arg, sizeof(struct hash_op_data)))) {
204+ if (unlikely(copy_from_user(&khop.hash_op, arg, sizeof(struct hash_op_data)))) {
205 pr_err("copy from user fault\n");
206 return -EFAULT;
207 }
208+ khop.task = current;
209+ khop.mm = current->mm;
210
211- sop.cipher = 0;
212- sop.mac = hash_op.mac_op;
213- sop.mackey = hash_op.mackey;
214- sop.mackeylen = hash_op.mackeylen;
215-
216- /* writes sop.ses as a side-effect */
217- ret = crypto_create_session(fcr, &sop);
218+ /* get session */
219+ ret = hash_create_session(&khop.hash_op);
220 if (unlikely(ret)) {
221 pr_err("can't get session\n");
222 return ret;
223 }
224
225 /* do hashing */
226- kcop.cop.ses = sop.ses;
227- kcop.cop.flags = hash_op.flags;
228- kcop.cop.len = hash_op.len;
229- kcop.cop.src = hash_op.src;
230- kcop.cop.mac = hash_op.mac_result;
231- kcop.cop.dst = 0;
232- kcop.cop.op = 0;
233- kcop.cop.iv = 0;
234- kcop.ivlen = 0;
235- kcop.digestsize = 0; /* will be updated during operation */
236- kcop.task = current;
237- kcop.mm = current->mm;
238-
239- ret = crypto_run(fcr, &kcop);
240+ ret = hash_run(&khop);
241 if (unlikely(ret)) {
242 dwarning(1, "Error in hash run");
243 return ret;
244 }
245
246- ret = copy_to_user(kcop.cop.mac, kcop.hash_output, kcop.digestsize);
247+ ret = copy_to_user(khop.hash_op.mac_result, khop.hash_output, khop.digestsize);
248 if (unlikely(ret)) {
249 dwarning(1, "Error in copy to user");
250 return ret;
251 }
252
253 /* put session */
254- ret = crypto_finish_session(fcr, sop.ses);
255+ hash_destroy_session(khop.hash_op.ses);
256 return 0;
257 case CIOCAUTHCRYPT:
258 if (unlikely(ret = kcaop_from_user(&kcaop, fcr, arg))) {
259diff --git a/main.c b/main.c
260index ec11129..095aea5 100644
261--- a/main.c
262+++ b/main.c
263@@ -159,8 +159,6 @@ __crypto_run_std(struct csession *ses_ptr, struct crypt_op *cop)
264 return ret;
265 }
266
267-
268-
269 /* This is the main crypto function - zero-copy edition */
270 static int
271 __crypto_run_zc(struct csession *ses_ptr, struct kernel_crypt_op *kcop)
272@@ -841,3 +839,40 @@ out_unlock:
273 crypto_put_session(ses_ptr);
274 return ret;
275 }
276+
277+int hash_run(struct kernel_hash_op *khop)
278+{
279+ struct hash_op_data *hash_op = &khop->hash_op;
280+ struct csession *ses_ptr = hash_op->ses;
281+ struct hash_data *hdata = &ses_ptr->hdata;
282+ int ret;
283+ struct scatterlist *src_sg;
284+ struct scatterlist *dst_sg; /* required by get_userbuf but not used */
285+
286+ if (hash_op->len == 0) {
287+ src_sg = NULL;
288+ } else {
289+ ret = get_userbuf(ses_ptr, hash_op->src, hash_op->len, NULL, 0,
290+ khop->task, khop->mm, &src_sg, &dst_sg);
291+ if (unlikely(ret)) {
292+ derr(1, "Error getting user pages");
293+ return ret;
294+ }
295+ }
296+
297+ ahash_request_set_crypt(hdata->async.request, src_sg, khop->hash_output, hash_op->len);
298+
299+ ret = crypto_ahash_digest(hdata->async.request);
300+ if (ret == -EINPROGRESS || ret == -EBUSY) {
301+ wait_for_completion(&hdata->async.result.completion);
302+ ret = hdata->async.result.err;
303+ if (ret != 0) {
304+ derr(0, "CryptoAPI failure: %d", ret);
305+ }
306+ }
307+
308+ khop->digestsize = ses_ptr->hdata.digestsize;
309+
310+ release_user_pages(ses_ptr);
311+ return ret;
312+}
313--
3142.7.0
315
diff --git a/recipes-kernel/cryptodev/sdk_patches/0036-add-compat-for-CIOCHASH-operation.patch b/recipes-kernel/cryptodev/sdk_patches/0036-add-compat-for-CIOCHASH-operation.patch
new file mode 100644
index 0000000..c206995
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0036-add-compat-for-CIOCHASH-operation.patch
@@ -0,0 +1,120 @@
1From 711529cc7b8743ae8c9c0db4980ac15f7acb8618 Mon Sep 17 00:00:00 2001
2From: Alex Porosanu <alexandru.porosanu@nxp.com>
3Date: Tue, 12 Jan 2016 14:51:00 +0200
4Subject: [PATCH 36/38] add compat for CIOCHASH operation
5
6This patch adds the necessary ioctl for using the CIOCHASH
7operation for different userspace & kernel (i.e. 32b userspace
8and 64b kernel).
9
10Signed-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>
11---
12 cryptodev_int.h | 14 +++++++++++++-
13 ioctl.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 63 insertions(+), 1 deletion(-)
15
16diff --git a/cryptodev_int.h b/cryptodev_int.h
17index 74c295a..6dcfd69 100644
18--- a/cryptodev_int.h
19+++ b/cryptodev_int.h
20@@ -129,6 +129,18 @@ struct compat_crypt_auth_op {
21 uint32_t iv_len;
22 };
23
24+struct compat_hash_op_data {
25+ compat_uptr_t ses;
26+ uint32_t mac_op; /* cryptodev_crypto_op_t */
27+ compat_uptr_t mackey;
28+ uint32_t mackeylen;
29+
30+ uint16_t flags; /* see COP_FLAG_* */
31+ uint32_t len; /* length of source data */
32+ compat_uptr_t src; /* source data */
33+ compat_uptr_t mac_result;
34+};
35+
36 /* compat ioctls, defined for the above structs */
37 #define COMPAT_CIOCGSESSION _IOWR('c', 102, struct compat_session_op)
38 #define COMPAT_CIOCCRYPT _IOWR('c', 104, struct compat_crypt_op)
39@@ -139,7 +151,7 @@ struct compat_crypt_auth_op {
40 #define COMPAT_CIOCASYMASYNCRYPT _IOW('c', 110, struct compat_crypt_kop)
41 #define COMPAT_CIOCASYMFETCHCOOKIE _IOR('c', 111, \
42 struct compat_pkc_cookie_list_s)
43-
44+#define COMPAT_CIOCHASH _IOWR('c', 114, struct compat_hash_op_data)
45 #endif /* CONFIG_COMPAT */
46
47 /* kernel-internal extension to struct crypt_kop */
48diff --git a/ioctl.c b/ioctl.c
49index a052614..ff3de44 100644
50--- a/ioctl.c
51+++ b/ioctl.c
52@@ -1435,8 +1435,11 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_)
53 struct fcrypt *fcr;
54 struct session_op sop;
55 struct compat_session_op compat_sop;
56+ struct kernel_hash_op khop;
57 struct kernel_crypt_op kcop;
58 struct kernel_crypt_auth_op kcaop;
59+ struct compat_hash_op_data compat_hash_op_data;
60+
61 int ret;
62
63 if (unlikely(!pcr))
64@@ -1499,6 +1502,53 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_)
65
66 return compat_kcop_to_user(&kcop, fcr, arg);
67
68+ case COMPAT_CIOCHASH:
69+ /* get session */
70+ if (unlikely(copy_from_user(&compat_hash_op_data, arg,
71+ sizeof(struct compat_hash_op_data)))) {
72+ pr_err("copy from user fault\n");
73+ return -EFAULT;
74+ }
75+
76+ khop.task = current;
77+ khop.mm = current->mm;
78+
79+ khop.hash_op.mac_op = compat_hash_op_data.mac_op;
80+ khop.hash_op.mackey = compat_ptr(compat_hash_op_data.mackey);
81+ khop.hash_op.mackeylen = compat_hash_op_data.mackeylen;
82+ khop.hash_op.flags = compat_hash_op_data.flags;
83+ khop.hash_op.len = compat_hash_op_data.len;
84+ khop.hash_op.src = compat_ptr(compat_hash_op_data.src);
85+ khop.hash_op.mac_result =
86+ compat_ptr(compat_hash_op_data.mac_result);
87+
88+ ret = hash_create_session(&khop.hash_op);
89+ if (unlikely(ret)) {
90+ pr_err("can't get session\n");
91+ return ret;
92+ }
93+
94+ /* do hashing */
95+ ret = hash_run(&khop);
96+ if (unlikely(ret)) {
97+ dwarning(1, "Error in hash run");
98+ return ret;
99+ }
100+
101+ ret = copy_to_user(khop.hash_op.mac_result, khop.hash_output,
102+ khop.digestsize);
103+ if (unlikely(ret)) {
104+ dwarning(1, "Error in copy to user");
105+ return ret;
106+ }
107+
108+ copy_to_user(arg, &compat_hash_op_data,
109+ sizeof(struct compat_hash_op_data));
110+
111+ /* put session */
112+ hash_destroy_session(khop.hash_op.ses);
113+ return 0;
114+
115 case COMPAT_CIOCAUTHCRYPT:
116 if (unlikely(ret = compat_kcaop_from_user(&kcaop, fcr, arg))) {
117 dprintk(1, KERN_WARNING, "Error copying from user\n");
118--
1192.7.0
120
diff --git a/recipes-kernel/cryptodev/sdk_patches/0037-rewrite-sha_speed.c-to-reduce-code-duplication.patch b/recipes-kernel/cryptodev/sdk_patches/0037-rewrite-sha_speed.c-to-reduce-code-duplication.patch
new file mode 100644
index 0000000..eff6ed9
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0037-rewrite-sha_speed.c-to-reduce-code-duplication.patch
@@ -0,0 +1,190 @@
1From 344a0243e31f8fc467253404a548eedbb72b35d0 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Wed, 20 Jan 2016 17:11:49 +0200
4Subject: [PATCH 37/38] rewrite sha_speed.c to reduce code duplication
5
6Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
7---
8 tests/sha_speed.c | 131 ++++++++++++++++++++++++++++++++++--------------------
9 1 file changed, 84 insertions(+), 47 deletions(-)
10
11diff --git a/tests/sha_speed.c b/tests/sha_speed.c
12index e1dc54b..5f694bd 100644
13--- a/tests/sha_speed.c
14+++ b/tests/sha_speed.c
15@@ -28,6 +28,13 @@
16
17 #include <crypto/cryptodev.h>
18
19+/* Sizes of buffers to be hashed */
20+int buffer_lengths[] = {256, 512, 1024, 2048, 4096, 8192, 65536, 0};
21+
22+/* Time in seconds allocated for each tested buffer lengths */
23+#define BUFFER_TEST_TIME 10
24+
25+
26 static double udifftimeval(struct timeval start, struct timeval end)
27 {
28 return (double)(end.tv_usec - start.tv_usec) +
29@@ -97,7 +104,7 @@ int hash_data(struct session_op *sess, int fdc, int chunksize, int alignmask)
30 memset(buffer, val++, chunksize);
31
32 must_finish = 0;
33- alarm(5);
34+ alarm(BUFFER_TEST_TIME);
35
36 gettimeofday(&start, NULL);
37 do {
38@@ -126,73 +133,103 @@ int hash_data(struct session_op *sess, int fdc, int chunksize, int alignmask)
39 return 0;
40 }
41
42-int main(void)
43-{
44- int fd, i, fdc = -1, alignmask = 0;
45- struct session_op sess;
46- char keybuf[32];
47+
48 #ifdef CIOCGSESSINFO
49+int get_alignmask(struct session_op *sess, int fdc)
50+{
51 struct session_info_op siop;
52+
53+ siop.ses = sess->ses;
54+ if (ioctl(fdc, CIOCGSESSINFO, &siop) < 0) {
55+ perror("ioctl(CIOCGSESSINFO)");
56+ /* continue test ignoring CIOCGSESSINFO error */
57+ return 0;
58+ }
59+
60+ printf("using algorithm %s with driver %s\n",
61+ siop.hash_info.cra_name, siop.hash_info.cra_driver_name);
62+
63+ return siop.alignmask;
64+}
65 #endif
66
67- signal(SIGALRM, alarm_handler);
68
69- if ((fd = open("/dev/crypto", O_RDWR, 0)) < 0) {
70- perror("open()");
71- return 1;
72- }
73- if (ioctl(fd, CRIOGET, &fdc)) {
74- perror("ioctl(CRIOGET)");
75- return 1;
76- }
77+int hash_session(struct session_op *sess, int fdc)
78+{
79+ int i;
80+ int err;
81+ int alignmask;
82
83- fprintf(stderr, "Testing SHA1 Hash: \n");
84- memset(&sess, 0, sizeof(sess));
85- sess.mac = CRYPTO_SHA1;
86- if (ioctl(fdc, CIOCGSESSION, &sess)) {
87+ if (ioctl(fdc, CIOCGSESSION, sess)) {
88 perror("ioctl(CIOCGSESSION)");
89 return 1;
90 }
91+
92 #ifdef CIOCGSESSINFO
93- siop.ses = sess.ses;
94- if (ioctl(fdc, CIOCGSESSINFO, &siop)) {
95- perror("ioctl(CIOCGSESSINFO)");
96- return 1;
97- }
98- printf("requested hash CRYPTO_SHA1, got %s with driver %s\n",
99- siop.hash_info.cra_name, siop.hash_info.cra_driver_name);
100- alignmask = siop.alignmask;
101+ alignmask = get_alignmask(sess, fdc);
102+#else
103+ alignmask = 0;
104 #endif
105
106- for (i = 256; i <= (64 * 1024); i *= 4) {
107- if (hash_data(&sess, fdc, i, alignmask))
108- break;
109+ err = 0;
110+ for(i = 0; (err == 0) && (buffer_lengths[i] != 0); i++) {
111+ err = hash_data(sess, fdc, buffer_lengths[i], alignmask);
112 }
113
114- fprintf(stderr, "\nTesting SHA256 Hash: \n");
115- memset(&sess, 0, sizeof(sess));
116- sess.mac = CRYPTO_SHA2_256;
117- if (ioctl(fdc, CIOCGSESSION, &sess)) {
118- perror("ioctl(CIOCGSESSION)");
119+ if (ioctl(fdc, CIOCFSESSION, sess)) {
120+ perror("ioctl(CIOCFSESSION)");
121 return 1;
122 }
123-#ifdef CIOCGSESSINFO
124- siop.ses = sess.ses;
125- if (ioctl(fdc, CIOCGSESSINFO, &siop)) {
126- perror("ioctl(CIOCGSESSINFO)");
127+
128+ return err;
129+}
130+
131+int test_sha1(struct session_op *sess, int fdc)
132+{
133+ fprintf(stderr, "Testing SHA1 Hash: \n");
134+ memset(sess, 0, sizeof(sess));
135+ sess->mac = CRYPTO_SHA1;
136+ return hash_session(sess, fdc);
137+}
138+
139+
140+int test_sha256(struct session_op *sess, int fdc)
141+{
142+ fprintf(stderr, "Testing SHA256 Hash: \n");
143+ memset(sess, 0, sizeof(sess));
144+ sess->mac = CRYPTO_SHA2_256;
145+ return hash_session(sess, fdc);
146+}
147+
148+
149+int main(void)
150+{
151+ int fd;
152+ int fdc;
153+ int err;
154+ int i;
155+ struct session_op sess;
156+
157+ signal(SIGALRM, alarm_handler);
158+
159+ fd = open("/dev/crypto", O_RDWR, 0);
160+ if (fd < 0) {
161+ perror("open()");
162 return 1;
163 }
164- printf("requested hash CRYPTO_SHA2_256, got %s with driver %s\n",
165- siop.hash_info.cra_name, siop.hash_info.cra_driver_name);
166- alignmask = siop.alignmask;
167-#endif
168
169- for (i = 256; i <= (64 * 1024); i *= 4) {
170- if (hash_data(&sess, fdc, i, alignmask))
171- break;
172+ err = ioctl(fd, CRIOGET, &fdc);
173+ if (err != 0) {
174+ perror("ioctl(CRIOGET)");
175+ close(fd);
176+ return 1;
177 }
178
179+ /* run all tests but return an eventual error */
180+ err |= test_sha1(&sess, fdc);
181+ err |= test_sha256(&sess, fdc);
182+
183 close(fdc);
184 close(fd);
185- return 0;
186+ return err;
187 }
188--
1892.7.0
190
diff --git a/recipes-kernel/cryptodev/sdk_patches/0038-extend-sha_speed.c-to-test-CIOCHASH.patch b/recipes-kernel/cryptodev/sdk_patches/0038-extend-sha_speed.c-to-test-CIOCHASH.patch
new file mode 100644
index 0000000..eb8bf19
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0038-extend-sha_speed.c-to-test-CIOCHASH.patch
@@ -0,0 +1,143 @@
1From 65704ea24e80647e8c5f938300f51cb70af50c1c Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Thu, 21 Jan 2016 17:30:59 +0200
4Subject: [PATCH 38/38] extend sha_speed.c to test CIOCHASH
5
6Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
7---
8 tests/sha_speed.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
9 1 file changed, 90 insertions(+)
10
11diff --git a/tests/sha_speed.c b/tests/sha_speed.c
12index 5f694bd..d731c66 100644
13--- a/tests/sha_speed.c
14+++ b/tests/sha_speed.c
15@@ -133,6 +133,62 @@ int hash_data(struct session_op *sess, int fdc, int chunksize, int alignmask)
16 return 0;
17 }
18
19+int digest_data(struct session_op *sess, int fdc, int chunksize, int alignmask)
20+{
21+ struct hash_op_data hash_op;
22+ char *buffer;
23+ static int val = 23;
24+ struct timeval start, end;
25+ double total = 0;
26+ double secs, ddata, dspeed;
27+ char metric[16];
28+ uint8_t mac[AALG_MAX_RESULT_LEN];
29+
30+ if (alignmask) {
31+ if (posix_memalign((void **)&buffer, alignmask + 1, chunksize)) {
32+ printf("posix_memalign() failed!\n");
33+ return 1;
34+ }
35+ } else {
36+ if (!(buffer = malloc(chunksize))) {
37+ perror("malloc()");
38+ return 1;
39+ }
40+ }
41+
42+ printf("\tEncrypting in chunks of %d bytes: ", chunksize);
43+ fflush(stdout);
44+
45+ memset(buffer, val++, chunksize);
46+
47+ must_finish = 0;
48+ alarm(BUFFER_TEST_TIME);
49+
50+ gettimeofday(&start, NULL);
51+ do {
52+ memset(&hash_op, 0, sizeof(hash_op));
53+ hash_op.mac_op = sess->mac;
54+ hash_op.len = chunksize;
55+ hash_op.src = (unsigned char *)buffer;
56+ hash_op.mac_result = mac;
57+
58+ if (ioctl(fdc, CIOCHASH, hash_op) != 0) {
59+ perror("ioctl(CIOCHASH)");
60+ return 1;
61+ }
62+ total += chunksize;
63+ } while(must_finish == 0);
64+ gettimeofday(&end, NULL);
65+
66+ secs = udifftimeval(start, end)/ 1000000.0;
67+
68+ value2human(1, total, secs, &ddata, &dspeed, metric);
69+ printf ("done. %.2f %s in %.2f secs: ", ddata, metric, secs);
70+ printf ("%.2f %s/sec\n", dspeed, metric);
71+
72+ free(buffer);
73+ return 0;
74+}
75
76 #ifdef CIOCGSESSINFO
77 int get_alignmask(struct session_op *sess, int fdc)
78@@ -154,6 +210,20 @@ int get_alignmask(struct session_op *sess, int fdc)
79 #endif
80
81
82+int ciochash_session(struct session_op *sess, int fdc)
83+{
84+ int i;
85+ int err = 0;
86+
87+ err = 0;
88+ for(i = 0; (err == 0) && (buffer_lengths[i] != 0); i++) {
89+ err = digest_data(sess, fdc, buffer_lengths[i], 0);
90+ }
91+
92+ return err;
93+}
94+
95+
96 int hash_session(struct session_op *sess, int fdc)
97 {
98 int i;
99@@ -193,6 +263,15 @@ int test_sha1(struct session_op *sess, int fdc)
100 }
101
102
103+int test_sha1_ciochash(struct session_op *sess, int fdc)
104+{
105+ fprintf(stderr, "Testing SHA1 CIOCHASH: \n");
106+ memset(sess, 0, sizeof(sess));
107+ sess->mac = CRYPTO_SHA1;
108+ return ciochash_session(sess, fdc);
109+}
110+
111+
112 int test_sha256(struct session_op *sess, int fdc)
113 {
114 fprintf(stderr, "Testing SHA256 Hash: \n");
115@@ -202,6 +281,15 @@ int test_sha256(struct session_op *sess, int fdc)
116 }
117
118
119+int test_sha256_ciochash(struct session_op *sess, int fdc)
120+{
121+ fprintf(stderr, "Testing SHA256 CIOCHASH: \n");
122+ memset(sess, 0, sizeof(sess));
123+ sess->mac = CRYPTO_SHA2_256;
124+ return ciochash_session(sess, fdc);
125+}
126+
127+
128 int main(void)
129 {
130 int fd;
131@@ -227,7 +315,9 @@ int main(void)
132
133 /* run all tests but return an eventual error */
134 err |= test_sha1(&sess, fdc);
135+ err |= test_sha1_ciochash(&sess, fdc);
136 err |= test_sha256(&sess, fdc);
137+ err |= test_sha256_ciochash(&sess, fdc);
138
139 close(fdc);
140 close(fd);
141--
1422.7.0
143
diff --git a/recipes-kernel/cryptodev/sdk_patches/0039-fix-memory-leaks-on-error-path-for-CIOCHASH.patch b/recipes-kernel/cryptodev/sdk_patches/0039-fix-memory-leaks-on-error-path-for-CIOCHASH.patch
new file mode 100644
index 0000000..fc2f4c8
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0039-fix-memory-leaks-on-error-path-for-CIOCHASH.patch
@@ -0,0 +1,70 @@
1From 3e3996b40fd3a93cbe2e5ddee244280dd7de6c18 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@freescale.com>
3Date: Tue, 9 Feb 2016 21:07:06 +0200
4Subject: [PATCH 39/40] fix memory leaks on error path for CIOCHASH
5
6Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
7---
8 ioctl.c | 20 +++++++++++---------
9 1 file changed, 11 insertions(+), 9 deletions(-)
10
11diff --git a/ioctl.c b/ioctl.c
12index ff3de44..8d81b56 100644
13--- a/ioctl.c
14+++ b/ioctl.c
15@@ -1190,18 +1190,17 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
16 ret = hash_run(&khop);
17 if (unlikely(ret)) {
18 dwarning(1, "Error in hash run");
19- return ret;
20+ goto hash_err;
21 }
22
23 ret = copy_to_user(khop.hash_op.mac_result, khop.hash_output, khop.digestsize);
24 if (unlikely(ret)) {
25 dwarning(1, "Error in copy to user");
26- return ret;
27 }
28
29- /* put session */
30+ hash_err:
31 hash_destroy_session(khop.hash_op.ses);
32- return 0;
33+ return ret;
34 case CIOCAUTHCRYPT:
35 if (unlikely(ret = kcaop_from_user(&kcaop, fcr, arg))) {
36 dwarning(1, "Error copying from user");
37@@ -1532,22 +1531,25 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_)
38 ret = hash_run(&khop);
39 if (unlikely(ret)) {
40 dwarning(1, "Error in hash run");
41- return ret;
42+ goto hash_err;
43 }
44
45 ret = copy_to_user(khop.hash_op.mac_result, khop.hash_output,
46 khop.digestsize);
47 if (unlikely(ret)) {
48 dwarning(1, "Error in copy to user");
49- return ret;
50+ goto hash_err;
51 }
52
53- copy_to_user(arg, &compat_hash_op_data,
54+ ret = copy_to_user(arg, &compat_hash_op_data,
55 sizeof(struct compat_hash_op_data));
56+ if (unlikely(ret)) {
57+ dwarning(1, "Error in copy to user");
58+ }
59
60- /* put session */
61+ hash_err:
62 hash_destroy_session(khop.hash_op.ses);
63- return 0;
64+ return ret;
65
66 case COMPAT_CIOCAUTHCRYPT:
67 if (unlikely(ret = compat_kcaop_from_user(&kcaop, fcr, arg))) {
68--
692.7.0
70
diff --git a/recipes-kernel/cryptodev/sdk_patches/0040-fix-structure-init-in-sha_speed-test.patch b/recipes-kernel/cryptodev/sdk_patches/0040-fix-structure-init-in-sha_speed-test.patch
new file mode 100644
index 0000000..053d376
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0040-fix-structure-init-in-sha_speed-test.patch
@@ -0,0 +1,53 @@
1From 3eb9ed52743584949ff9b4844e810333c34a3a1f Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Fri, 12 Feb 2016 11:23:41 +0200
4Subject: [PATCH 40/40] fix structure init in sha_speed test
5
6Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
7---
8 tests/sha_speed.c | 8 ++++----
9 1 file changed, 4 insertions(+), 4 deletions(-)
10
11diff --git a/tests/sha_speed.c b/tests/sha_speed.c
12index d731c66..75d0f42 100644
13--- a/tests/sha_speed.c
14+++ b/tests/sha_speed.c
15@@ -257,7 +257,7 @@ int hash_session(struct session_op *sess, int fdc)
16 int test_sha1(struct session_op *sess, int fdc)
17 {
18 fprintf(stderr, "Testing SHA1 Hash: \n");
19- memset(sess, 0, sizeof(sess));
20+ memset(sess, 0, sizeof(struct session_op));
21 sess->mac = CRYPTO_SHA1;
22 return hash_session(sess, fdc);
23 }
24@@ -266,7 +266,7 @@ int test_sha1(struct session_op *sess, int fdc)
25 int test_sha1_ciochash(struct session_op *sess, int fdc)
26 {
27 fprintf(stderr, "Testing SHA1 CIOCHASH: \n");
28- memset(sess, 0, sizeof(sess));
29+ memset(sess, 0, sizeof(struct session_op));
30 sess->mac = CRYPTO_SHA1;
31 return ciochash_session(sess, fdc);
32 }
33@@ -275,7 +275,7 @@ int test_sha1_ciochash(struct session_op *sess, int fdc)
34 int test_sha256(struct session_op *sess, int fdc)
35 {
36 fprintf(stderr, "Testing SHA256 Hash: \n");
37- memset(sess, 0, sizeof(sess));
38+ memset(sess, 0, sizeof(struct session_op));
39 sess->mac = CRYPTO_SHA2_256;
40 return hash_session(sess, fdc);
41 }
42@@ -284,7 +284,7 @@ int test_sha256(struct session_op *sess, int fdc)
43 int test_sha256_ciochash(struct session_op *sess, int fdc)
44 {
45 fprintf(stderr, "Testing SHA256 CIOCHASH: \n");
46- memset(sess, 0, sizeof(sess));
47+ memset(sess, 0, sizeof(struct session_op));
48 sess->mac = CRYPTO_SHA2_256;
49 return ciochash_session(sess, fdc);
50 }
51--
522.7.0
53
diff --git a/recipes-kernel/cryptodev/sdk_patches/0041-add-separate-target-for-building-tests.patch b/recipes-kernel/cryptodev/sdk_patches/0041-add-separate-target-for-building-tests.patch
new file mode 100644
index 0000000..ff73825
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0041-add-separate-target-for-building-tests.patch
@@ -0,0 +1,38 @@
1From 0d58530f5c5970db9787a23aef4227c68f941fcc Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Wed, 10 Feb 2016 16:22:05 +0200
4Subject: [PATCH 41/43] add separate target for building tests
5
6A separate target for build is useful with cross-compilation. In this
7case it makes sense to build the tests without running them on the host
8machine.
9
10The default target is now 'all' and only builds the tests
11
12Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
13---
14 tests/Makefile | 4 ++++
15 1 file changed, 4 insertions(+)
16
17diff --git a/tests/Makefile b/tests/Makefile
18index 3155da9..89f88fe 100644
19--- a/tests/Makefile
20+++ b/tests/Makefile
21@@ -19,6 +19,8 @@ example-async-hmac-objs := async_hmac.o
22 example-async-speed-objs := async_speed.o
23 example-hashcrypt-speed-objs := hashcrypt_speed.c
24
25+all: $(hostprogs)
26+
27 check: $(hostprogs)
28 ./cipher
29 ./hmac
30@@ -33,3 +35,5 @@ clean:
31
32 ${comp_progs}: LDLIBS += -lssl -lcrypto
33 ${comp_progs}: %: %.o openssl_wrapper.o
34+
35+.PHONY: all clean check
36--
372.7.0
38
diff --git a/recipes-kernel/cryptodev/sdk_patches/0042-fix-destination-for-staged-installs.patch b/recipes-kernel/cryptodev/sdk_patches/0042-fix-destination-for-staged-installs.patch
new file mode 100644
index 0000000..c8ae06e
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0042-fix-destination-for-staged-installs.patch
@@ -0,0 +1,55 @@
1From dcb8fe0fcf71feac2a4f57c44a5153bfc404b4c3 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Thu, 11 Feb 2016 16:37:23 +0200
4Subject: [PATCH 42/43] fix destination for staged installs
5
6The standard variable for staged installations is DESTDIR and it should
7be set only by the user, outside of Makefile. This is consistent with
8recommendations from both GNU Make and FreeBSD porters-handbook.
9
10 make DESTDIR=/tmp/stage install
11
12$prefix and $PREFIX (in FreeBSD world) are used to specify where the
13files will be installed. It defaults to /usr/local but can be /usr or
14/opt or something else.
15
16Usually one wants to do a stage installation when cross-building or for
17other purposes. The convention is to use DESTDIR.
18Changing $prefix is useful for installers. They can override its value
19when calling make:
20
21 make prefix=/usr install
22
23Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
24---
25 Makefile | 7 ++++---
26 1 file changed, 4 insertions(+), 3 deletions(-)
27
28diff --git a/Makefile b/Makefile
29index 7f8df37..9871a8e 100644
30--- a/Makefile
31+++ b/Makefile
32@@ -7,7 +7,9 @@ CRYPTODEV_CFLAGS ?= #-DENABLE_ASYNC
33 KBUILD_CFLAGS += -I$(src) $(CRYPTODEV_CFLAGS)
34 KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build
35 VERSION = 1.8
36-PREFIX ?=
37+
38+prefix ?= /usr/local
39+includedir = $(prefix)/include
40
41 cryptodev-objs = ioctl.o main.o cryptlib.o authenc.o zc.o util.o
42
43@@ -31,8 +33,7 @@ install: modules_install
44
45 modules_install:
46 $(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules_install
47- @echo "Installing cryptodev.h in $(PREFIX)/usr/include/crypto ..."
48- @install -D crypto/cryptodev.h $(PREFIX)/usr/include/crypto/cryptodev.h
49+ install -m 644 -D crypto/cryptodev.h $(DESTDIR)/$(includedir)/crypto/cryptodev.h
50
51 clean:
52 $(MAKE) -C $(KERNEL_DIR) M=$(PWD) clean
53--
542.7.0
55
diff --git a/recipes-kernel/cryptodev/sdk_patches/0043-add-install-target-for-tests.patch b/recipes-kernel/cryptodev/sdk_patches/0043-add-install-target-for-tests.patch
new file mode 100644
index 0000000..f3b7022
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0043-add-install-target-for-tests.patch
@@ -0,0 +1,46 @@
1From 44629033d47543d106299b6c8bed9e5c9fed1513 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Thu, 11 Feb 2016 16:48:53 +0200
4Subject: [PATCH 43/43] add install target for tests
5
6Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
7---
8 tests/Makefile | 12 +++++++++++-
9 1 file changed, 11 insertions(+), 1 deletion(-)
10
11diff --git a/tests/Makefile b/tests/Makefile
12index 89f88fe..5e3111d 100644
13--- a/tests/Makefile
14+++ b/tests/Makefile
15@@ -19,6 +19,10 @@ example-async-hmac-objs := async_hmac.o
16 example-async-speed-objs := async_speed.o
17 example-hashcrypt-speed-objs := hashcrypt_speed.c
18
19+prefix ?= /usr/local
20+execprefix ?= $(prefix)
21+bindir = $(execprefix)/bin
22+
23 all: $(hostprogs)
24
25 check: $(hostprogs)
26@@ -30,10 +34,16 @@ check: $(hostprogs)
27 ./cipher-gcm
28 ./cipher-aead
29
30+install:
31+ install -d $(DESTDIR)/$(bindir)
32+ for prog in $(hostprogs); do \
33+ install -m 755 $$prog $(DESTDIR)/$(bindir); \
34+ done
35+
36 clean:
37 rm -f *.o *~ $(hostprogs)
38
39 ${comp_progs}: LDLIBS += -lssl -lcrypto
40 ${comp_progs}: %: %.o openssl_wrapper.o
41
42-.PHONY: all clean check
43+.PHONY: all clean check install
44--
452.7.0
46
diff --git a/recipes-kernel/cryptodev/yocto_patches/0001-Add-the-compile-and-install-rules-for-cryptodev-test.patch b/recipes-kernel/cryptodev/yocto_patches/0001-Add-the-compile-and-install-rules-for-cryptodev-test.patch
new file mode 100644
index 0000000..1e7f584
--- /dev/null
+++ b/recipes-kernel/cryptodev/yocto_patches/0001-Add-the-compile-and-install-rules-for-cryptodev-test.patch
@@ -0,0 +1,50 @@
1From 03257bf2aff37b78496ccc1b58a87e7baaea042a Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Mon, 22 Feb 2016 12:17:52 +0200
4Subject: [PATCH 2/2] Add the compile and install rules for cryptodev tests
5
6(original patch Signed-off-by: Yu Zongchun <b40527@freescale.com>)
7Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
8
9Upstream-Status: Inappropriate [ OE specific ]
10---
11 Makefile | 6 ++++++
12 tests/Makefile | 4 ++--
13 2 files changed, 8 insertions(+), 2 deletions(-)
14
15diff --git a/Makefile b/Makefile
16index 06202bd..a598b12 100644
17--- a/Makefile
18+++ b/Makefile
19@@ -42,6 +42,12 @@ clean:
20 check:
21 CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) $(MAKE) -C tests check
22
23+testprogs:
24+ KERNEL_DIR=$(KERNEL_DIR) $(MAKE) -C tests all
25+
26+install_tests:
27+ $(MAKE) -C tests install
28+
29 CPOPTS =
30 ifneq ($(SHOW_TYPES),)
31 CPOPTS += --show-types
32diff --git a/tests/Makefile b/tests/Makefile
33index 5e3111d..cda971c 100644
34--- a/tests/Makefile
35+++ b/tests/Makefile
36@@ -35,9 +35,9 @@ check: $(hostprogs)
37 ./cipher-aead
38
39 install:
40- install -d $(DESTDIR)/$(bindir)
41+ install -d $(DESTDIR)/$(bindir)/tests_cryptodev
42 for prog in $(hostprogs); do \
43- install -m 755 $$prog $(DESTDIR)/$(bindir); \
44+ install -m 755 $$prog $(DESTDIR)/$(bindir)/tests_cryptodev/; \
45 done
46
47 clean:
48--
492.7.0
50
diff --git a/recipes-kernel/cryptodev/yocto_patches/0001-Disable-installing-header-file-provided-by-another-p.patch b/recipes-kernel/cryptodev/yocto_patches/0001-Disable-installing-header-file-provided-by-another-p.patch
new file mode 100644
index 0000000..6d8db4e
--- /dev/null
+++ b/recipes-kernel/cryptodev/yocto_patches/0001-Disable-installing-header-file-provided-by-another-p.patch
@@ -0,0 +1,29 @@
1From eedfa57953d2d6255d53cb098c3f81cbde9187f7 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Mon, 22 Feb 2016 11:47:27 +0200
4Subject: [PATCH 1/2] Disable installing header file provided by another
5 package
6
7(original patch Signed-off-by: Denys Dmytriyenko <denys@ti.com>)
8Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
9
10Upstream-Status: Inappropriate [ OE specific ]
11---
12 Makefile | 1 -
13 1 file changed, 1 deletion(-)
14
15diff --git a/Makefile b/Makefile
16index 9871a8e..06202bd 100644
17--- a/Makefile
18+++ b/Makefile
19@@ -33,7 +33,6 @@ install: modules_install
20
21 modules_install:
22 $(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules_install
23- install -m 644 -D crypto/cryptodev.h $(DESTDIR)/$(includedir)/crypto/cryptodev.h
24
25 clean:
26 $(MAKE) -C $(KERNEL_DIR) M=$(PWD) clean
27--
282.7.0
29