[meta-freescale] [meta-fsl-ppc][PATCH 2/5] cryptodev-qoriq: upgrade to 1.8 plus fsl patches

ting.liu at nxp.com ting.liu at nxp.com
Tue Jun 21 02:47:16 PDT 2016


From: Cristian Stoica <cristian.stoica at nxp.com>

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 at nxp.com>
---
 ...q-linux_1.7.bb => cryptodev-qoriq-linux_1.8.bb} |   4 +-
 .../cryptodev/cryptodev-qoriq-module_1.7.bb        |  14 -
 .../cryptodev/cryptodev-qoriq-module_1.8.bb        |  19 ++
 ...q-tests_1.7.bb => cryptodev-qoriq-tests_1.8.bb} |  13 +-
 ...todev-qoriq_1.7.inc => cryptodev-qoriq_1.8.inc} |  40 ++-
 .../files/0001-don-t-advertise-RSA-keygen.patch    |  33 ---
 .../0001-fix-compilation-against-linux-3.19.patch  |  36 ---
 ...ests-Makefile-usage-of-LDLIBS-vs.-LDFLAGS.patch |  29 --
 ...ile-fix-arg-passing-to-CC-in-implicit-rul.patch |  28 --
 ...talling-header-file-provided-by-another-p.patch |  29 --
 ...pile-and-install-rules-for-cryptodev-test.patch |  65 -----
 ...-for-composite-TLS10-SHA1-AES-algorithm-o.patch |   6 +-
 ...dd-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch |   6 +-
 ...003-PKC-support-added-in-cryptodev-module.patch |   6 +-
 .../0004-Compat-versions-of-PKC-IOCTLs.patch       |   6 +-
 ...ynchronous-interface-changes-in-cryptodev.patch |   6 +-
 ...and-DLC_KEYGEN-supported-in-cryptodev-mod.patch |   6 +-
 ...stall-fixed-in-PKC-asynchronous-interface.patch |   6 +-
 .../0008-Add-RSA-Key-generation-offloading.patch   |   6 +-
 ...lation-error-of-openssl-with-fsl-cryptode.patch |   6 +-
 ...-for-composite-TLS10-SHA1-3DES-algorithm-.patch |   6 +-
 ...11-add-support-for-TLSv1.1-record-offload.patch |   6 +-
 ...12-add-support-for-TLSv1.2-record-offload.patch |   6 +-
 .../0013-clean-up-code-layout.patch                |   6 +-
 ...ve-redundant-data-copy-for-pkc-operations.patch |   6 +-
 .../0015-fix-pkc-request-deallocation.patch        |   6 +-
 ...0016-add-basic-detection-of-asym-features.patch |   6 +-
 .../0017-remove-dead-code.patch                    |   4 +-
 .../0018-fix-compat-warnings.patch                 |   4 +-
 .../0019-fix-size_t-print-format.patch             |   4 +-
 ...x-uninitialized-variable-compiler-warning.patch |   4 +-
 ...urn-codes-for-copy-to-from-user-functions.patch |   4 +-
 .../0022-fix-double-free-pkc-req-on-error.patch    |   4 +-
 ...023-remove-MAY_BACKLOG-flag-from-requests.patch |   4 +-
 ...4-fix-COMPAT_CIOCKEY-ioctl-command-number.patch |   4 +-
 .../sdk_patches/0025-fix-benchmarks-linking.patch  |  25 ++
 ...file-to-allow-parallel-make-with-j-option.patch |  56 ++++
 ...kernel-conventions-for-Makefile-variables.patch |  47 +++
 ...nsistency-use-.-instead-of-.-in-makefiles.patch |  73 +++++
 ...p-on-error-path-for-crypto_create_session.patch | 117 ++++++++
 ...e-code-duplication-in-cryptodev_hash_init.patch |  59 ++++
 .../sdk_patches/0031-fix-comment-typo.patch        |  26 ++
 .../0032-avoid-calls-to-kmalloc-on-hotpaths.patch  | 220 ++++++++++++++
 ...void-unnecessary-checks-for-hash-clean-up.patch |  33 +++
 ...with-CIOCHASH-to-support-direct-hash-oper.patch | 114 ++++++++
 ...y-crypto-API-digest-operation-for-CIOCHAS.patch | 315 +++++++++++++++++++++
 .../0036-add-compat-for-CIOCHASH-operation.patch   | 120 ++++++++
 ...te-sha_speed.c-to-reduce-code-duplication.patch | 190 +++++++++++++
 .../0038-extend-sha_speed.c-to-test-CIOCHASH.patch | 143 ++++++++++
 ...x-memory-leaks-on-error-path-for-CIOCHASH.patch |  70 +++++
 ...0040-fix-structure-init-in-sha_speed-test.patch |  53 ++++
 ...41-add-separate-target-for-building-tests.patch |  38 +++
 .../0042-fix-destination-for-staged-installs.patch |  55 ++++
 .../0043-add-install-target-for-tests.patch        |  46 +++
 ...pile-and-install-rules-for-cryptodev-test.patch |  50 ++++
 ...talling-header-file-provided-by-another-p.patch |  29 ++
 56 files changed, 1998 insertions(+), 319 deletions(-)
 rename recipes-kernel/cryptodev/{cryptodev-qoriq-linux_1.7.bb => cryptodev-qoriq-linux_1.8.bb} (83%)
 delete mode 100644 recipes-kernel/cryptodev/cryptodev-qoriq-module_1.7.bb
 create mode 100644 recipes-kernel/cryptodev/cryptodev-qoriq-module_1.8.bb
 rename recipes-kernel/cryptodev/{cryptodev-qoriq-tests_1.7.bb => cryptodev-qoriq-tests_1.8.bb} (56%)
 rename recipes-kernel/cryptodev/{cryptodev-qoriq_1.7.inc => cryptodev-qoriq_1.8.inc} (62%)
 delete mode 100644 recipes-kernel/cryptodev/files/0001-don-t-advertise-RSA-keygen.patch
 delete mode 100644 recipes-kernel/cryptodev/files/0001-fix-compilation-against-linux-3.19.patch
 delete mode 100644 recipes-kernel/cryptodev/files/0002-Fix-tests-Makefile-usage-of-LDLIBS-vs.-LDFLAGS.patch
 delete mode 100644 recipes-kernel/cryptodev/files/0002-tests-Makefile-fix-arg-passing-to-CC-in-implicit-rul.patch
 delete mode 100644 recipes-kernel/cryptodev/files/0003-Disable-installing-header-file-provided-by-another-p.patch
 delete mode 100644 recipes-kernel/cryptodev/files/0004-Add-the-compile-and-install-rules-for-cryptodev-test.patch
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch (91%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch (97%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0003-PKC-support-added-in-cryptodev-module.patch (99%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0004-Compat-versions-of-PKC-IOCTLs.patch (97%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0005-Asynchronous-interface-changes-in-cryptodev.patch (97%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch (97%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch (98%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0008-Add-RSA-Key-generation-offloading.patch (97%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch (97%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0010-add-support-for-composite-TLS10-SHA1-3DES-algorithm-.patch (91%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0011-add-support-for-TLSv1.1-record-offload.patch (94%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0012-add-support-for-TLSv1.2-record-offload.patch (93%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0013-clean-up-code-layout.patch (98%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0014-remove-redundant-data-copy-for-pkc-operations.patch (99%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0015-fix-pkc-request-deallocation.patch (90%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0016-add-basic-detection-of-asym-features.patch (89%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0017-remove-dead-code.patch (97%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0018-fix-compat-warnings.patch (97%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0019-fix-size_t-print-format.patch (98%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0020-fix-uninitialized-variable-compiler-warning.patch (94%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0021-check-return-codes-for-copy-to-from-user-functions.patch (99%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0022-fix-double-free-pkc-req-on-error.patch (91%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0023-remove-MAY_BACKLOG-flag-from-requests.patch (97%)
 rename recipes-kernel/cryptodev/{files => sdk_patches}/0024-fix-COMPAT_CIOCKEY-ioctl-command-number.patch (94%)
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0025-fix-benchmarks-linking.patch
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0026-fix-Makefile-to-allow-parallel-make-with-j-option.patch
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0027-use-Linux-kernel-conventions-for-Makefile-variables.patch
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0028-for-consistency-use-.-instead-of-.-in-makefiles.patch
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0029-fix-clean-up-on-error-path-for-crypto_create_session.patch
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0030-remove-code-duplication-in-cryptodev_hash_init.patch
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0031-fix-comment-typo.patch
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0032-avoid-calls-to-kmalloc-on-hotpaths.patch
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0033-avoid-unnecessary-checks-for-hash-clean-up.patch
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0034-extend-API-with-CIOCHASH-to-support-direct-hash-oper.patch
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0035-use-directly-crypto-API-digest-operation-for-CIOCHAS.patch
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0036-add-compat-for-CIOCHASH-operation.patch
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0037-rewrite-sha_speed.c-to-reduce-code-duplication.patch
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0038-extend-sha_speed.c-to-test-CIOCHASH.patch
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0039-fix-memory-leaks-on-error-path-for-CIOCHASH.patch
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0040-fix-structure-init-in-sha_speed-test.patch
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0041-add-separate-target-for-building-tests.patch
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0042-fix-destination-for-staged-installs.patch
 create mode 100644 recipes-kernel/cryptodev/sdk_patches/0043-add-install-target-for-tests.patch
 create mode 100644 recipes-kernel/cryptodev/yocto_patches/0001-Add-the-compile-and-install-rules-for-cryptodev-test.patch
 create mode 100644 recipes-kernel/cryptodev/yocto_patches/0001-Disable-installing-header-file-provided-by-another-p.patch

diff --git a/recipes-kernel/cryptodev/cryptodev-qoriq-linux_1.7.bb b/recipes-kernel/cryptodev/cryptodev-qoriq-linux_1.8.bb
similarity index 83%
rename from recipes-kernel/cryptodev/cryptodev-qoriq-linux_1.7.bb
rename to 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
 
 SUMMARY = "A /dev/crypto device driver header file"
 
-PROVIDES = "cryptodev-linux"
+PROVIDES += "cryptodev-linux"
 
 do_compile[noexec] = "1"
 
@@ -12,5 +12,3 @@ do_install() {
 }
 
 ALLOW_EMPTY_${PN} = "1"
-
-COMPATIBLE_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 @@
-require cryptodev-qoriq_${PV}.inc
-
-SUMMARY = "A /dev/crypto device driver kernel module"
-
-PROVIDES = "cryptodev-module"
-
-inherit module qoriq_build_64bit_kernel
-
-# Header file provided by a separate package
-DEPENDS += "cryptodev-linux"
-
-EXTRA_OEMAKE='KERNEL_DIR="${STAGING_KERNEL_DIR}" PREFIX="${D}"'
-
-COMPATIBLE_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 @@
+require cryptodev-qoriq_${PV}.inc
+
+SUMMARY = "A /dev/crypto device driver kernel module"
+
+inherit module qoriq_build_64bit_kernel
+
+PROVIDES += "cryptodev-module"
+
+# Header file provided by a separate package
+DEPENDS += "cryptodev-linux"
+
+SRC_URI_append = " \
+file://0001-Disable-installing-header-file-provided-by-another-p.patch \
+"
+
+EXTRA_OEMAKE='KERNEL_DIR="${STAGING_KERNEL_DIR}" DESTDIR="${D}"'
+
+RCONFLICTS_${PN} = "ocf-linux"
+RREPLACES_${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
similarity index 56%
rename from recipes-kernel/cryptodev/cryptodev-qoriq-tests_1.7.bb
rename to 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 @@
 require cryptodev-qoriq_${PV}.inc
 
 SUMMARY = "A test suite for /dev/crypto device driver"
-DEPENDS = "openssl"
 
-PROVIDES = "cryptodev-tests"
+DEPENDS += "openssl"
 
-EXTRA_OEMAKE='KERNEL_DIR="${STAGING_KERNEL_DIR}" PREFIX="${D}"'
+PROVIDES += "cryptodev-tests"
+
+SRC_URI_append = " \
+file://0001-Add-the-compile-and-install-rules-for-cryptodev-test.patch \
+"
+
+EXTRA_OEMAKE='KERNEL_DIR="${STAGING_EXECPREFIXDIR}" DESTDIR="${D}"'
 
 do_compile() {
 	oe_runmake testprogs
@@ -17,5 +22,3 @@ do_install() {
 
 FILES_${PN}-dbg += "${bindir}/tests_cryptodev/.debug"
 FILES_${PN} = "${bindir}/tests_cryptodev/*"
-
-COMPATIBLE_MACHINE = "(qoriq)"
diff --git a/recipes-kernel/cryptodev/cryptodev-qoriq_1.7.inc b/recipes-kernel/cryptodev/cryptodev-qoriq_1.8.inc
similarity index 62%
rename from recipes-kernel/cryptodev/cryptodev-qoriq_1.7.inc
rename to 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 @@
 HOMEPAGE = "http://cryptodev-linux.org/"
 
-RCONFLICTS_${PN} = "ocf-linux"
-RREPLACES_${PN} = "ocf-linux"
-
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 
@@ -15,17 +12,14 @@ python() {
             d.appendVar("RREPLACES_%s" % p, p.replace('cryptodev-qoriq', 'cryptodev'))
 }
 
+FILESEXTRAPATHS_prepend := "${THISDIR}/sdk_patches:"
+FILESEXTRAPATHS_prepend := "${THISDIR}/yocto_patches:"
+
 SRC_URI = "http://download.gna.org/cryptodev-linux/cryptodev-linux-${PV}.tar.gz"
-SRC_URI[md5sum] = "0b63b3481cf2c90386b35f057481d36b"
-SRC_URI[sha256sum] = "41880533b53de4d7b3f054e230f576988dafb8eed7bef5ebcf6422bb2e3a3b25"
-
-# Upstream hotfixes and yocto specific patches
-SRC_URI_append = " \
-file://0001-fix-compilation-against-linux-3.19.patch \
-file://0002-tests-Makefile-fix-arg-passing-to-CC-in-implicit-rul.patch \
-file://0003-Disable-installing-header-file-provided-by-another-p.patch \
-file://0004-Add-the-compile-and-install-rules-for-cryptodev-test.patch \
-"
+
+SRC_URI[md5sum] = "02644cc4cd02301e0b503a332eb2f0b5"
+SRC_URI[sha256sum] = "67fabde9fb67b286a96c4f45b594b0eccd0f761b495705c18f2ae9461b831376"
+
 # SDK patches
 SRC_URI_append = " file://0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch \
 file://0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch \
@@ -51,6 +45,25 @@ file://0021-check-return-codes-for-copy-to-from-user-functions.patch \
 file://0022-fix-double-free-pkc-req-on-error.patch \
 file://0023-remove-MAY_BACKLOG-flag-from-requests.patch \
 file://0024-fix-COMPAT_CIOCKEY-ioctl-command-number.patch \
+file://0025-fix-benchmarks-linking.patch \
+file://0026-fix-Makefile-to-allow-parallel-make-with-j-option.patch \
+file://0027-use-Linux-kernel-conventions-for-Makefile-variables.patch \
+file://0028-for-consistency-use-.-instead-of-.-in-makefiles.patch \
+file://0029-fix-clean-up-on-error-path-for-crypto_create_session.patch \
+file://0030-remove-code-duplication-in-cryptodev_hash_init.patch \
+file://0031-fix-comment-typo.patch \
+file://0032-avoid-calls-to-kmalloc-on-hotpaths.patch \
+file://0033-avoid-unnecessary-checks-for-hash-clean-up.patch \
+file://0034-extend-API-with-CIOCHASH-to-support-direct-hash-oper.patch \
+file://0035-use-directly-crypto-API-digest-operation-for-CIOCHAS.patch \
+file://0036-add-compat-for-CIOCHASH-operation.patch \
+file://0037-rewrite-sha_speed.c-to-reduce-code-duplication.patch \
+file://0038-extend-sha_speed.c-to-test-CIOCHASH.patch \
+file://0039-fix-memory-leaks-on-error-path-for-CIOCHASH.patch \
+file://0040-fix-structure-init-in-sha_speed-test.patch \
+file://0041-add-separate-target-for-building-tests.patch \
+file://0042-fix-destination-for-staged-installs.patch \
+file://0043-add-install-target-for-tests.patch \
 "
 
 # 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
 S = "${WORKDIR}/cryptodev-linux-${PV}"
 
 CLEANBROKEN = "1"
+COMPATIBLE_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 @@
-From d30c9c64aca4a7905e1b7eb3e28e1c616191bd34 Mon Sep 17 00:00:00 2001
-From: Cristian Stoica <cristian.stoica at freescale.com>
-Date: Tue, 9 Dec 2014 16:41:25 +0200
-Subject: [PATCH] don't advertise RSA keygen
-
-Disable RSA keygen operations when they are not available.
-
-Currently no testing can be done and this patch should be applied
-selectively on platforms that have incomplete support for RSA operations
-(for example pkc driver on C293)
-
-Change-Id: Ic8df014623410c3cf4b0b217a246efcea8f2eeef
-Signed-off-by: Cristian Stoica <cristian.stoica at freescale.com>
----
- ioctl.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/ioctl.c b/ioctl.c
-index 53dbf64..27dc66e 100644
---- a/ioctl.c
-+++ b/ioctl.c
-@@ -979,7 +979,7 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
- 	case CIOCASYMFEAT:
- 		ses = 0;
- 		if (crypto_has_alg("pkc(rsa)", 0, 0))
--			ses = CRF_MOD_EXP_CRT |	CRF_MOD_EXP | CRF_RSA_GENERATE_KEY;
-+			ses = CRF_MOD_EXP_CRT |	CRF_MOD_EXP ;
- 		if (crypto_has_alg("pkc(dsa)", 0, 0))
- 			ses |= CRF_DSA_SIGN | CRF_DSA_VERIFY | CRF_DSA_GENERATE_KEY;
- 		if (crypto_has_alg("pkc(dh)", 0, 0))
--- 
-2.3.5
-
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 @@
-From 5054d20d45571cc85339351fde52f872eeb82206 Mon Sep 17 00:00:00 2001
-From: Phil Sutter <phil at nwl.cc>
-Date: Tue, 10 Feb 2015 04:57:05 +0100
-Subject: [PATCH 1/4] fix compilation against linux-3.19
-
-Commit f938612dd97d481b8b5bf960c992ae577f081c17 in linux.git removes
-get_unused_fd() macro. This patch changes the calling code to use it's
-content 'get_unused_fd_flags(0)' instead. Checking for when
-get_unused_fd_flags was introduced shows it's been there since 2.6.23 at
-least, so probably no need to make this change conditional on the target
-kernel version.
-
-Original patch by Ricardo Ribalda Delgado for Open Embedded, reported by
-Oleg Rakhmanov.
-
-Signed-off-by: Phil Sutter <phil at nwl.cc>
----
- ioctl.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/ioctl.c b/ioctl.c
-index 5a55a76..b23f5fd 100644
---- a/ioctl.c
-+++ b/ioctl.c
-@@ -546,7 +546,7 @@ static int
- clonefd(struct file *filp)
- {
- 	int ret;
--	ret = get_unused_fd();
-+	ret = get_unused_fd_flags(0);
- 	if (ret >= 0) {
- 			get_file(filp);
- 			fd_install(ret, filp);
--- 
-2.3.5
-
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 @@
-From 47ff1eb9bb4f872c1d731b93d334ee5865bf3439 Mon Sep 17 00:00:00 2001
-From: Denys Dmytriyenko <denys at ti.com>
-Date: Sun, 6 Apr 2014 22:16:30 -0400
-Subject: [PATCH] Fix tests Makefile usage of LDLIBS vs. LDFLAGS
-
-Libraries must come after objects, as link order matters, especially
-when using linker flags like -Wl,--as-needed.
-
-Signed-off-by: Denys Dmytriyenko <denys at ti.com>
-
-Upstream-Status: Pending
----
- tests/Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tests/Makefile b/tests/Makefile
-index cd202af..67c3c83 100644
---- a/tests/Makefile
-+++ b/tests/Makefile
-@@ -39,5 +39,5 @@ testprogs: $(hostprogs)
- clean:
- 	rm -f *.o *~ $(hostprogs)
- 
--${comp_progs}: LDFLAGS += -lssl -lcrypto
-+${comp_progs}: LDLIBS += -lssl -lcrypto
- ${comp_progs}: %: %.o openssl_wrapper.o
--- 
-1.9.1
-
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 @@
-From da730106c2558c8e0c8e1b1b1812d32ef9574ab7 Mon Sep 17 00:00:00 2001
-From: Phil Sutter <phil at nwl.cc>
-Date: Sat, 11 Apr 2015 12:45:05 +0200
-Subject: [PATCH 2/4] tests/Makefile: fix arg passing to CC in implicit rule
-
-GCC docs suggest passing -lfoo after object files referring to functions
-in libfoo. Therefore use LDLIBS to specify libraries, which puts them at
-the right place when make calls CC implicitly.
-
-Signed-off-by: Phil Sutter <phil at nwl.cc>
----
- tests/Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tests/Makefile b/tests/Makefile
-index c9f04e8..20c52ba 100644
---- a/tests/Makefile
-+++ b/tests/Makefile
-@@ -31,5 +31,5 @@ check: $(hostprogs)
- clean:
- 	rm -f *.o *~ $(hostprogs)
- 
--${comp_progs}: LDFLAGS += -lssl -lcrypto
-+${comp_progs}: LDLIBS += -lssl -lcrypto
- ${comp_progs}: %: %.o openssl_wrapper.o
--- 
-2.3.5
-
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 @@
-From c618f882c283511dd4f7547113a1117c4785f56f Mon Sep 17 00:00:00 2001
-From: Denys Dmytriyenko <denys at ti.com>
-Date: Sun, 6 Apr 2014 19:51:39 -0400
-Subject: [PATCH 3/4] Disable installing header file provided by another
- package
-
-Signed-off-by: Denys Dmytriyenko <denys at ti.com>
-
-Upstream-Status: Inappropriate [ OE specific ]
----
- Makefile | 2 --
- 1 file changed, 2 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index 31c4b3f..855bb54 100644
---- a/Makefile
-+++ b/Makefile
-@@ -31,8 +31,6 @@ install: modules_install
- 
- modules_install:
- 	make -C $(KERNEL_DIR) SUBDIRS=`pwd` modules_install
--	@echo "Installing cryptodev.h in $(PREFIX)/usr/include/crypto ..."
--	@install -D crypto/cryptodev.h $(PREFIX)/usr/include/crypto/cryptodev.h
- 
- clean:
- 	make -C $(KERNEL_DIR) SUBDIRS=`pwd` clean
--- 
-2.3.5
-
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 @@
-From 188f30f6233d05eb62b58bf6d94a16bcbeeae0ee Mon Sep 17 00:00:00 2001
-From: Cristian Stoica <cristian.stoica at freescale.com>
-Date: Mon, 27 Apr 2015 15:26:14 +0300
-Subject: [PATCH 4/4] Add the compile and install rules for cryptodev tests
-
-Change-Id: Ica10dc563c77220dcf0e0993515230df8a86c34d
-Signed-off-by: Yu Zongchun <b40527 at freescale.com>
----
- Makefile       | 6 ++++++
- tests/Makefile | 8 ++++++++
- 2 files changed, 14 insertions(+)
-
-diff --git a/Makefile b/Makefile
-index 855bb54..5497037 100644
---- a/Makefile
-+++ b/Makefile
-@@ -32,6 +32,9 @@ install: modules_install
- modules_install:
- 	make -C $(KERNEL_DIR) SUBDIRS=`pwd` modules_install
- 
-+install_tests:
-+	make -C tests install DESTDIR=$(PREFIX)
-+
- clean:
- 	make -C $(KERNEL_DIR) SUBDIRS=`pwd` clean
- 	rm -f $(hostprogs) *~
-@@ -40,6 +43,9 @@ clean:
- check:
- 	CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) make -C tests check
- 
-+testprogs:
-+	KERNEL_DIR=$(KERNEL_DIR) make -C tests testprogs
-+
- CPOPTS =
- ifneq (${SHOW_TYPES},)
- CPOPTS += --show-types
-diff --git a/tests/Makefile b/tests/Makefile
-index 20c52ba..67c3c83 100644
---- a/tests/Makefile
-+++ b/tests/Makefile
-@@ -19,6 +19,12 @@ example-async-hmac-objs := async_hmac.o
- example-async-speed-objs := async_speed.o
- example-hashcrypt-speed-objs := hashcrypt_speed.c
- 
-+install:
-+	install -d  $(DESTDIR)/usr/bin/tests_cryptodev
-+	for bin in $(hostprogs); do \
-+		install -m 755 $${bin} $(DESTDIR)/usr/bin/tests_cryptodev/; \
-+	done
-+
- check: $(hostprogs)
- 	./cipher
- 	./hmac
-@@ -28,6 +34,8 @@ check: $(hostprogs)
- 	./cipher-gcm
- 	./cipher-aead
- 
-+testprogs: $(hostprogs)
-+
- clean:
- 	rm -f *.o *~ $(hostprogs)
- 
--- 
-2.3.5
-
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
similarity index 91%
rename from recipes-kernel/cryptodev/files/0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch
rename to 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 @@
-From c653e3a70499c6bb66b57c1788d2d38ca9b8a07e Mon Sep 17 00:00:00 2001
+From 25a68839e3aab5acebcbe51f7fbe9d2d26216bc0 Mon Sep 17 00:00:00 2001
 From: Cristian Stoica <cristian.stoica at freescale.com>
 Date: Thu, 29 Aug 2013 16:52:30 +0300
-Subject: [PATCH 01/15] add support for composite TLS10(SHA1,AES) algorithm
+Subject: [PATCH 01/38] add support for composite TLS10(SHA1,AES) algorithm
  offload
 
 This adds support for composite algorithm offload as a primitive
@@ -48,5 +48,5 @@ index b23f5fd..a3f8379 100644
  		alg_name = "ecb(cipher_null)";
  		stream = 1;
 -- 
-2.3.5
+2.7.0
 
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
similarity index 97%
rename from recipes-kernel/cryptodev/files/0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch
rename to 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 @@
-From 71b317347179225693c6d41b740d387ae2c25061 Mon Sep 17 00:00:00 2001
+From d9f27d08708556e22e1b1dc87b0495896879ca66 Mon Sep 17 00:00:00 2001
 From: Horia Geanta <horia.geanta at freescale.com>
 Date: Wed, 4 Dec 2013 15:43:41 +0200
-Subject: [PATCH 02/15] add support for COMPAT_CIOCAUTHCRYPT ioctl()
+Subject: [PATCH 02/38] add support for COMPAT_CIOCAUTHCRYPT ioctl()
 
 Upstream-status: Pending
 
@@ -203,5 +203,5 @@ index a3f8379..5a44807 100644
  	case COMPAT_CIOCASYNCCRYPT:
  		if (unlikely(ret = compat_kcop_from_user(&kcop, fcr, arg)))
 -- 
-2.3.5
+2.7.0
 
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
similarity index 99%
rename from recipes-kernel/cryptodev/files/0003-PKC-support-added-in-cryptodev-module.patch
rename to 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 @@
-From fc9ee6ed33c76372de6e3748d2e951fa10f7c47e Mon Sep 17 00:00:00 2001
+From 2bda43095b511e0052b3bc27b216ff9909cc03d2 Mon Sep 17 00:00:00 2001
 From: Yashpal Dutta <yashpal.dutta at freescale.com>
 Date: Fri, 7 Mar 2014 06:16:09 +0545
-Subject: [PATCH 03/15] PKC support added in cryptodev module
+Subject: [PATCH 03/38] PKC support added in cryptodev module
 
 Upstream-status: Pending
 
@@ -894,5 +894,5 @@ index 57e5c38..0b7951e 100644
  {
  	struct csession *ses_ptr;
 -- 
-2.3.5
+2.7.0
 
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
similarity index 97%
rename from recipes-kernel/cryptodev/files/0004-Compat-versions-of-PKC-IOCTLs.patch
rename to 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 @@
-From b109fbdb64de6be0dc2f0d2ef108cead34652495 Mon Sep 17 00:00:00 2001
+From e0e5c1bfb21888bf9f87f72ac8cdf7eee951f619 Mon Sep 17 00:00:00 2001
 From: Yashpal Dutta <yashpal.dutta at freescale.com>
 Date: Fri, 7 Mar 2014 06:52:13 +0545
-Subject: [PATCH 04/15] Compat versions of PKC IOCTLs
+Subject: [PATCH 04/38] Compat versions of PKC IOCTLs
 
 Upstream-status: Pending
 
@@ -196,5 +196,5 @@ index 69980e3..9431025 100644
  		return -EINVAL;
  	}
 -- 
-2.3.5
+2.7.0
 
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
similarity index 97%
rename from recipes-kernel/cryptodev/files/0005-Asynchronous-interface-changes-in-cryptodev.patch
rename to 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 @@
-From 7594d5375d998eb25241750b623661ff021697d3 Mon Sep 17 00:00:00 2001
+From d98f979d76c30058da24e62220f19c5b8c627819 Mon Sep 17 00:00:00 2001
 From: Yashpal Dutta <yashpal.dutta at freescale.com>
 Date: Fri, 7 Mar 2014 07:24:00 +0545
-Subject: [PATCH 05/15] Asynchronous interface changes in cryptodev
+Subject: [PATCH 05/38] Asynchronous interface changes in cryptodev
 
 Upstream-status: Pending
 
@@ -209,5 +209,5 @@ index 9431025..e2f407f 100644
  	return ret;
  	default:
 -- 
-2.3.5
+2.7.0
 
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
similarity index 97%
rename from recipes-kernel/cryptodev/files/0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch
rename to 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 @@
-From eccd6277b067cd85094eb057225cc0a983300b9f Mon Sep 17 00:00:00 2001
+From b92d23a790d9634d52db3b9a5e1882fde620b073 Mon Sep 17 00:00:00 2001
 From: Yashpal Dutta <yashpal.dutta at freescale.com>
 Date: Fri, 7 Mar 2014 07:53:53 +0545
-Subject: [PATCH 06/15] ECC_KEYGEN and DLC_KEYGEN supported in cryptodev module
+Subject: [PATCH 06/38] ECC_KEYGEN and DLC_KEYGEN supported in cryptodev module
 
 Upstream-status: Pending
 
@@ -208,5 +208,5 @@ index 0b7951e..c901bc7 100644
  err:
  	return ret;
 -- 
-2.3.5
+2.7.0
 
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
similarity index 98%
rename from recipes-kernel/cryptodev/files/0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch
rename to 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 @@
-From 78c01e1882def52c72966c0e86913950ec201af9 Mon Sep 17 00:00:00 2001
+From 00a8ac310a33767eac0a07e32597c1a6f467315f Mon Sep 17 00:00:00 2001
 From: Yashpal Dutta <yashpal.dutta at freescale.com>
 Date: Fri, 7 Mar 2014 08:49:15 +0545
-Subject: [PATCH 07/15] RCU stall fixed in PKC asynchronous interface
+Subject: [PATCH 07/38] RCU stall fixed in PKC asynchronous interface
 
 Upstream-status: Pending
 
@@ -234,5 +234,5 @@ index c901bc7..2747706 100644
  	if (!buf)
  		return -ENOMEM;
 -- 
-2.3.5
+2.7.0
 
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
similarity index 97%
rename from recipes-kernel/cryptodev/files/0008-Add-RSA-Key-generation-offloading.patch
rename to 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 @@
-From 5127db3483a2e4f6dc13330bea7237931c5f15a0 Mon Sep 17 00:00:00 2001
+From a2cbb5fcc2d6f3734b5ed2826e828d852cfdf8ba Mon Sep 17 00:00:00 2001
 From: Hou Zhiqiang <B48286 at freescale.com>
 Date: Wed, 19 Mar 2014 14:02:46 +0800
-Subject: [PATCH 08/15] Add RSA Key generation offloading
+Subject: [PATCH 08/38] Add RSA Key generation offloading
 
 Upstream-status: Pending
 
@@ -166,5 +166,5 @@ index 2747706..14dcf40 100644
  err:
  	return ret;
 -- 
-2.3.5
+2.7.0
 
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
similarity index 97%
rename from recipes-kernel/cryptodev/files/0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch
rename to 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 @@
-From 800af48d0c26830943ca2308dd426b5b09811750 Mon Sep 17 00:00:00 2001
+From 263483d1023f6c1c35b5488b9b79796ee2605e9b Mon Sep 17 00:00:00 2001
 From: Yashpal Dutta <yashpal.dutta at freescale.com>
 Date: Thu, 17 Apr 2014 07:08:47 +0545
-Subject: [PATCH 09/15] Fixed compilation error of openssl with fsl cryptodev
+Subject: [PATCH 09/38] Fixed compilation error of openssl with fsl cryptodev
 
 Upstream-status: Pending
 
@@ -156,5 +156,5 @@ index 14dcf40..6365911 100644
   * This file is part of linux cryptodev.
   *
 -- 
-2.3.5
+2.7.0
 
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
similarity index 91%
rename from recipes-kernel/cryptodev/files/0010-add-support-for-composite-TLS10-SHA1-3DES-algorithm-.patch
rename to 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 @@
-From 55ee0ae703a68db74a492f5910937260502b9602 Mon Sep 17 00:00:00 2001
+From 269564f4e00fa907388ccfa046b930b3c4eef4dc Mon Sep 17 00:00:00 2001
 From: Tudor Ambarus <tudor.ambarus at freescale.com>
 Date: Tue, 10 Jun 2014 08:27:59 +0300
-Subject: [PATCH 10/15] add support for composite TLS10(SHA1,3DES) algorithm
+Subject: [PATCH 10/38] add support for composite TLS10(SHA1,3DES) algorithm
  offload
 
 This adds support for composite algorithm offload in a single crypto
@@ -50,5 +50,5 @@ index c97320b..574e913 100644
  		alg_name = "ecb(cipher_null)";
  		stream = 1;
 -- 
-2.3.5
+2.7.0
 
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
similarity index 94%
rename from recipes-kernel/cryptodev/files/0011-add-support-for-TLSv1.1-record-offload.patch
rename to 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 @@
-From 06cca15fd0412ae872c2b2c5d50216e1eb34fc50 Mon Sep 17 00:00:00 2001
+From 73c20be9ae1ed57d8c428c86471f42d953e79fba Mon Sep 17 00:00:00 2001
 From: Tudor Ambarus <tudor.ambarus at freescale.com>
 Date: Tue, 31 Mar 2015 16:15:47 +0300
-Subject: [PATCH 11/15] add support for TLSv1.1 record offload
+Subject: [PATCH 11/38] add support for TLSv1.1 record offload
 
 This adds support for composite algorithm offload in a single crypto
 (cipher + hmac) operation.
@@ -72,5 +72,5 @@ index 574e913..ba82387 100644
  		aead = 1;
  		break;
 -- 
-2.3.5
+2.7.0
 
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
similarity index 93%
rename from recipes-kernel/cryptodev/files/0012-add-support-for-TLSv1.2-record-offload.patch
rename to 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 @@
-From 15999e402dd7472cafe51be3fd0ce66433ca924b Mon Sep 17 00:00:00 2001
+From f1a519d9eed072bd45a45d251603c64f942814fb Mon Sep 17 00:00:00 2001
 From: Tudor Ambarus <tudor.ambarus at freescale.com>
 Date: Tue, 31 Mar 2015 16:16:28 +0300
-Subject: [PATCH 12/15] add support for TLSv1.2 record offload
+Subject: [PATCH 12/38] add support for TLSv1.2 record offload
 
 This adds support for composite algorithm offload in a single crypto
 (cipher + hmac) operation.
@@ -68,5 +68,5 @@ index ba82387..fb4c4e3 100644
  		alg_name = "ecb(cipher_null)";
  		stream = 1;
 -- 
-2.3.5
+2.7.0
 
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
similarity index 98%
rename from recipes-kernel/cryptodev/files/0013-clean-up-code-layout.patch
rename to 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 @@
-From 39abcb9cea60540528e848d6c66169c36d666861 Mon Sep 17 00:00:00 2001
+From 5a87b9d5f2295ed0fd36a41c8376e01eb0df62b2 Mon Sep 17 00:00:00 2001
 From: Cristian Stoica <cristian.stoica at freescale.com>
 Date: Fri, 20 Feb 2015 12:46:58 +0200
-Subject: [PATCH 13/15] clean-up code layout
+Subject: [PATCH 13/38] clean-up code layout
 
 Signed-off-by: Cristian Stoica <cristian.stoica at freescale.com>
 Change-Id: I92c2f4baeed9470a2c3c42b592d878e65918b0af
@@ -182,5 +182,5 @@ index 6365911..af66553 100644
  		if (rc != -EINPROGRESS && rc != 0)
  			goto err;
 -- 
-2.3.5
+2.7.0
 
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
similarity index 99%
rename from recipes-kernel/cryptodev/files/0014-remove-redundant-data-copy-for-pkc-operations.patch
rename to 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 @@
-From 34e765977633b5f81845c0183af6d388d8225f00 Mon Sep 17 00:00:00 2001
+From a4d88e5379ddb7d9bceac3141f508b8173d1e902 Mon Sep 17 00:00:00 2001
 From: Cristian Stoica <cristian.stoica at freescale.com>
 Date: Mon, 23 Feb 2015 12:14:07 +0200
-Subject: [PATCH 14/15] remove redundant data copy for pkc operations
+Subject: [PATCH 14/38] remove redundant data copy for pkc operations
 
 This patch removes a copy of a pkc request that was
 allocated on the hot-path. The copy was not necessary
@@ -490,5 +490,5 @@ index af66553..ed1c69a 100644
  
  int crypto_run(struct fcrypt *fcr, struct kernel_crypt_op *kcop)
 -- 
-2.3.5
+2.7.0
 
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
similarity index 90%
rename from recipes-kernel/cryptodev/files/0015-fix-pkc-request-deallocation.patch
rename to 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 @@
-From 8361f99c940fbe270fca2112dae3d97c9a5776d6 Mon Sep 17 00:00:00 2001
+From 212e418fa7b70c8ba79446006001c574cb9d42f8 Mon Sep 17 00:00:00 2001
 From: Cristian Stoica <cristian.stoica at freescale.com>
 Date: Mon, 23 Feb 2015 15:28:22 +0200
-Subject: [PATCH 15/15] fix pkc request deallocation
+Subject: [PATCH 15/38] fix pkc request deallocation
 
 The request to be freed is actually pkc->req, and should be done inside
 the fetch ioctl for ASYNC (this patch) and in crypt ioctl for SYNC
@@ -36,5 +36,5 @@ index 797b73c..da3a842 100644
  			} else {
  				spin_unlock_bh(&pcr->completion_lock);
 -- 
-2.3.5
+2.7.0
 
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
similarity index 89%
rename from recipes-kernel/cryptodev/files/0016-add-basic-detection-of-asym-features.patch
rename to 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 @@
-From 586bc4a6cd1014c57364020013062f07a8861e38 Mon Sep 17 00:00:00 2001
+From 4ce4081d9abef651473e9d7e089a0748f77db631 Mon Sep 17 00:00:00 2001
 From: Cristian Stoica <cristian.stoica at freescale.com>
 Date: Mon, 20 Apr 2015 13:18:47 +0300
-Subject: [PATCH] add basic detection of asym features
+Subject: [PATCH 16/38] add basic detection of asym features
 
 Change-Id: I3b3ba8664bf631a63be1f11e715024509e20f841
 Signed-off-by: Cristian Stoica <cristian.stoica at freescale.com>
@@ -33,5 +33,5 @@ index da3a842..53dbf64 100644
  		fd = clonefd(filp);
  		ret = put_user(fd, p);
 -- 
-2.3.5
+2.7.0
 
diff --git a/recipes-kernel/cryptodev/files/0017-remove-dead-code.patch b/recipes-kernel/cryptodev/sdk_patches/0017-remove-dead-code.patch
similarity index 97%
rename from recipes-kernel/cryptodev/files/0017-remove-dead-code.patch
rename to 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 @@
 From 0ca641091b4113d73e75d30ef530c88836849308 Mon Sep 17 00:00:00 2001
 From: Tudor Ambarus <tudor.ambarus at freescale.com>
 Date: Fri, 29 May 2015 15:28:47 +0300
-Subject: [PATCH 17/20] remove dead code
+Subject: [PATCH 17/38] remove dead code
 
 Functions kop_to_user and compat_kop_to_user are never used. Delete them
 to avoid compiler warnings.
@@ -63,5 +63,5 @@ index 53dbf64..39635a4 100644
  compat_to_session_op(struct compat_session_op *compat, struct session_op *sop)
  {
 -- 
-2.3.5
+2.7.0
 
diff --git a/recipes-kernel/cryptodev/files/0018-fix-compat-warnings.patch b/recipes-kernel/cryptodev/sdk_patches/0018-fix-compat-warnings.patch
similarity index 97%
rename from recipes-kernel/cryptodev/files/0018-fix-compat-warnings.patch
rename to 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 @@
 From 596378a22532908487f2c5e4d717c5ae618c4c7d Mon Sep 17 00:00:00 2001
 From: Tudor Ambarus <tudor.ambarus at freescale.com>
 Date: Tue, 2 Jun 2015 10:44:12 +0300
-Subject: [PATCH 18/20] fix compat warnings
+Subject: [PATCH 18/38] fix compat warnings
 
   CC [M]  crypto/../../cryptodev-linux/ioctl.o
 crypto/../../cryptodev-linux/ioctl.c: In function 'compat_to_crypt_kop':
@@ -60,5 +60,5 @@ index 39635a4..f3ce2f6 100644
  				kfree(pkc);
  			} else {
 -- 
-2.3.5
+2.7.0
 
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
similarity index 98%
rename from recipes-kernel/cryptodev/files/0019-fix-size_t-print-format.patch
rename to 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 @@
 From 1d10f06bef0f07980a08b387850c1daf1d3a8e87 Mon Sep 17 00:00:00 2001
 From: Tudor Ambarus <tudor.ambarus at freescale.com>
 Date: Tue, 2 Jun 2015 12:11:12 +0300
-Subject: [PATCH 19/20] fix size_t print format
+Subject: [PATCH 19/38] fix size_t print format
 
   CC [M]  crypto/../../cryptodev-linux/cryptlib.o
 crypto/../../cryptodev-linux/cryptlib.c: In function 'cryptodev_cipher_init':
@@ -57,5 +57,5 @@ index 5882a30..10f5e1a 100644
  			ret = -EINVAL;
  			goto error;
 -- 
-2.3.5
+2.7.0
 
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
similarity index 94%
rename from recipes-kernel/cryptodev/files/0020-fix-uninitialized-variable-compiler-warning.patch
rename to 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 @@
 From be9f6a0dc90847dbb00307d23f47b8b3fc3ff130 Mon Sep 17 00:00:00 2001
 From: Tudor Ambarus <tudor.ambarus at freescale.com>
 Date: Fri, 29 May 2015 15:49:22 +0300
-Subject: [PATCH 20/20] fix uninitialized variable compiler warning
+Subject: [PATCH 20/38] fix uninitialized variable compiler warning
 
 crypto/../../cryptodev-linux/ioctl.c: In function 'cryptodev_compat_ioctl':
 crypto/../../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
  
  		for (i = 0; i < MAX_COOKIES; i++) {
 -- 
-2.3.5
+2.7.0
 
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
similarity index 99%
rename from recipes-kernel/cryptodev/files/0021-check-return-codes-for-copy-to-from-user-functions.patch
rename to 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 @@
 From 4078382cfc69c0f5e582d485fe8cc778f9e458d1 Mon Sep 17 00:00:00 2001
 From: Cristian Stoica <cristian.stoica at freescale.com>
 Date: Mon, 21 Sep 2015 16:39:52 +0300
-Subject: [PATCH 21/23] check return codes for copy to/from user functions
+Subject: [PATCH 21/38] check return codes for copy to/from user functions
 
 - these functions may fail and we should check their return codes.
 - fix an unintended fall-through in CRK_DSA_GENERATE_KEY
@@ -394,5 +394,5 @@ index ed1c69a..e5adb93 100644
  		if (rc != -EINPROGRESS && rc != 0)
  			goto err;
 -- 
-2.3.5
+2.7.0
 
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
similarity index 91%
rename from recipes-kernel/cryptodev/files/0022-fix-double-free-pkc-req-on-error.patch
rename to 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 @@
 From 85146b8429ba11bd0be68c24c17dd77b21ec8c25 Mon Sep 17 00:00:00 2001
 From: Cristian Stoica <cristian.stoica at freescale.com>
 Date: Mon, 12 Oct 2015 23:03:28 +0300
-Subject: [PATCH 22/23] fix double free pkc->req on error
+Subject: [PATCH 22/38] fix double free pkc->req on error
 
 Signed-off-by: Cristian Stoica <cristian.stoica at freescale.com>
 ---
@@ -22,5 +22,5 @@ index e5adb93..ec11129 100644
  
  	return err;
 -- 
-2.3.5
+2.7.0
 
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
similarity index 97%
rename from recipes-kernel/cryptodev/files/0023-remove-MAY_BACKLOG-flag-from-requests.patch
rename to 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 @@
 From 7d0d0deb255f8c59b0cf6d3944ee2e3be4133b4c Mon Sep 17 00:00:00 2001
 From: Alex Porosanu <alexandru.porosanu at freescale.com>
 Date: Mon, 19 Oct 2015 11:53:11 +0300
-Subject: [PATCH 23/23] remove MAY_BACKLOG flag from requests
+Subject: [PATCH 23/38] remove MAY_BACKLOG flag from requests
 
 cryptodev doesn't implement the backlogging mechanism properly,
 since it misses the possibility of sleeping and waiting for
@@ -65,5 +65,5 @@ index 10f5e1a..eba4616 100644
  	if (ret != -EINPROGRESS && ret != 0)
  		goto error;
 -- 
-2.3.5
+2.7.0
 
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
similarity index 94%
rename from recipes-kernel/cryptodev/files/0024-fix-COMPAT_CIOCKEY-ioctl-command-number.patch
rename to 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 @@
 From 53e4d0fe4a334dae3df32b2053e4ebdfda2e9148 Mon Sep 17 00:00:00 2001
 From: Tudor Ambarus <tudor.ambarus at freescale.com>
 Date: Tue, 27 Oct 2015 15:51:02 +0200
-Subject: [PATCH] fix COMPAT_CIOCKEY ioctl command number
+Subject: [PATCH 24/38] fix COMPAT_CIOCKEY ioctl command number
 
 CIOCKEY and COMPAT_CIOCKEY had different command numbers,
 so that 32-bit applications got EINVAL error on 64-bit kernel.
@@ -25,5 +25,5 @@ index c83c885..cb005d7 100644
  #define COMPAT_CIOCASYNCFETCH  _IOR('c', 108, struct compat_crypt_op)
  #define COMPAT_CIOCAUTHCRYPT   _IOWR('c', 109, struct compat_crypt_auth_op)
 -- 
-2.3.3
+2.7.0
 
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 @@
+From 978cfcf9253c409520c0f168f8caa249f50a8843 Mon Sep 17 00:00:00 2001
+From: Fridolin Pokorny <fpokorny at redhat.com>
+Date: Fri, 8 Jan 2016 09:38:29 +0100
+Subject: [PATCH 25/38] fix benchmarks linking
+
+---
+ lib/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/Makefile b/lib/Makefile
+index af87795..3bedc34 100644
+--- a/lib/Makefile
++++ b/lib/Makefile
+@@ -3,7 +3,7 @@ CFLAGS=-g -O2 -Wall
+ all: benchmark
+ 
+ benchmark: main.c libthreshold.a
+-	gcc $(CFLAGS) -DDEBUG -o $@ $^ -lssl libthreshold.a
++	gcc $(CFLAGS) -DDEBUG -o $@ $^ -lssl -lcrypto libthreshold.a
+ 
+ .o:
+ 	gcc $(CCFLAGS) -c $< -o $@
+-- 
+2.7.0
+
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 @@
+From d96ae48c87f80af1a202c2d2e837bf477edc0fb7 Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at nxp.com>
+Date: Thu, 10 Dec 2015 12:42:18 +0200
+Subject: [PATCH 26/38] fix Makefile to allow parallel make with -j option
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Recursive make commands should always use the variable MAKE, not the
+explicit command name ‘make’
+
+Documented in section "5.7.1 How the MAKE Variable Works" of GNU Make manual
+
+Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
+---
+ Makefile | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 9e56e9d..2f50210 100644
+--- a/Makefile
++++ b/Makefile
+@@ -22,7 +22,7 @@ KERNEL_MAKE_OPTS += CROSS_COMPILE=${CROSS_COMPILE}
+ endif
+ 
+ build: version.h
+-	make ${KERNEL_MAKE_OPTS} modules
++	$(MAKE) $(KERNEL_MAKE_OPTS) modules
+ 
+ version.h: Makefile
+ 	@echo "#define VERSION \"$(VERSION)\"" > version.h
+@@ -30,17 +30,17 @@ version.h: Makefile
+ install: modules_install
+ 
+ modules_install:
+-	make -C $(KERNEL_DIR) SUBDIRS=`pwd` modules_install
++	$(MAKE) -C $(KERNEL_DIR) SUBDIRS=`pwd` modules_install
+ 	@echo "Installing cryptodev.h in $(PREFIX)/usr/include/crypto ..."
+ 	@install -D crypto/cryptodev.h $(PREFIX)/usr/include/crypto/cryptodev.h
+ 
+ clean:
+-	make -C $(KERNEL_DIR) SUBDIRS=`pwd` clean
++	$(MAKE) -C $(KERNEL_DIR) SUBDIRS=`pwd` clean
+ 	rm -f $(hostprogs) *~
+-	CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) make -C tests clean
++	CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) $(MAKE) -C tests clean
+ 
+ check:
+-	CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) make -C tests check
++	CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) $(MAKE) -C tests check
+ 
+ CPOPTS =
+ ifneq (${SHOW_TYPES},)
+-- 
+2.7.0
+
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 @@
+From e51bf208fbd3796238ff4d721e8d070f711f8c56 Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at nxp.com>
+Date: Thu, 10 Dec 2015 12:42:19 +0200
+Subject: [PATCH 27/38] use Linux kernel conventions for Makefile variables
+
+The kernel Makefile specifies to use M=... instead of SUBDIR=... for
+external modules.
+
+PWD variable is already set in a POSIX system and calling `pwd` to find
+it is redundant.
+
+Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
+---
+ Makefile | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 2f50210..7c7e193 100644
+--- a/Makefile
++++ b/Makefile
+@@ -13,7 +13,7 @@ cryptodev-objs = ioctl.o main.o cryptlib.o authenc.o zc.o util.o
+ 
+ obj-m += cryptodev.o
+ 
+-KERNEL_MAKE_OPTS := -C ${KERNEL_DIR} SUBDIRS=`pwd`
++KERNEL_MAKE_OPTS := -C $(KERNEL_DIR) M=$(PWD)
+ ifneq (${ARCH},)
+ KERNEL_MAKE_OPTS += ARCH=${ARCH}
+ endif
+@@ -30,12 +30,12 @@ version.h: Makefile
+ install: modules_install
+ 
+ modules_install:
+-	$(MAKE) -C $(KERNEL_DIR) SUBDIRS=`pwd` modules_install
++	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules_install
+ 	@echo "Installing cryptodev.h in $(PREFIX)/usr/include/crypto ..."
+ 	@install -D crypto/cryptodev.h $(PREFIX)/usr/include/crypto/cryptodev.h
+ 
+ clean:
+-	$(MAKE) -C $(KERNEL_DIR) SUBDIRS=`pwd` clean
++	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) clean
+ 	rm -f $(hostprogs) *~
+ 	CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) $(MAKE) -C tests clean
+ 
+-- 
+2.7.0
+
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 @@
+From 22b63631de17507c12355c30e408dbd88350bb3a Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at nxp.com>
+Date: Thu, 10 Dec 2015 12:42:20 +0200
+Subject: [PATCH 28/38] for consistency, use $(...) instead of ${...} in
+ makefiles
+
+Both syntax rules are equaly valid and mixing them is permitted but
+looks inconsistent.
+
+See section "6.1 Basics of Variable References" of GNU make manual
+
+Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
+---
+ Makefile       | 16 ++++++++--------
+ tests/Makefile |  2 +-
+ 2 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 7c7e193..7f8df37 100644
+--- a/Makefile
++++ b/Makefile
+@@ -14,11 +14,11 @@ cryptodev-objs = ioctl.o main.o cryptlib.o authenc.o zc.o util.o
+ obj-m += cryptodev.o
+ 
+ KERNEL_MAKE_OPTS := -C $(KERNEL_DIR) M=$(PWD)
+-ifneq (${ARCH},)
+-KERNEL_MAKE_OPTS += ARCH=${ARCH}
++ifneq ($(ARCH),)
++KERNEL_MAKE_OPTS += ARCH=$(ARCH)
+ endif
+-ifneq (${CROSS_COMPILE},)
+-KERNEL_MAKE_OPTS += CROSS_COMPILE=${CROSS_COMPILE}
++ifneq ($(CROSS_COMPILE),)
++KERNEL_MAKE_OPTS += CROSS_COMPILE=$(CROSS_COMPILE)
+ endif
+ 
+ build: version.h
+@@ -43,15 +43,15 @@ check:
+ 	CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) $(MAKE) -C tests check
+ 
+ CPOPTS =
+-ifneq (${SHOW_TYPES},)
++ifneq ($(SHOW_TYPES),)
+ CPOPTS += --show-types
+ endif
+-ifneq (${IGNORE_TYPES},)
+-CPOPTS += --ignore ${IGNORE_TYPES}
++ifneq ($(IGNORE_TYPES),)
++CPOPTS += --ignore $(IGNORE_TYPES)
+ endif
+ 
+ checkpatch:
+-	$(KERNEL_DIR)/scripts/checkpatch.pl ${CPOPTS} --file *.c *.h
++	$(KERNEL_DIR)/scripts/checkpatch.pl $(CPOPTS) --file *.c *.h
+ 
+ VERSIONTAG = refs/tags/cryptodev-linux-$(VERSION)
+ FILEBASE = cryptodev-linux-$(VERSION)
+diff --git a/tests/Makefile b/tests/Makefile
+index 20c52ba..3155da9 100644
+--- a/tests/Makefile
++++ b/tests/Makefile
+@@ -6,7 +6,7 @@ comp_progs := cipher_comp hash_comp hmac_comp
+ 
+ hostprogs := cipher cipher-aead hmac speed async_cipher async_hmac \
+ 	async_speed sha_speed hashcrypt_speed fullspeed cipher-gcm \
+-	cipher-aead-srtp ${comp_progs}
++	cipher-aead-srtp $(comp_progs)
+ 
+ example-cipher-objs := cipher.o
+ example-cipher-aead-objs := cipher-aead.o
+-- 
+2.7.0
+
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 @@
+From 294abaaa4540ec340ed6046a784c9789c8724420 Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at nxp.com>
+Date: Mon, 11 Jan 2016 17:45:50 +0200
+Subject: [PATCH 29/38] fix clean-up on error path for crypto_create_session
+
+This patch fixes clean-up on error path for failed allocations of
+ses_new->pages or ses_new->sg. In these cases, allocations made in
+cryptodev_hash_init have not been undone resulting in possible memory
+leaks.
+
+We take advantage of the initializations with zeros of the session
+structure to trim the code to a single clean-up path.
+
+Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
+---
+ ioctl.c | 28 +++++++++++++++-------------
+ 1 file changed, 15 insertions(+), 13 deletions(-)
+
+diff --git a/ioctl.c b/ioctl.c
+index b23f5fd..c781f9d 100644
+--- a/ioctl.c
++++ b/ioctl.c
+@@ -228,7 +228,8 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
+ 		return -EINVAL;
+ 	}
+ 
+-	/* Create a session and put it to the list. */
++	/* Create a session and put it to the list. Zeroing the structure helps
++	 * also with a single exit point in case of errors */
+ 	ses_new = kzalloc(sizeof(*ses_new), GFP_KERNEL);
+ 	if (!ses_new)
+ 		return -ENOMEM;
+@@ -240,19 +241,19 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
+ 		if (unlikely(ret < 0)) {
+ 			ddebug(1, "Setting key failed for %s-%zu.",
+ 				alg_name, (size_t)sop->keylen*8);
+-			goto error_cipher;
++			goto session_error;
+ 		}
+ 
+ 		ret = cryptodev_get_cipher_key(keys.ckey, sop, aead);
+ 		if (unlikely(ret < 0))
+-			goto error_cipher;
++			goto session_error;
+ 
+ 		ret = cryptodev_cipher_init(&ses_new->cdata, alg_name, keys.ckey,
+ 						keylen, stream, aead);
+ 		if (ret < 0) {
+ 			ddebug(1, "Failed to load cipher for %s", alg_name);
+ 			ret = -EINVAL;
+-			goto error_cipher;
++			goto session_error;
+ 		}
+ 	}
+ 
+@@ -261,13 +262,13 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
+ 			ddebug(1, "Setting key failed for %s-%zu.",
+ 				hash_name, (size_t)sop->mackeylen*8);
+ 			ret = -EINVAL;
+-			goto error_hash;
++			goto session_error;
+ 		}
+ 
+ 		if (sop->mackey && unlikely(copy_from_user(keys.mkey, sop->mackey,
+ 					    sop->mackeylen))) {
+ 			ret = -EFAULT;
+-			goto error_hash;
++			goto session_error;
+ 		}
+ 
+ 		ret = cryptodev_hash_init(&ses_new->hdata, hash_name, hmac_mode,
+@@ -275,7 +276,7 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
+ 		if (ret != 0) {
+ 			ddebug(1, "Failed to load hash for %s", hash_name);
+ 			ret = -EINVAL;
+-			goto error_hash;
++			goto session_error;
+ 		}
+ 	}
+ 
+@@ -292,7 +293,7 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
+ 	if (ses_new->sg == NULL || ses_new->pages == NULL) {
+ 		ddebug(0, "Memory error");
+ 		ret = -ENOMEM;
+-		goto error_hash;
++		goto session_error;
+ 	}
+ 
+ 	/* put the new session to the list */
+@@ -316,18 +317,19 @@ restart:
+ 
+ 	/* Fill in some values for the user. */
+ 	sop->ses = ses_new->sid;
+-
+ 	return 0;
+ 
+-error_hash:
++	/* We count on ses_new to be initialized with zeroes
++	 * Since hdata and cdata are embedded within ses_new, it follows that
++	 * hdata->init and cdata->init are either zero or one as they have been
++	 * initialized or not */
++session_error:
++	cryptodev_hash_deinit(&ses_new->hdata);
+ 	cryptodev_cipher_deinit(&ses_new->cdata);
+ 	kfree(ses_new->sg);
+ 	kfree(ses_new->pages);
+-error_cipher:
+ 	kfree(ses_new);
+-
+ 	return ret;
+-
+ }
+ 
+ /* Everything that needs to be done when remowing a session. */
+-- 
+2.7.0
+
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 @@
+From f4534df637b078fce275763bd8bc2a83bfad25e0 Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at nxp.com>
+Date: Mon, 11 Jan 2016 18:01:06 +0200
+Subject: [PATCH 30/38] remove code duplication in cryptodev_hash_init
+
+cryptodev_hash_init is concerned mostly with allocating data structures
+for hash operations.
+This patch replaces the call it makes to crypto_ahash_init with
+one to cryptodev_hash_reset to avoid code duplication. This call is made
+now outside of the original function to increase modularity.
+
+Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
+---
+ cryptlib.c | 9 ---------
+ ioctl.c    | 5 +++++
+ 2 files changed, 5 insertions(+), 9 deletions(-)
+
+diff --git a/cryptlib.c b/cryptlib.c
+index eba4616..4fd29eb 100644
+--- a/cryptlib.c
++++ b/cryptlib.c
+@@ -362,18 +362,9 @@ int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name,
+ 
+ 	ahash_request_set_callback(hdata->async.request, 0,
+ 				   cryptodev_complete, hdata->async.result);
+-
+-	ret = crypto_ahash_init(hdata->async.request);
+-	if (unlikely(ret)) {
+-		derr(0, "error in crypto_hash_init()");
+-		goto error_request;
+-	}
+-
+ 	hdata->init = 1;
+ 	return 0;
+ 
+-error_request:
+-	ahash_request_free(hdata->async.request);
+ error:
+ 	kfree(hdata->async.result);
+ 	crypto_free_ahash(hdata->async.s);
+diff --git a/ioctl.c b/ioctl.c
+index b36dd03..a537886 100644
+--- a/ioctl.c
++++ b/ioctl.c
+@@ -338,6 +338,11 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
+ 			ret = -EINVAL;
+ 			goto session_error;
+ 		}
++
++		ret = cryptodev_hash_reset(&ses_new->hdata);
++		if (ret != 0) {
++			goto session_error;
++		}
+ 	}
+ 
+ 	ses_new->alignmask = max(ses_new->cdata.alignmask,
+-- 
+2.7.0
+
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 @@
+From 73a2489ba634503a0cc2bb6e84627ceeda0f059f Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at nxp.com>
+Date: Tue, 12 Jan 2016 17:15:56 +0200
+Subject: [PATCH 31/38] fix comment typo
+
+Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
+---
+ ioctl.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ioctl.c b/ioctl.c
+index a537886..7adde75 100644
+--- a/ioctl.c
++++ b/ioctl.c
+@@ -397,7 +397,7 @@ session_error:
+ 	return ret;
+ }
+ 
+-/* Everything that needs to be done when remowing a session. */
++/* Everything that needs to be done when removing a session. */
+ static inline void
+ crypto_destroy_session(struct csession *ses_ptr)
+ {
+-- 
+2.7.0
+
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 @@
+From 9b513838035c35fd3706bb824edd17d705641439 Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at nxp.com>
+Date: Tue, 12 Jan 2016 15:13:15 +0200
+Subject: [PATCH 32/38] avoid calls to kmalloc on hotpaths
+
+We replace a pointer to a small structure with the structure itself to
+avoid unnecessary dynamic allocations at runtime. The embedding
+structure is itself dynamically allocated and we get a slight increase
+in performance from elimination of unnecessary code.
+
+Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
+---
+ cryptlib.c | 42 +++++++++++++-----------------------------
+ cryptlib.h | 14 +++++++-------
+ 2 files changed, 20 insertions(+), 36 deletions(-)
+
+diff --git a/cryptlib.c b/cryptlib.c
+index 4fd29eb..5972fc2 100644
+--- a/cryptlib.c
++++ b/cryptlib.c
+@@ -178,13 +178,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
+ 	out->stream = stream;
+ 	out->aead = aead;
+ 
+-	out->async.result = kzalloc(sizeof(*out->async.result), GFP_KERNEL);
+-	if (unlikely(!out->async.result)) {
+-		ret = -ENOMEM;
+-		goto error;
+-	}
+-
+-	init_completion(&out->async.result->completion);
++	init_completion(&out->async.result.completion);
+ 
+ 	if (aead == 0) {
+ 		out->async.request = ablkcipher_request_alloc(out->async.s, GFP_KERNEL);
+@@ -195,7 +189,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
+ 		}
+ 
+ 		ablkcipher_request_set_callback(out->async.request, 0,
+-					cryptodev_complete, out->async.result);
++					cryptodev_complete, &out->async.result);
+ 	} else {
+ 		out->async.arequest = aead_request_alloc(out->async.as, GFP_KERNEL);
+ 		if (unlikely(!out->async.arequest)) {
+@@ -205,7 +199,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
+ 		}
+ 
+ 		aead_request_set_callback(out->async.arequest, 0,
+-					cryptodev_complete, out->async.result);
++					cryptodev_complete, &out->async.result);
+ 	}
+ 
+ 	out->init = 1;
+@@ -222,7 +216,6 @@ error:
+ 		if (out->async.as)
+ 			crypto_free_aead(out->async.as);
+ 	}
+-	kfree(out->async.result);
+ 
+ 	return ret;
+ }
+@@ -242,7 +235,6 @@ void cryptodev_cipher_deinit(struct cipher_data *cdata)
+ 				crypto_free_aead(cdata->async.as);
+ 		}
+ 
+-		kfree(cdata->async.result);
+ 		cdata->init = 0;
+ 	}
+ }
+@@ -279,7 +271,7 @@ ssize_t cryptodev_cipher_encrypt(struct cipher_data *cdata,
+ {
+ 	int ret;
+ 
+-	reinit_completion(&cdata->async.result->completion);
++	reinit_completion(&cdata->async.result.completion);
+ 
+ 	if (cdata->aead == 0) {
+ 		ablkcipher_request_set_crypt(cdata->async.request,
+@@ -293,7 +285,7 @@ ssize_t cryptodev_cipher_encrypt(struct cipher_data *cdata,
+ 		ret = crypto_aead_encrypt(cdata->async.arequest);
+ 	}
+ 
+-	return waitfor(cdata->async.result, ret);
++	return waitfor(&cdata->async.result, ret);
+ }
+ 
+ ssize_t cryptodev_cipher_decrypt(struct cipher_data *cdata,
+@@ -302,7 +294,7 @@ ssize_t cryptodev_cipher_decrypt(struct cipher_data *cdata,
+ {
+ 	int ret;
+ 
+-	reinit_completion(&cdata->async.result->completion);
++	reinit_completion(&cdata->async.result.completion);
+ 	if (cdata->aead == 0) {
+ 		ablkcipher_request_set_crypt(cdata->async.request,
+ 			(struct scatterlist *)src, dst,
+@@ -315,7 +307,7 @@ ssize_t cryptodev_cipher_decrypt(struct cipher_data *cdata,
+ 		ret = crypto_aead_decrypt(cdata->async.arequest);
+ 	}
+ 
+-	return waitfor(cdata->async.result, ret);
++	return waitfor(&cdata->async.result, ret);
+ }
+ 
+ /* Hash functions */
+@@ -345,13 +337,7 @@ int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name,
+ 	hdata->digestsize = crypto_ahash_digestsize(hdata->async.s);
+ 	hdata->alignmask = crypto_ahash_alignmask(hdata->async.s);
+ 
+-	hdata->async.result = kzalloc(sizeof(*hdata->async.result), GFP_KERNEL);
+-	if (unlikely(!hdata->async.result)) {
+-		ret = -ENOMEM;
+-		goto error;
+-	}
+-
+-	init_completion(&hdata->async.result->completion);
++	init_completion(&hdata->async.result.completion);
+ 
+ 	hdata->async.request = ahash_request_alloc(hdata->async.s, GFP_KERNEL);
+ 	if (unlikely(!hdata->async.request)) {
+@@ -361,12 +347,11 @@ int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name,
+ 	}
+ 
+ 	ahash_request_set_callback(hdata->async.request, 0,
+-				   cryptodev_complete, hdata->async.result);
++				   cryptodev_complete, &hdata->async.result);
+ 	hdata->init = 1;
+ 	return 0;
+ 
+ error:
+-	kfree(hdata->async.result);
+ 	crypto_free_ahash(hdata->async.s);
+ 	return ret;
+ }
+@@ -376,7 +361,6 @@ void cryptodev_hash_deinit(struct hash_data *hdata)
+ 	if (hdata->init) {
+ 		if (hdata->async.request)
+ 			ahash_request_free(hdata->async.request);
+-		kfree(hdata->async.result);
+ 		if (hdata->async.s)
+ 			crypto_free_ahash(hdata->async.s);
+ 		hdata->init = 0;
+@@ -402,24 +386,24 @@ ssize_t cryptodev_hash_update(struct hash_data *hdata,
+ {
+ 	int ret;
+ 
+-	reinit_completion(&hdata->async.result->completion);
++	reinit_completion(&hdata->async.result.completion);
+ 	ahash_request_set_crypt(hdata->async.request, sg, NULL, len);
+ 
+ 	ret = crypto_ahash_update(hdata->async.request);
+ 
+-	return waitfor(hdata->async.result, ret);
++	return waitfor(&hdata->async.result, ret);
+ }
+ 
+ int cryptodev_hash_final(struct hash_data *hdata, void *output)
+ {
+ 	int ret;
+ 
+-	reinit_completion(&hdata->async.result->completion);
++	reinit_completion(&hdata->async.result.completion);
+ 	ahash_request_set_crypt(hdata->async.request, NULL, output, 0);
+ 
+ 	ret = crypto_ahash_final(hdata->async.request);
+ 
+-	return waitfor(hdata->async.result, ret);
++	return waitfor(&hdata->async.result, ret);
+ }
+ 
+ int cryptodev_pkc_offload(struct cryptodev_pkc *pkc)
+diff --git a/cryptlib.h b/cryptlib.h
+index e1c4e3e..d8e8046 100644
+--- a/cryptlib.h
++++ b/cryptlib.h
+@@ -6,6 +6,11 @@
+ 
+ #include <linux/version.h>
+ 
++struct cryptodev_result {
++	struct completion completion;
++	int err;
++};
++
+ struct cipher_data {
+ 	int init; /* 0 uninitialized */
+ 	int blocksize;
+@@ -22,7 +27,7 @@ struct cipher_data {
+ 		struct crypto_aead *as;
+ 		struct aead_request *arequest;
+ 
+-		struct cryptodev_result *result;
++		struct cryptodev_result result;
+ 		uint8_t iv[EALG_MAX_BLOCK_LEN];
+ 	} async;
+ };
+@@ -85,7 +90,7 @@ struct hash_data {
+ 	int alignmask;
+ 	struct {
+ 		struct crypto_ahash *s;
+-		struct cryptodev_result *result;
++		struct cryptodev_result result;
+ 		struct ahash_request *request;
+ 	} async;
+ };
+@@ -104,11 +109,6 @@ enum offload_type {
+ 	ASYNCHRONOUS
+ };
+ 
+-struct cryptodev_result {
+-	struct completion completion;
+-	int err;
+-};
+-
+ struct cryptodev_pkc {
+ 	struct list_head list; /* To maintain the Jobs in completed
+ 				 cryptodev lists */
+-- 
+2.7.0
+
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 @@
+From 774c6bd169b683ed54ebad164d0ff541e1381a64 Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at nxp.com>
+Date: Tue, 12 Jan 2016 17:09:33 +0200
+Subject: [PATCH 33/38] avoid unnecessary checks for hash clean-up
+
+hdata->init is set only after all necessary allocations succeed. On
+clean-up is no longer necessary to make the allocation checks.
+
+Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
+---
+ cryptlib.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/cryptlib.c b/cryptlib.c
+index 5972fc2..5d1a5a9 100644
+--- a/cryptlib.c
++++ b/cryptlib.c
+@@ -359,10 +359,8 @@ error:
+ void cryptodev_hash_deinit(struct hash_data *hdata)
+ {
+ 	if (hdata->init) {
+-		if (hdata->async.request)
+-			ahash_request_free(hdata->async.request);
+-		if (hdata->async.s)
+-			crypto_free_ahash(hdata->async.s);
++		ahash_request_free(hdata->async.request);
++		crypto_free_ahash(hdata->async.s);
+ 		hdata->init = 0;
+ 	}
+ }
+-- 
+2.7.0
+
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 @@
+From c43fa74b9ed11f0183d25b21486b71fe02d84de7 Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at nxp.com>
+Date: Tue, 15 Dec 2015 15:31:47 +0200
+Subject: [PATCH 34/38] extend API with CIOCHASH to support direct hash
+ operations
+
+Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
+---
+ crypto/cryptodev.h | 16 ++++++++++++++++
+ ioctl.c            | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 65 insertions(+)
+
+diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h
+index f6058ca..c6083f7 100644
+--- a/crypto/cryptodev.h
++++ b/crypto/cryptodev.h
+@@ -167,6 +167,19 @@ struct crypt_auth_op {
+ 	__u32   iv_len;
+ };
+ 
++/* data container for CIOCHASH operations */
++struct hash_op_data {
++	__u32	ses;		/* session identifier */
++	__u32	mac_op;		/* cryptodev_crypto_op_t */
++	__u8	*mackey;
++	__u32	mackeylen;
++
++	__u16	flags;		/* see COP_FLAG_* */
++	__u32	len;		/* length of source data */
++	__u8	*src;		/* source data */
++	__u8	*mac_result;
++};
++
+ /* In plain AEAD mode the following are required:
+  *  flags   : 0
+  *  iv      : the initialization vector (12 bytes)
+@@ -325,4 +338,7 @@ enum cryptodev_crk_op_t {
+ /* additional ioctls for asynchronous  operation for asymmetric ciphers*/
+ #define CIOCASYMASYNCRYPT    _IOW('c', 112, struct crypt_kop)
+ #define CIOCASYMFETCHCOOKIE    _IOR('c', 113, struct pkc_cookie_list_s)
++
++#define CIOCHASH	_IOWR('c', 114, struct hash_op_data)
++
+ #endif /* L_CRYPTODEV_H */
+diff --git a/ioctl.c b/ioctl.c
+index 7adde75..3763954 100644
+--- a/ioctl.c
++++ b/ioctl.c
+@@ -960,6 +960,7 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
+ 	void __user *arg = (void __user *)arg_;
+ 	int __user *p = arg;
+ 	struct session_op sop;
++	struct hash_op_data hash_op;
+ 	struct kernel_crypt_op kcop;
+ 	struct kernel_crypt_auth_op kcaop;
+ 	struct crypt_priv *pcr = filp->private_data;
+@@ -1049,6 +1050,54 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
+ 		}
+ 
+ 		return kcop_to_user(&kcop, fcr, arg);
++	case CIOCHASH:
++		/* get session */
++		if (unlikely(copy_from_user(&hash_op, arg, sizeof(struct hash_op_data)))) {
++			pr_err("copy from user fault\n");
++			return -EFAULT;
++		}
++
++		sop.cipher = 0;
++		sop.mac = hash_op.mac_op;
++		sop.mackey = hash_op.mackey;
++		sop.mackeylen = hash_op.mackeylen;
++
++		/* writes sop.ses as a side-effect */
++		ret = crypto_create_session(fcr, &sop);
++		if (unlikely(ret)) {
++			pr_err("can't get session\n");
++			return ret;
++		}
++
++		/* do hashing */
++		kcop.cop.ses = sop.ses;
++		kcop.cop.flags = hash_op.flags;
++		kcop.cop.len = hash_op.len;
++		kcop.cop.src = hash_op.src;
++		kcop.cop.mac = hash_op.mac_result;
++		kcop.cop.dst = 0;
++		kcop.cop.op = 0;
++		kcop.cop.iv = 0;
++		kcop.ivlen = 0;
++		kcop.digestsize = 0; /* will be updated during operation */
++		kcop.task = current;
++		kcop.mm = current->mm;
++
++		ret = crypto_run(fcr, &kcop);
++		if (unlikely(ret)) {
++			dwarning(1, "Error in hash run");
++			return ret;
++		}
++
++		ret = copy_to_user(kcop.cop.mac, kcop.hash_output, kcop.digestsize);
++		if (unlikely(ret)) {
++			dwarning(1, "Error in copy to user");
++			return ret;
++		}
++
++		/* put session */
++		ret = crypto_finish_session(fcr, sop.ses);
++		return 0;
+ 	case CIOCAUTHCRYPT:
+ 		if (unlikely(ret = kcaop_from_user(&kcaop, fcr, arg))) {
+ 			dwarning(1, "Error copying from user");
+-- 
+2.7.0
+
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 @@
+From f123f38532ae022e818312a9bc04cdb287e9623f Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at nxp.com>
+Date: Thu, 17 Dec 2015 10:34:20 +0200
+Subject: [PATCH 35/38] use directly crypto API 'digest' operation for CIOCHASH
+
+Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
+---
+ crypto/cryptodev.h |   2 +-
+ cryptodev_int.h    |  10 ++++
+ ioctl.c            | 158 ++++++++++++++++++++++++++++++++++++++++++++---------
+ main.c             |  39 ++++++++++++-
+ 4 files changed, 179 insertions(+), 30 deletions(-)
+
+diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h
+index c6083f7..9ade102 100644
+--- a/crypto/cryptodev.h
++++ b/crypto/cryptodev.h
+@@ -169,7 +169,7 @@ struct crypt_auth_op {
+ 
+ /* data container for CIOCHASH operations */
+ struct hash_op_data {
+-	__u32	ses;		/* session identifier */
++	struct csession	*ses;	/* session identifier */
+ 	__u32	mac_op;		/* cryptodev_crypto_op_t */
+ 	__u8	*mackey;
+ 	__u32	mackeylen;
+diff --git a/cryptodev_int.h b/cryptodev_int.h
+index cb005d7..74c295a 100644
+--- a/cryptodev_int.h
++++ b/cryptodev_int.h
+@@ -164,6 +164,15 @@ struct kernel_crypt_op {
+ 	struct mm_struct *mm;
+ };
+ 
++struct kernel_hash_op {
++	struct hash_op_data hash_op;
++
++	int digestsize;
++	uint8_t hash_output[AALG_MAX_RESULT_LEN];
++	struct task_struct *task;
++	struct mm_struct *mm;
++};
++
+ struct kernel_crypt_auth_op {
+ 	struct crypt_auth_op caop;
+ 
+@@ -192,6 +201,7 @@ int kcaop_to_user(struct kernel_crypt_auth_op *kcaop,
+ 		struct fcrypt *fcr, void __user *arg);
+ int crypto_auth_run(struct fcrypt *fcr, struct kernel_crypt_auth_op *kcaop);
+ int crypto_run(struct fcrypt *fcr, struct kernel_crypt_op *kcop);
++int hash_run(struct kernel_hash_op *khop);
+ 
+ #include <cryptlib.h>
+ 
+diff --git a/ioctl.c b/ioctl.c
+index 3763954..a052614 100644
+--- a/ioctl.c
++++ b/ioctl.c
+@@ -397,7 +397,128 @@ session_error:
+ 	return ret;
+ }
+ 
+-/* Everything that needs to be done when removing a session. */
++static inline void hash_destroy_session(struct csession *ses_ptr)
++{
++	cryptodev_hash_deinit(&ses_ptr->hdata);
++	kfree(ses_ptr->pages);
++	kfree(ses_ptr->sg);
++	kfree(ses_ptr);
++}
++
++static int hash_create_session(struct hash_op_data *hash_op)
++{
++	struct csession	*ses;
++	int ret = 0;
++	const char *hash_name;
++	int hmac_mode = 1;
++	uint8_t mkey[CRYPTO_HMAC_MAX_KEY_LEN];
++
++	switch (hash_op->mac_op) {
++	case CRYPTO_MD5_HMAC:
++		hash_name = "hmac(md5)";
++		break;
++	case CRYPTO_RIPEMD160_HMAC:
++		hash_name = "hmac(rmd160)";
++		break;
++	case CRYPTO_SHA1_HMAC:
++		hash_name = "hmac(sha1)";
++		break;
++	case CRYPTO_SHA2_224_HMAC:
++		hash_name = "hmac(sha224)";
++		break;
++	case CRYPTO_SHA2_256_HMAC:
++		hash_name = "hmac(sha256)";
++		break;
++	case CRYPTO_SHA2_384_HMAC:
++		hash_name = "hmac(sha384)";
++		break;
++	case CRYPTO_SHA2_512_HMAC:
++		hash_name = "hmac(sha512)";
++		break;
++	/* non-hmac cases */
++	case CRYPTO_MD5:
++		hash_name = "md5";
++		hmac_mode = 0;
++		break;
++	case CRYPTO_RIPEMD160:
++		hash_name = "rmd160";
++		hmac_mode = 0;
++		break;
++	case CRYPTO_SHA1:
++		hash_name = "sha1";
++		hmac_mode = 0;
++		break;
++	case CRYPTO_SHA2_224:
++		hash_name = "sha224";
++		hmac_mode = 0;
++		break;
++	case CRYPTO_SHA2_256:
++		hash_name = "sha256";
++		hmac_mode = 0;
++		break;
++	case CRYPTO_SHA2_384:
++		hash_name = "sha384";
++		hmac_mode = 0;
++		break;
++	case CRYPTO_SHA2_512:
++		hash_name = "sha512";
++		hmac_mode = 0;
++		break;
++	default:
++		ddebug(1, "bad mac: %d", hash_op->mac_op);
++		return -EINVAL;
++	}
++
++	ses = kzalloc(sizeof(*ses), GFP_KERNEL);
++	if (!ses) {
++		return -ENOMEM;
++	}
++
++	if (unlikely(hash_op->mackeylen > CRYPTO_HMAC_MAX_KEY_LEN)) {
++		ddebug(1, "Setting key failed for %s-%zu.", hash_name,
++		       (size_t)hash_op->mackeylen * 8);
++		ret = -EINVAL;
++		goto error_hash;
++	}
++
++	if (hash_op->mackey &&
++	    unlikely(copy_from_user(mkey, hash_op->mackey, hash_op->mackeylen))) {
++		ret = -EFAULT;
++		goto error_hash;
++	}
++
++	ret = cryptodev_hash_init(&ses->hdata, hash_name, hmac_mode,
++			mkey, hash_op->mackeylen);
++	if (ret != 0) {
++		ddebug(1, "Failed to load hash for %s", hash_name);
++		ret = -EINVAL;
++		goto error_hash;
++	}
++
++	ses->alignmask = ses->hdata.alignmask;
++	ddebug(2, "got alignmask %d", ses->alignmask);
++
++	ses->array_size = DEFAULT_PREALLOC_PAGES;
++	ddebug(2, "preallocating for %d user pages", ses->array_size);
++
++	ses->pages = kzalloc(ses->array_size * sizeof(struct page *), GFP_KERNEL);
++	ses->sg = kzalloc(ses->array_size * sizeof(struct scatterlist), GFP_KERNEL);
++	if (ses->sg == NULL || ses->pages == NULL) {
++		ddebug(0, "Memory error");
++		ret = -ENOMEM;
++		goto error_hash;
++	}
++
++	hash_op->ses = ses;
++	return 0;
++
++error_hash:
++	hash_destroy_session(ses);
++	return ret;
++}
++
++
++/* Everything that needs to be done when remowing a session. */
+ static inline void
+ crypto_destroy_session(struct csession *ses_ptr)
+ {
+@@ -960,7 +1081,7 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
+ 	void __user *arg = (void __user *)arg_;
+ 	int __user *p = arg;
+ 	struct session_op sop;
+-	struct hash_op_data hash_op;
++	struct kernel_hash_op khop;
+ 	struct kernel_crypt_op kcop;
+ 	struct kernel_crypt_auth_op kcaop;
+ 	struct crypt_priv *pcr = filp->private_data;
+@@ -1051,52 +1172,35 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
+ 
+ 		return kcop_to_user(&kcop, fcr, arg);
+ 	case CIOCHASH:
+-		/* get session */
+-		if (unlikely(copy_from_user(&hash_op, arg, sizeof(struct hash_op_data)))) {
++		if (unlikely(copy_from_user(&khop.hash_op, arg, sizeof(struct hash_op_data)))) {
+ 			pr_err("copy from user fault\n");
+ 			return -EFAULT;
+ 		}
++		khop.task = current;
++		khop.mm = current->mm;
+ 
+-		sop.cipher = 0;
+-		sop.mac = hash_op.mac_op;
+-		sop.mackey = hash_op.mackey;
+-		sop.mackeylen = hash_op.mackeylen;
+-
+-		/* writes sop.ses as a side-effect */
+-		ret = crypto_create_session(fcr, &sop);
++		/* get session */
++		ret = hash_create_session(&khop.hash_op);
+ 		if (unlikely(ret)) {
+ 			pr_err("can't get session\n");
+ 			return ret;
+ 		}
+ 
+ 		/* do hashing */
+-		kcop.cop.ses = sop.ses;
+-		kcop.cop.flags = hash_op.flags;
+-		kcop.cop.len = hash_op.len;
+-		kcop.cop.src = hash_op.src;
+-		kcop.cop.mac = hash_op.mac_result;
+-		kcop.cop.dst = 0;
+-		kcop.cop.op = 0;
+-		kcop.cop.iv = 0;
+-		kcop.ivlen = 0;
+-		kcop.digestsize = 0; /* will be updated during operation */
+-		kcop.task = current;
+-		kcop.mm = current->mm;
+-
+-		ret = crypto_run(fcr, &kcop);
++		ret = hash_run(&khop);
+ 		if (unlikely(ret)) {
+ 			dwarning(1, "Error in hash run");
+ 			return ret;
+ 		}
+ 
+-		ret = copy_to_user(kcop.cop.mac, kcop.hash_output, kcop.digestsize);
++		ret = copy_to_user(khop.hash_op.mac_result, khop.hash_output, khop.digestsize);
+ 		if (unlikely(ret)) {
+ 			dwarning(1, "Error in copy to user");
+ 			return ret;
+ 		}
+ 
+ 		/* put session */
+-		ret = crypto_finish_session(fcr, sop.ses);
++		hash_destroy_session(khop.hash_op.ses);
+ 		return 0;
+ 	case CIOCAUTHCRYPT:
+ 		if (unlikely(ret = kcaop_from_user(&kcaop, fcr, arg))) {
+diff --git a/main.c b/main.c
+index ec11129..095aea5 100644
+--- a/main.c
++++ b/main.c
+@@ -159,8 +159,6 @@ __crypto_run_std(struct csession *ses_ptr, struct crypt_op *cop)
+ 	return ret;
+ }
+ 
+-
+-
+ /* This is the main crypto function - zero-copy edition */
+ static int
+ __crypto_run_zc(struct csession *ses_ptr, struct kernel_crypt_op *kcop)
+@@ -841,3 +839,40 @@ out_unlock:
+ 	crypto_put_session(ses_ptr);
+ 	return ret;
+ }
++
++int hash_run(struct kernel_hash_op *khop)
++{
++	struct hash_op_data *hash_op = &khop->hash_op;
++	struct csession *ses_ptr = hash_op->ses;
++	struct hash_data *hdata = &ses_ptr->hdata;
++	int ret;
++	struct scatterlist *src_sg;
++	struct scatterlist *dst_sg; /* required by get_userbuf but not used */
++
++	if (hash_op->len == 0) {
++		src_sg = NULL;
++	} else {
++		ret = get_userbuf(ses_ptr, hash_op->src, hash_op->len, NULL, 0,
++				khop->task, khop->mm, &src_sg, &dst_sg);
++		if (unlikely(ret)) {
++			derr(1, "Error getting user pages");
++			return ret;
++		}
++	}
++
++	ahash_request_set_crypt(hdata->async.request, src_sg, khop->hash_output, hash_op->len);
++
++	ret = crypto_ahash_digest(hdata->async.request);
++	if (ret == -EINPROGRESS || ret == -EBUSY) {
++		wait_for_completion(&hdata->async.result.completion);
++		ret = hdata->async.result.err;
++		if (ret != 0) {
++			derr(0, "CryptoAPI failure: %d", ret);
++		}
++	}
++
++	khop->digestsize = ses_ptr->hdata.digestsize;
++
++	release_user_pages(ses_ptr);
++	return ret;
++}
+-- 
+2.7.0
+
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 @@
+From 711529cc7b8743ae8c9c0db4980ac15f7acb8618 Mon Sep 17 00:00:00 2001
+From: Alex Porosanu <alexandru.porosanu at nxp.com>
+Date: Tue, 12 Jan 2016 14:51:00 +0200
+Subject: [PATCH 36/38] add compat for CIOCHASH operation
+
+This patch adds the necessary ioctl for using the CIOCHASH
+operation for different userspace & kernel (i.e. 32b userspace
+and 64b kernel).
+
+Signed-off-by: Alex Porosanu <alexandru.porosanu at nxp.com>
+---
+ cryptodev_int.h | 14 +++++++++++++-
+ ioctl.c         | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 63 insertions(+), 1 deletion(-)
+
+diff --git a/cryptodev_int.h b/cryptodev_int.h
+index 74c295a..6dcfd69 100644
+--- a/cryptodev_int.h
++++ b/cryptodev_int.h
+@@ -129,6 +129,18 @@ struct compat_crypt_auth_op {
+ 	uint32_t	iv_len;
+ };
+ 
++struct compat_hash_op_data {
++	compat_uptr_t	ses;
++	uint32_t	mac_op;		/* cryptodev_crypto_op_t */
++	compat_uptr_t	mackey;
++	uint32_t	mackeylen;
++
++	uint16_t	flags;		/* see COP_FLAG_* */
++	uint32_t	len;		/* length of source data */
++	compat_uptr_t	src;		/* source data */
++	compat_uptr_t	mac_result;
++};
++
+ /* compat ioctls, defined for the above structs */
+ #define COMPAT_CIOCGSESSION    _IOWR('c', 102, struct compat_session_op)
+ #define COMPAT_CIOCCRYPT       _IOWR('c', 104, struct compat_crypt_op)
+@@ -139,7 +151,7 @@ struct compat_crypt_auth_op {
+ #define COMPAT_CIOCASYMASYNCRYPT    _IOW('c', 110, struct compat_crypt_kop)
+ #define COMPAT_CIOCASYMFETCHCOOKIE    _IOR('c', 111, \
+ 				struct compat_pkc_cookie_list_s)
+-
++#define COMPAT_CIOCHASH	_IOWR('c', 114, struct compat_hash_op_data)
+ #endif /* CONFIG_COMPAT */
+ 
+ /* kernel-internal extension to struct crypt_kop */
+diff --git a/ioctl.c b/ioctl.c
+index a052614..ff3de44 100644
+--- a/ioctl.c
++++ b/ioctl.c
+@@ -1435,8 +1435,11 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_)
+ 	struct fcrypt *fcr;
+ 	struct session_op sop;
+ 	struct compat_session_op compat_sop;
++	struct kernel_hash_op khop;
+ 	struct kernel_crypt_op kcop;
+ 	struct kernel_crypt_auth_op kcaop;
++	struct compat_hash_op_data compat_hash_op_data;
++
+ 	int ret;
+ 
+ 	if (unlikely(!pcr))
+@@ -1499,6 +1502,53 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_)
+ 
+ 		return compat_kcop_to_user(&kcop, fcr, arg);
+ 
++	case COMPAT_CIOCHASH:
++		/* get session */
++		if (unlikely(copy_from_user(&compat_hash_op_data, arg,
++					sizeof(struct compat_hash_op_data)))) {
++			pr_err("copy from user fault\n");
++			return -EFAULT;
++		}
++
++		khop.task = current;
++		khop.mm = current->mm;
++
++		khop.hash_op.mac_op = compat_hash_op_data.mac_op;
++		khop.hash_op.mackey = compat_ptr(compat_hash_op_data.mackey);
++		khop.hash_op.mackeylen = compat_hash_op_data.mackeylen;
++		khop.hash_op.flags = compat_hash_op_data.flags;
++		khop.hash_op.len = compat_hash_op_data.len;
++		khop.hash_op.src = compat_ptr(compat_hash_op_data.src);
++		khop.hash_op.mac_result =
++				compat_ptr(compat_hash_op_data.mac_result);
++
++		ret = hash_create_session(&khop.hash_op);
++		if (unlikely(ret)) {
++			pr_err("can't get session\n");
++			return ret;
++		}
++
++		/* do hashing */
++		ret = hash_run(&khop);
++		if (unlikely(ret)) {
++			dwarning(1, "Error in hash run");
++			return ret;
++		}
++
++		ret = copy_to_user(khop.hash_op.mac_result, khop.hash_output,
++				   khop.digestsize);
++		if (unlikely(ret)) {
++			dwarning(1, "Error in copy to user");
++			return ret;
++		}
++
++		copy_to_user(arg, &compat_hash_op_data,
++			     sizeof(struct compat_hash_op_data));
++
++		/* put session */
++		hash_destroy_session(khop.hash_op.ses);
++		return 0;
++
+ 	case COMPAT_CIOCAUTHCRYPT:
+ 		if (unlikely(ret = compat_kcaop_from_user(&kcaop, fcr, arg))) {
+ 			dprintk(1, KERN_WARNING, "Error copying from user\n");
+-- 
+2.7.0
+
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 @@
+From 344a0243e31f8fc467253404a548eedbb72b35d0 Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at nxp.com>
+Date: Wed, 20 Jan 2016 17:11:49 +0200
+Subject: [PATCH 37/38] rewrite sha_speed.c to reduce code duplication
+
+Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
+---
+ tests/sha_speed.c | 131 ++++++++++++++++++++++++++++++++++--------------------
+ 1 file changed, 84 insertions(+), 47 deletions(-)
+
+diff --git a/tests/sha_speed.c b/tests/sha_speed.c
+index e1dc54b..5f694bd 100644
+--- a/tests/sha_speed.c
++++ b/tests/sha_speed.c
+@@ -28,6 +28,13 @@
+ 
+ #include <crypto/cryptodev.h>
+ 
++/* Sizes of buffers to be hashed */
++int buffer_lengths[] = {256, 512, 1024, 2048, 4096, 8192, 65536, 0};
++
++/* Time in seconds allocated for each tested buffer lengths */
++#define BUFFER_TEST_TIME 10
++
++
+ static double udifftimeval(struct timeval start, struct timeval end)
+ {
+ 	return (double)(end.tv_usec - start.tv_usec) +
+@@ -97,7 +104,7 @@ int hash_data(struct session_op *sess, int fdc, int chunksize, int alignmask)
+ 	memset(buffer, val++, chunksize);
+ 
+ 	must_finish = 0;
+-	alarm(5);
++	alarm(BUFFER_TEST_TIME);
+ 
+ 	gettimeofday(&start, NULL);
+ 	do {
+@@ -126,73 +133,103 @@ int hash_data(struct session_op *sess, int fdc, int chunksize, int alignmask)
+ 	return 0;
+ }
+ 
+-int main(void)
+-{
+-	int fd, i, fdc = -1, alignmask = 0;
+-	struct session_op sess;
+-	char keybuf[32];
++
+ #ifdef CIOCGSESSINFO
++int get_alignmask(struct session_op *sess, int fdc)
++{
+ 	struct session_info_op siop;
++
++	siop.ses = sess->ses;
++	if (ioctl(fdc, CIOCGSESSINFO, &siop) < 0) {
++		perror("ioctl(CIOCGSESSINFO)");
++		/* continue test ignoring CIOCGSESSINFO error */
++		return 0;
++	}
++
++	printf("using algorithm %s with driver %s\n",
++		siop.hash_info.cra_name, siop.hash_info.cra_driver_name);
++
++	return siop.alignmask;
++}
+ #endif
+ 
+-	signal(SIGALRM, alarm_handler);
+ 
+-	if ((fd = open("/dev/crypto", O_RDWR, 0)) < 0) {
+-		perror("open()");
+-		return 1;
+-	}
+-	if (ioctl(fd, CRIOGET, &fdc)) {
+-		perror("ioctl(CRIOGET)");
+-		return 1;
+-	}
++int hash_session(struct session_op *sess, int fdc)
++{
++	int i;
++	int err;
++	int alignmask;
+ 
+-	fprintf(stderr, "Testing SHA1 Hash: \n");
+-	memset(&sess, 0, sizeof(sess));
+-	sess.mac = CRYPTO_SHA1;
+-	if (ioctl(fdc, CIOCGSESSION, &sess)) {
++	if (ioctl(fdc, CIOCGSESSION, sess)) {
+ 		perror("ioctl(CIOCGSESSION)");
+ 		return 1;
+ 	}
++
+ #ifdef CIOCGSESSINFO
+-	siop.ses = sess.ses;
+-	if (ioctl(fdc, CIOCGSESSINFO, &siop)) {
+-		perror("ioctl(CIOCGSESSINFO)");
+-		return 1;
+-	}
+-	printf("requested hash CRYPTO_SHA1, got %s with driver %s\n",
+-			siop.hash_info.cra_name, siop.hash_info.cra_driver_name);
+-	alignmask = siop.alignmask;
++	alignmask = get_alignmask(sess, fdc);
++#else
++	alignmask = 0;
+ #endif
+ 
+-	for (i = 256; i <= (64 * 1024); i *= 4) {
+-		if (hash_data(&sess, fdc, i, alignmask))
+-			break;
++	err = 0;
++	for(i = 0; (err == 0) && (buffer_lengths[i] != 0); i++) {
++		err = hash_data(sess, fdc, buffer_lengths[i], alignmask);
+ 	}
+ 
+-	fprintf(stderr, "\nTesting SHA256 Hash: \n");
+-	memset(&sess, 0, sizeof(sess));
+-	sess.mac = CRYPTO_SHA2_256;
+-	if (ioctl(fdc, CIOCGSESSION, &sess)) {
+-		perror("ioctl(CIOCGSESSION)");
++	if (ioctl(fdc, CIOCFSESSION, sess)) {
++		perror("ioctl(CIOCFSESSION)");
+ 		return 1;
+ 	}
+-#ifdef CIOCGSESSINFO
+-	siop.ses = sess.ses;
+-	if (ioctl(fdc, CIOCGSESSINFO, &siop)) {
+-		perror("ioctl(CIOCGSESSINFO)");
++
++	return err;
++}
++
++int test_sha1(struct session_op *sess, int fdc)
++{
++	fprintf(stderr, "Testing SHA1 Hash: \n");
++	memset(sess, 0, sizeof(sess));
++	sess->mac = CRYPTO_SHA1;
++	return hash_session(sess, fdc);
++}
++
++
++int test_sha256(struct session_op *sess, int fdc)
++{
++	fprintf(stderr, "Testing SHA256 Hash: \n");
++	memset(sess, 0, sizeof(sess));
++	sess->mac = CRYPTO_SHA2_256;
++	return hash_session(sess, fdc);
++}
++
++
++int main(void)
++{
++	int fd;
++	int fdc;
++	int err;
++	int i;
++	struct session_op sess;
++
++	signal(SIGALRM, alarm_handler);
++
++	fd = open("/dev/crypto", O_RDWR, 0);
++	if (fd < 0) {
++		perror("open()");
+ 		return 1;
+ 	}
+-	printf("requested hash CRYPTO_SHA2_256, got %s with driver %s\n",
+-			siop.hash_info.cra_name, siop.hash_info.cra_driver_name);
+-	alignmask = siop.alignmask;
+-#endif
+ 
+-	for (i = 256; i <= (64 * 1024); i *= 4) {
+-		if (hash_data(&sess, fdc, i, alignmask))
+-			break;
++	err = ioctl(fd, CRIOGET, &fdc);
++	if (err != 0) {
++		perror("ioctl(CRIOGET)");
++		close(fd);
++		return 1;
+ 	}
+ 
++	/* run all tests but return an eventual error */
++	err |= test_sha1(&sess, fdc);
++	err |= test_sha256(&sess, fdc);
++
+ 	close(fdc);
+ 	close(fd);
+-	return 0;
++	return err;
+ }
+-- 
+2.7.0
+
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 @@
+From 65704ea24e80647e8c5f938300f51cb70af50c1c Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at nxp.com>
+Date: Thu, 21 Jan 2016 17:30:59 +0200
+Subject: [PATCH 38/38] extend sha_speed.c to test CIOCHASH
+
+Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
+---
+ tests/sha_speed.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 90 insertions(+)
+
+diff --git a/tests/sha_speed.c b/tests/sha_speed.c
+index 5f694bd..d731c66 100644
+--- a/tests/sha_speed.c
++++ b/tests/sha_speed.c
+@@ -133,6 +133,62 @@ int hash_data(struct session_op *sess, int fdc, int chunksize, int alignmask)
+ 	return 0;
+ }
+ 
++int digest_data(struct session_op *sess, int fdc, int chunksize, int alignmask)
++{
++	struct hash_op_data hash_op;
++	char *buffer;
++	static int val = 23;
++	struct timeval start, end;
++	double total = 0;
++	double secs, ddata, dspeed;
++	char metric[16];
++	uint8_t mac[AALG_MAX_RESULT_LEN];
++
++	if (alignmask) {
++		if (posix_memalign((void **)&buffer, alignmask + 1, chunksize)) {
++			printf("posix_memalign() failed!\n");
++			return 1;
++		}
++	} else {
++		if (!(buffer = malloc(chunksize))) {
++			perror("malloc()");
++			return 1;
++		}
++	}
++
++	printf("\tEncrypting in chunks of %d bytes: ", chunksize);
++	fflush(stdout);
++
++	memset(buffer, val++, chunksize);
++
++	must_finish = 0;
++	alarm(BUFFER_TEST_TIME);
++
++	gettimeofday(&start, NULL);
++	do {
++		memset(&hash_op, 0, sizeof(hash_op));
++		hash_op.mac_op = sess->mac;
++		hash_op.len = chunksize;
++		hash_op.src = (unsigned char *)buffer;
++		hash_op.mac_result = mac;
++
++		if (ioctl(fdc, CIOCHASH, hash_op) != 0) {
++			perror("ioctl(CIOCHASH)");
++			return 1;
++		}
++		total += chunksize;
++	} while(must_finish == 0);
++	gettimeofday(&end, NULL);
++
++	secs = udifftimeval(start, end)/ 1000000.0;
++
++	value2human(1, total, secs, &ddata, &dspeed, metric);
++	printf ("done. %.2f %s in %.2f secs: ", ddata, metric, secs);
++	printf ("%.2f %s/sec\n", dspeed, metric);
++
++	free(buffer);
++	return 0;
++}
+ 
+ #ifdef CIOCGSESSINFO
+ int get_alignmask(struct session_op *sess, int fdc)
+@@ -154,6 +210,20 @@ int get_alignmask(struct session_op *sess, int fdc)
+ #endif
+ 
+ 
++int ciochash_session(struct session_op *sess, int fdc)
++{
++	int i;
++	int err = 0;
++
++	err = 0;
++	for(i = 0; (err == 0) && (buffer_lengths[i] != 0); i++) {
++		err = digest_data(sess, fdc, buffer_lengths[i], 0);
++	}
++
++	return err;
++}
++
++
+ int hash_session(struct session_op *sess, int fdc)
+ {
+ 	int i;
+@@ -193,6 +263,15 @@ int test_sha1(struct session_op *sess, int fdc)
+ }
+ 
+ 
++int test_sha1_ciochash(struct session_op *sess, int fdc)
++{
++	fprintf(stderr, "Testing SHA1 CIOCHASH: \n");
++	memset(sess, 0, sizeof(sess));
++	sess->mac = CRYPTO_SHA1;
++	return ciochash_session(sess, fdc);
++}
++
++
+ int test_sha256(struct session_op *sess, int fdc)
+ {
+ 	fprintf(stderr, "Testing SHA256 Hash: \n");
+@@ -202,6 +281,15 @@ int test_sha256(struct session_op *sess, int fdc)
+ }
+ 
+ 
++int test_sha256_ciochash(struct session_op *sess, int fdc)
++{
++	fprintf(stderr, "Testing SHA256 CIOCHASH: \n");
++	memset(sess, 0, sizeof(sess));
++	sess->mac = CRYPTO_SHA2_256;
++	return ciochash_session(sess, fdc);
++}
++
++
+ int main(void)
+ {
+ 	int fd;
+@@ -227,7 +315,9 @@ int main(void)
+ 
+ 	/* run all tests but return an eventual error */
+ 	err |= test_sha1(&sess, fdc);
++	err |= test_sha1_ciochash(&sess, fdc);
+ 	err |= test_sha256(&sess, fdc);
++	err |= test_sha256_ciochash(&sess, fdc);
+ 
+ 	close(fdc);
+ 	close(fd);
+-- 
+2.7.0
+
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 @@
+From 3e3996b40fd3a93cbe2e5ddee244280dd7de6c18 Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at freescale.com>
+Date: Tue, 9 Feb 2016 21:07:06 +0200
+Subject: [PATCH 39/40] fix memory leaks on error path for CIOCHASH
+
+Signed-off-by: Cristian Stoica <cristian.stoica at freescale.com>
+---
+ ioctl.c | 20 +++++++++++---------
+ 1 file changed, 11 insertions(+), 9 deletions(-)
+
+diff --git a/ioctl.c b/ioctl.c
+index ff3de44..8d81b56 100644
+--- a/ioctl.c
++++ b/ioctl.c
+@@ -1190,18 +1190,17 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
+ 		ret = hash_run(&khop);
+ 		if (unlikely(ret)) {
+ 			dwarning(1, "Error in hash run");
+-			return ret;
++			goto hash_err;
+ 		}
+ 
+ 		ret = copy_to_user(khop.hash_op.mac_result, khop.hash_output, khop.digestsize);
+ 		if (unlikely(ret)) {
+ 			dwarning(1, "Error in copy to user");
+-			return ret;
+ 		}
+ 
+-		/* put session */
++	hash_err:
+ 		hash_destroy_session(khop.hash_op.ses);
+-		return 0;
++		return ret;
+ 	case CIOCAUTHCRYPT:
+ 		if (unlikely(ret = kcaop_from_user(&kcaop, fcr, arg))) {
+ 			dwarning(1, "Error copying from user");
+@@ -1532,22 +1531,25 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_)
+ 		ret = hash_run(&khop);
+ 		if (unlikely(ret)) {
+ 			dwarning(1, "Error in hash run");
+-			return ret;
++			goto hash_err;
+ 		}
+ 
+ 		ret = copy_to_user(khop.hash_op.mac_result, khop.hash_output,
+ 				   khop.digestsize);
+ 		if (unlikely(ret)) {
+ 			dwarning(1, "Error in copy to user");
+-			return ret;
++			goto hash_err;
+ 		}
+ 
+-		copy_to_user(arg, &compat_hash_op_data,
++		ret = copy_to_user(arg, &compat_hash_op_data,
+ 			     sizeof(struct compat_hash_op_data));
++		if (unlikely(ret)) {
++			dwarning(1, "Error in copy to user");
++		}
+ 
+-		/* put session */
++	hash_err:
+ 		hash_destroy_session(khop.hash_op.ses);
+-		return 0;
++		return ret;
+ 
+ 	case COMPAT_CIOCAUTHCRYPT:
+ 		if (unlikely(ret = compat_kcaop_from_user(&kcaop, fcr, arg))) {
+-- 
+2.7.0
+
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 @@
+From 3eb9ed52743584949ff9b4844e810333c34a3a1f Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at nxp.com>
+Date: Fri, 12 Feb 2016 11:23:41 +0200
+Subject: [PATCH 40/40] fix structure init in sha_speed test
+
+Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
+---
+ tests/sha_speed.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/tests/sha_speed.c b/tests/sha_speed.c
+index d731c66..75d0f42 100644
+--- a/tests/sha_speed.c
++++ b/tests/sha_speed.c
+@@ -257,7 +257,7 @@ int hash_session(struct session_op *sess, int fdc)
+ int test_sha1(struct session_op *sess, int fdc)
+ {
+ 	fprintf(stderr, "Testing SHA1 Hash: \n");
+-	memset(sess, 0, sizeof(sess));
++	memset(sess, 0, sizeof(struct session_op));
+ 	sess->mac = CRYPTO_SHA1;
+ 	return hash_session(sess, fdc);
+ }
+@@ -266,7 +266,7 @@ int test_sha1(struct session_op *sess, int fdc)
+ int test_sha1_ciochash(struct session_op *sess, int fdc)
+ {
+ 	fprintf(stderr, "Testing SHA1 CIOCHASH: \n");
+-	memset(sess, 0, sizeof(sess));
++	memset(sess, 0, sizeof(struct session_op));
+ 	sess->mac = CRYPTO_SHA1;
+ 	return ciochash_session(sess, fdc);
+ }
+@@ -275,7 +275,7 @@ int test_sha1_ciochash(struct session_op *sess, int fdc)
+ int test_sha256(struct session_op *sess, int fdc)
+ {
+ 	fprintf(stderr, "Testing SHA256 Hash: \n");
+-	memset(sess, 0, sizeof(sess));
++	memset(sess, 0, sizeof(struct session_op));
+ 	sess->mac = CRYPTO_SHA2_256;
+ 	return hash_session(sess, fdc);
+ }
+@@ -284,7 +284,7 @@ int test_sha256(struct session_op *sess, int fdc)
+ int test_sha256_ciochash(struct session_op *sess, int fdc)
+ {
+ 	fprintf(stderr, "Testing SHA256 CIOCHASH: \n");
+-	memset(sess, 0, sizeof(sess));
++	memset(sess, 0, sizeof(struct session_op));
+ 	sess->mac = CRYPTO_SHA2_256;
+ 	return ciochash_session(sess, fdc);
+ }
+-- 
+2.7.0
+
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 @@
+From 0d58530f5c5970db9787a23aef4227c68f941fcc Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at nxp.com>
+Date: Wed, 10 Feb 2016 16:22:05 +0200
+Subject: [PATCH 41/43] add separate target for building tests
+
+A separate target for build is useful with cross-compilation. In this
+case it makes sense to build the tests without running them on the host
+machine.
+
+The default target is now 'all' and only builds the tests
+
+Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
+---
+ tests/Makefile | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/tests/Makefile b/tests/Makefile
+index 3155da9..89f88fe 100644
+--- a/tests/Makefile
++++ b/tests/Makefile
+@@ -19,6 +19,8 @@ example-async-hmac-objs := async_hmac.o
+ example-async-speed-objs := async_speed.o
+ example-hashcrypt-speed-objs := hashcrypt_speed.c
+ 
++all: $(hostprogs)
++
+ check: $(hostprogs)
+ 	./cipher
+ 	./hmac
+@@ -33,3 +35,5 @@ clean:
+ 
+ ${comp_progs}: LDLIBS += -lssl -lcrypto
+ ${comp_progs}: %: %.o openssl_wrapper.o
++
++.PHONY: all clean check
+-- 
+2.7.0
+
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 @@
+From dcb8fe0fcf71feac2a4f57c44a5153bfc404b4c3 Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at nxp.com>
+Date: Thu, 11 Feb 2016 16:37:23 +0200
+Subject: [PATCH 42/43] fix destination for staged installs
+
+The standard variable for staged installations is DESTDIR and it should
+be set only by the user, outside of Makefile. This is consistent with
+recommendations from both GNU Make and FreeBSD porters-handbook.
+
+	make DESTDIR=/tmp/stage install
+
+$prefix and $PREFIX (in FreeBSD world) are used to specify where the
+files will be installed. It defaults to /usr/local but can be /usr or
+/opt or something else.
+
+Usually one wants to do a stage installation when cross-building or for
+other purposes. The convention is to use DESTDIR.
+Changing $prefix is useful for installers. They can override its value
+when calling make:
+
+	make prefix=/usr install
+
+Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
+---
+ Makefile | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 7f8df37..9871a8e 100644
+--- a/Makefile
++++ b/Makefile
+@@ -7,7 +7,9 @@ CRYPTODEV_CFLAGS ?= #-DENABLE_ASYNC
+ KBUILD_CFLAGS += -I$(src) $(CRYPTODEV_CFLAGS)
+ KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build
+ VERSION = 1.8
+-PREFIX ?=
++
++prefix ?= /usr/local
++includedir = $(prefix)/include
+ 
+ cryptodev-objs = ioctl.o main.o cryptlib.o authenc.o zc.o util.o
+ 
+@@ -31,8 +33,7 @@ install: modules_install
+ 
+ modules_install:
+ 	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules_install
+-	@echo "Installing cryptodev.h in $(PREFIX)/usr/include/crypto ..."
+-	@install -D crypto/cryptodev.h $(PREFIX)/usr/include/crypto/cryptodev.h
++	install -m 644 -D crypto/cryptodev.h $(DESTDIR)/$(includedir)/crypto/cryptodev.h
+ 
+ clean:
+ 	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) clean
+-- 
+2.7.0
+
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 @@
+From 44629033d47543d106299b6c8bed9e5c9fed1513 Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at nxp.com>
+Date: Thu, 11 Feb 2016 16:48:53 +0200
+Subject: [PATCH 43/43] add install target for tests
+
+Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
+---
+ tests/Makefile | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/tests/Makefile b/tests/Makefile
+index 89f88fe..5e3111d 100644
+--- a/tests/Makefile
++++ b/tests/Makefile
+@@ -19,6 +19,10 @@ example-async-hmac-objs := async_hmac.o
+ example-async-speed-objs := async_speed.o
+ example-hashcrypt-speed-objs := hashcrypt_speed.c
+ 
++prefix ?= /usr/local
++execprefix ?= $(prefix)
++bindir = $(execprefix)/bin
++
+ all: $(hostprogs)
+ 
+ check: $(hostprogs)
+@@ -30,10 +34,16 @@ check: $(hostprogs)
+ 	./cipher-gcm
+ 	./cipher-aead
+ 
++install:
++	install -d $(DESTDIR)/$(bindir)
++	for prog in $(hostprogs); do \
++		install -m 755 $$prog $(DESTDIR)/$(bindir); \
++	done
++
+ clean:
+ 	rm -f *.o *~ $(hostprogs)
+ 
+ ${comp_progs}: LDLIBS += -lssl -lcrypto
+ ${comp_progs}: %: %.o openssl_wrapper.o
+ 
+-.PHONY: all clean check
++.PHONY: all clean check install
+-- 
+2.7.0
+
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 @@
+From 03257bf2aff37b78496ccc1b58a87e7baaea042a Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at nxp.com>
+Date: Mon, 22 Feb 2016 12:17:52 +0200
+Subject: [PATCH 2/2] Add the compile and install rules for cryptodev tests
+
+(original patch Signed-off-by: Yu Zongchun <b40527 at freescale.com>)
+Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
+
+Upstream-Status: Inappropriate [ OE specific ]
+---
+ Makefile       | 6 ++++++
+ tests/Makefile | 4 ++--
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 06202bd..a598b12 100644
+--- a/Makefile
++++ b/Makefile
+@@ -42,6 +42,12 @@ clean:
+ check:
+ 	CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) $(MAKE) -C tests check
+ 
++testprogs:
++	KERNEL_DIR=$(KERNEL_DIR) $(MAKE) -C tests all
++
++install_tests:
++	$(MAKE) -C tests install
++
+ CPOPTS =
+ ifneq ($(SHOW_TYPES),)
+ CPOPTS += --show-types
+diff --git a/tests/Makefile b/tests/Makefile
+index 5e3111d..cda971c 100644
+--- a/tests/Makefile
++++ b/tests/Makefile
+@@ -35,9 +35,9 @@ check: $(hostprogs)
+ 	./cipher-aead
+ 
+ install:
+-	install -d $(DESTDIR)/$(bindir)
++	install -d $(DESTDIR)/$(bindir)/tests_cryptodev
+ 	for prog in $(hostprogs); do \
+-		install -m 755 $$prog $(DESTDIR)/$(bindir); \
++		install -m 755 $$prog $(DESTDIR)/$(bindir)/tests_cryptodev/; \
+ 	done
+ 
+ clean:
+-- 
+2.7.0
+
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 @@
+From eedfa57953d2d6255d53cb098c3f81cbde9187f7 Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica at nxp.com>
+Date: Mon, 22 Feb 2016 11:47:27 +0200
+Subject: [PATCH 1/2] Disable installing header file provided by another
+ package
+
+(original patch Signed-off-by: Denys Dmytriyenko <denys at ti.com>)
+Signed-off-by: Cristian Stoica <cristian.stoica at nxp.com>
+
+Upstream-Status: Inappropriate [ OE specific ]
+---
+ Makefile | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 9871a8e..06202bd 100644
+--- a/Makefile
++++ b/Makefile
+@@ -33,7 +33,6 @@ install: modules_install
+ 
+ modules_install:
+ 	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules_install
+-	install -m 644 -D crypto/cryptodev.h $(DESTDIR)/$(includedir)/crypto/cryptodev.h
+ 
+ clean:
+ 	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) clean
+-- 
+2.7.0
+
-- 
1.9.2



More information about the meta-freescale mailing list