From: Cristian Stoica Date: Wed, 7 Jan 2015 09:55:01 +0000 (+0800) Subject: cryptodev: update origin and remove stale patches X-Git-Tag: 2.1~534^2~45 X-Git-Url: https://code.ossystems.io/gitweb?a=commitdiff_plain;h=9e63ca38c4ccbf54228ac743936501f710f8a09e;p=meta-freescale.git cryptodev: update origin and remove stale patches - Nikos handed over project maintainance to Phil Sutter. - Several pending patches have been merged upstream so we removed them from the recipe. The remaining ones have been sorted Signed-off-by: Cristian Stoica Change-Id: I0c6160c739d379ba787e72423d1564b9a3d05d8b Reviewed-on: http://git.am.freescale.net:8181/24177 Reviewed-by: Zhenhua Luo Tested-by: Zhenhua Luo --- diff --git a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl.inc b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl.inc index 70544e26..e32e3502 100644 --- a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl.inc +++ b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl.inc @@ -1,24 +1,17 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/cryptodev-fsl:" -SRC_URI_qoriq-ppc = "git://github.com/nmav/cryptodev-linux.git \ - file://0001-add-support-for-composite-TLS-SHA1-AES-algorithm-off.patch \ - file://0002-use-function-local-storage-for-cipher-and-hmac-keys.patch \ - file://0003-Add-support-for-aead-keys-for-composite-algorithms.patch \ - file://0004-fix-scatterlist-size-for-in-place-operations.patch \ - file://0005-add-dst_len-parameter-to-be-provided-by-the-user.patch \ - file://0006-fix-build-error-on-some-targets.patch \ - file://0007-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch \ - file://0008-fix-cipher-algorithm-memleaks.patch \ - file://0009-PKC-support-added-in-cryptodev-module.patch \ - file://0010-Compat-versions-of-PKC-IOCTLs.patch \ - file://0011-Asynchronous-interface-changes-in-cryptodev.patch \ - file://0012-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch \ - file://0013-RCU-stall-fixed-in-PKC-asynchronous-interface.patch \ - file://0014-use-static-allocation-for-keys-copied-from-userspace.patch \ - file://0015-Add-RSA-Key-generation-offloading.patch \ - file://0016-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch \ +SRC_URI_qoriq-ppc = "git://github.com/cryptodev-linux/cryptodev-linux.git \ + file://0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch \ + file://0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch \ + file://0003-PKC-support-added-in-cryptodev-module.patch \ + file://0004-Compat-versions-of-PKC-IOCTLs.patch \ + file://0005-Asynchronous-interface-changes-in-cryptodev.patch \ + file://0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch \ + file://0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch \ + file://0008-Add-RSA-Key-generation-offloading.patch \ + file://0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch \ " -SRCREV_qoriq-ppc = "e8609a408d40c83ae8fc11bbe9a7b3847612669b" +SRCREV_qoriq-ppc = "6aa62a2c320b04f55fdfe0ed015c3d9b48997239" S_qoriq-ppc = "${WORKDIR}/git" diff --git a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0001-add-support-for-composite-TLS-SHA1-AES-algorithm-off.patch b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch similarity index 55% rename from meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0001-add-support-for-composite-TLS-SHA1-AES-algorithm-off.patch rename to meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch index 094fb0b5..796e5484 100644 --- a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0001-add-support-for-composite-TLS-SHA1-AES-algorithm-off.patch +++ b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0001-add-support-for-composite-TLS10-SHA1-AES-algorithm-o.patch @@ -1,23 +1,22 @@ -From 434790a1bbafa371c0c6647238234573db98d017 Mon Sep 17 00:00:00 2001 +From 715ade8236f40cf811c39f9538dfd60803967fcd Mon Sep 17 00:00:00 2001 From: Cristian Stoica Date: Thu, 29 Aug 2013 16:52:30 +0300 -Subject: [[Patch][fsl 01/16] add support for composite TLS(SHA1,AES) - algorithm offload +Subject: [PATCH 1/9] add support for composite TLS10(SHA1,AES) algorithm + offload -Upstream-status: Pending +This adds support for composite algorithm offload as a primitive +crypto (cipher + hmac) operation. -This adds support for composite algorithm offload in a single crypto -(cipher + hmac) operation. - -It requires either software or hardware TLS support in the Linux kernel -and can be used with Freescale B*, P* and T* platforms that have support -for hardware TLS acceleration. +It requires kernel support for tls10(hmac(sha1),cbc(aes)) algorithm +provided either in software or accelerated by hardware such as +Freescale B*, P* and T* platforms. +Change-Id: Ia1c605da3860e91e681295dfc8df7c09eb4006cf Signed-off-by: Cristian Stoica -Tested-by: Horia Ioan Geanta Neag +Reviewed-on: http://git.am.freescale.net:8181/17218 --- - crypto/cryptodev.h | 1 + - ioctl.c | 5 +++++ + crypto/cryptodev.h | 1 + + ioctl.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h @@ -33,10 +32,10 @@ index 7fb9c7d..c0e8cd4 100644 }; diff --git a/ioctl.c b/ioctl.c -index d4e83f4..a0f1db1 100644 +index 5a55a76..f9b9b2e 100644 --- a/ioctl.c +++ b/ioctl.c -@@ -146,6 +146,11 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) +@@ -159,6 +159,11 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) stream = 1; aead = 1; break; @@ -49,5 +48,5 @@ index d4e83f4..a0f1db1 100644 alg_name = "ecb(cipher_null)"; stream = 1; -- -1.7.9.7 +1.8.3.1 diff --git a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0007-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch similarity index 87% rename from meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0007-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch rename to meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch index b796f160..086a97f8 100644 --- a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0007-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch +++ b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0002-add-support-for-COMPAT_CIOCAUTHCRYPT-ioctl.patch @@ -1,25 +1,26 @@ -From 75e26bf18997488518228cb851585bf8e4c3120f Mon Sep 17 00:00:00 2001 +From 4b766c93e4ee19248dd66bbebb61fb5cc9c8a012 Mon Sep 17 00:00:00 2001 From: Horia Geanta Date: Wed, 4 Dec 2013 15:43:41 +0200 -Subject: [[Patch][fsl 07/16] add support for COMPAT_CIOCAUTHCRYPT ioctl() +Subject: [PATCH 2/9] add support for COMPAT_CIOCAUTHCRYPT ioctl() Upstream-status: Pending Needed for 64b kernel with 32b user space. +Change-Id: I44a999a4164e7ae7122dee6ed0716b2f25cadbc1 Signed-off-by: Horia Geanta Tested-by: Cristian Stoica --- - authenc.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - cryptodev_int.h | 41 ++++++++++++++++++++++++++++ - ioctl.c | 16 +++++++++++ - 3 files changed, 137 insertions(+) + authenc.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + cryptodev_int.h | 40 +++++++++++++++++++++++++++++ + ioctl.c | 16 ++++++++++++ + 3 files changed, 134 insertions(+) diff --git a/authenc.c b/authenc.c -index 5235973..259a225 100644 +index 1bd7377..ef0d3db 100644 --- a/authenc.c +++ b/authenc.c -@@ -241,6 +241,86 @@ static int fill_caop_from_kcaop(struct kernel_crypt_auth_op *kcaop, struct fcryp +@@ -272,6 +272,84 @@ static int fill_caop_from_kcaop(struct kernel_crypt_auth_op *kcaop, struct fcryp return 0; } @@ -34,7 +35,6 @@ index 5235973..259a225 100644 + caop->op = compat->op; + caop->flags = compat->flags; + caop->len = compat->len; -+ caop->dst_len = compat->dst_len; + caop->auth_len = compat->auth_len; + caop->tag_len = compat->tag_len; + caop->iv_len = compat->iv_len; @@ -54,7 +54,6 @@ index 5235973..259a225 100644 + compat->op = caop->op; + compat->flags = caop->flags; + compat->len = caop->len; -+ compat->dst_len = caop->dst_len; + compat->auth_len = caop->auth_len; + compat->tag_len = caop->tag_len; + compat->iv_len = caop->iv_len; @@ -107,10 +106,10 @@ index 5235973..259a225 100644 int kcaop_from_user(struct kernel_crypt_auth_op *kcaop, struct fcrypt *fcr, void __user *arg) diff --git a/cryptodev_int.h b/cryptodev_int.h -index d7660fa..8d206c9 100644 +index d7660fa..8e687e7 100644 --- a/cryptodev_int.h +++ b/cryptodev_int.h -@@ -73,11 +73,43 @@ struct compat_crypt_op { +@@ -73,11 +73,42 @@ struct compat_crypt_op { compat_uptr_t iv;/* initialization vector for encryption operations */ }; @@ -120,7 +119,6 @@ index d7660fa..8d206c9 100644 + uint16_t op; /* COP_ENCRYPT or COP_DECRYPT */ + uint16_t flags; /* see COP_FLAG_AEAD_* */ + uint32_t len; /* length of source data */ -+ uint32_t dst_len; /* length of result data */ + uint32_t auth_len; /* length of auth data */ + compat_uptr_t auth_src; /* authenticated-only data */ + @@ -154,7 +152,7 @@ index d7660fa..8d206c9 100644 #endif /* CONFIG_COMPAT */ -@@ -108,6 +140,15 @@ struct kernel_crypt_auth_op { +@@ -108,6 +139,15 @@ struct kernel_crypt_auth_op { /* auth */ @@ -171,10 +169,10 @@ index d7660fa..8d206c9 100644 struct fcrypt *fcr, void __user *arg); int kcaop_to_user(struct kernel_crypt_auth_op *kcaop, diff --git a/ioctl.c b/ioctl.c -index 3baf195..18874d3 100644 +index f9b9b2e..1563c75 100644 --- a/ioctl.c +++ b/ioctl.c -@@ -991,6 +991,7 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) +@@ -998,6 +998,7 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) struct session_op sop; struct compat_session_op compat_sop; struct kernel_crypt_op kcop; @@ -182,7 +180,7 @@ index 3baf195..18874d3 100644 int ret; if (unlikely(!pcr)) -@@ -1033,6 +1034,21 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) +@@ -1040,6 +1041,21 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) return ret; return compat_kcop_to_user(&kcop, fcr, arg); @@ -205,5 +203,5 @@ index 3baf195..18874d3 100644 case COMPAT_CIOCASYNCCRYPT: if (unlikely(ret = compat_kcop_from_user(&kcop, fcr, arg))) -- -1.7.9.7 +1.8.3.1 diff --git a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0002-use-function-local-storage-for-cipher-and-hmac-keys.patch b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0002-use-function-local-storage-for-cipher-and-hmac-keys.patch deleted file mode 100644 index 4702fd4f..00000000 --- a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0002-use-function-local-storage-for-cipher-and-hmac-keys.patch +++ /dev/null @@ -1,87 +0,0 @@ -From cc65307405a21c3b709ca6f2a6f64ff0c67c0eed Mon Sep 17 00:00:00 2001 -From: Cristian Stoica -Date: Wed, 18 Sep 2013 13:42:31 +0300 -Subject: [[Patch][fsl 02/16] use function-local storage for cipher and hmac - keys - -Upstream-status: Pending - -This refactorization is necessary for next patches that add support for -aead composite ciphers where the aead key is the sum of cipher and hmac -keys. - -Without this patch, the hmac and cipher keys can't be combined in the -same ioctl. - -Signed-off-by: Cristian Stoica -Tested-by: Horia Ioan Geanta Neag ---- - ioctl.c | 14 ++++++-------- - 1 file changed, 6 insertions(+), 8 deletions(-) - -diff --git a/ioctl.c b/ioctl.c -index a0f1db1..c614373 100644 ---- a/ioctl.c -+++ b/ioctl.c -@@ -109,6 +109,8 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) - const char *alg_name = NULL; - const char *hash_name = NULL; - int hmac_mode = 1, stream = 0, aead = 0; -+ uint8_t enckey[CRYPTO_CIPHER_MAX_KEY_LEN]; -+ uint8_t mackey[CRYPTO_HMAC_MAX_KEY_LEN]; - - /* Does the request make sense? */ - if (unlikely(!sop->cipher && !sop->mac)) { -@@ -227,8 +229,6 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) - - /* Set-up crypto transform. */ - if (alg_name) { -- uint8_t keyp[CRYPTO_CIPHER_MAX_KEY_LEN]; -- - if (unlikely(sop->keylen > CRYPTO_CIPHER_MAX_KEY_LEN)) { - ddebug(1, "Setting key failed for %s-%zu.", - alg_name, (size_t)sop->keylen*8); -@@ -236,12 +236,12 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) - goto error_cipher; - } - -- if (unlikely(copy_from_user(keyp, sop->key, sop->keylen))) { -+ if (unlikely(copy_from_user(enckey, sop->key, sop->keylen))) { - ret = -EFAULT; - goto error_cipher; - } - -- ret = cryptodev_cipher_init(&ses_new->cdata, alg_name, keyp, -+ ret = cryptodev_cipher_init(&ses_new->cdata, alg_name, enckey, - sop->keylen, stream, aead); - if (ret < 0) { - ddebug(1, "Failed to load cipher for %s", alg_name); -@@ -251,8 +251,6 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) - } - - if (hash_name && aead == 0) { -- uint8_t keyp[CRYPTO_HMAC_MAX_KEY_LEN]; -- - if (unlikely(sop->mackeylen > CRYPTO_HMAC_MAX_KEY_LEN)) { - ddebug(1, "Setting key failed for %s-%zu.", - hash_name, (size_t)sop->mackeylen*8); -@@ -260,14 +258,14 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) - goto error_hash; - } - -- if (sop->mackey && unlikely(copy_from_user(keyp, sop->mackey, -+ if (sop->mackey && unlikely(copy_from_user(mackey, sop->mackey, - sop->mackeylen))) { - ret = -EFAULT; - goto error_hash; - } - - ret = cryptodev_hash_init(&ses_new->hdata, hash_name, hmac_mode, -- keyp, sop->mackeylen); -+ mackey, sop->mackeylen); - if (ret != 0) { - ddebug(1, "Failed to load hash for %s", hash_name); - ret = -EINVAL; --- -1.7.9.7 - diff --git a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0003-Add-support-for-aead-keys-for-composite-algorithms.patch b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0003-Add-support-for-aead-keys-for-composite-algorithms.patch deleted file mode 100644 index 033552a3..00000000 --- a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0003-Add-support-for-aead-keys-for-composite-algorithms.patch +++ /dev/null @@ -1,170 +0,0 @@ -From 8cabaedb69acc5b44c7a9cf058045908130a6af7 Mon Sep 17 00:00:00 2001 -From: Cristian Stoica -Date: Wed, 23 Oct 2013 16:57:22 +0300 -Subject: [[Patch][fsl 03/16] Add support for aead keys for composite - algorithms - -Upstream-status: Pending - -Composite aead algorithms (e.g. AES-CBC + HMAC-SHA1) need two keys to -operate. The two keys are wrapped in a single buffer in the form -used also by crypto/authenc.c -Blockcipher and non-composite aead algorithms (e.g. AES-GCM) use a -single key which is simply copied from user-space. - -Signed-off-by: Cristian Stoica -Tested-by: Horia Ioan Geanta Neag ---- - cryptlib.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - cryptlib.h | 3 +++ - ioctl.c | 24 ++++++++++++++---------- - 3 files changed, 76 insertions(+), 10 deletions(-) - -diff --git a/cryptlib.c b/cryptlib.c -index a7fbff4..2986d09 100644 ---- a/cryptlib.c -+++ b/cryptlib.c -@@ -34,6 +34,8 @@ - #include - #include - #include -+#include -+#include - #include "cryptodev_int.h" - - -@@ -53,6 +55,63 @@ static void cryptodev_complete(struct crypto_async_request *req, int err) - complete(&res->completion); - } - -+int cryptodev_get_cipher_keylen(unsigned int *keylen, struct session_op *sop, -+ int aead) -+{ -+ unsigned int klen = sop->keylen; -+ -+ if (unlikely(sop->keylen > CRYPTO_CIPHER_MAX_KEY_LEN)) -+ return -EINVAL; -+ -+ if (aead && sop->mackeylen) { -+ if (unlikely(sop->mackeylen > CRYPTO_HMAC_MAX_KEY_LEN)) -+ return -EINVAL; -+ klen += sop->mackeylen; -+ klen += RTA_SPACE(sizeof(struct crypto_authenc_key_param)); -+ } -+ -+ *keylen = klen; -+ return 0; -+} -+ -+int cryptodev_get_cipher_key(uint8_t *key, struct session_op *sop, int aead) -+{ -+ /* Get algorithm key from user-space. For composite aead algorithms, -+ * the key representation is in the format used by linux kernel in -+ * crypto/authenc.c -+ */ -+ struct crypto_authenc_key_param *param; -+ struct rtattr *rta; -+ int ret = 0; -+ -+ if (aead && sop->mackeylen) { -+ /* the key header type and header length */ -+ rta = (void *)key; -+ rta->rta_type = CRYPTO_AUTHENC_KEYA_PARAM; -+ rta->rta_len = RTA_LENGTH(sizeof(*param)); -+ -+ /* the key parameter is the length of the encryption key */ -+ param = RTA_DATA(rta); -+ param->enckeylen = cpu_to_be32(sop->keylen); -+ -+ /* copy the hash key */ -+ key += RTA_SPACE(sizeof(*param)); -+ if (unlikely(copy_from_user(key, sop->mackey, sop->mackeylen))) { -+ ret = -EFAULT; -+ goto error; -+ } -+ /* get the pointer ready for the encryption key */ -+ key += sop->mackeylen; -+ } -+ /* blockcipher algorithms have the key ready to use */ -+ if (unlikely(copy_from_user(key, sop->key, sop->keylen))) -+ ret = -EFAULT; -+ -+error: -+ return ret; -+} -+ -+ - int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name, - uint8_t *keyp, size_t keylen, int stream, int aead) - { -diff --git a/cryptlib.h b/cryptlib.h -index 0744284..a0a8a63 100644 ---- a/cryptlib.h -+++ b/cryptlib.h -@@ -25,6 +25,9 @@ struct cipher_data { - int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name, - uint8_t *key, size_t keylen, int stream, int aead); - void cryptodev_cipher_deinit(struct cipher_data *cdata); -+int cryptodev_get_cipher_key(uint8_t *key, struct session_op *sop, int aead); -+int cryptodev_get_cipher_keylen(unsigned int *keylen, struct session_op *sop, -+ int aead); - ssize_t cryptodev_cipher_decrypt(struct cipher_data *cdata, - const struct scatterlist *sg1, - struct scatterlist *sg2, size_t len); -diff --git a/ioctl.c b/ioctl.c -index c614373..3baf195 100644 ---- a/ioctl.c -+++ b/ioctl.c -@@ -109,7 +109,8 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) - const char *alg_name = NULL; - const char *hash_name = NULL; - int hmac_mode = 1, stream = 0, aead = 0; -- uint8_t enckey[CRYPTO_CIPHER_MAX_KEY_LEN]; -+ uint8_t *key = NULL; -+ unsigned int keylen; - uint8_t mackey[CRYPTO_HMAC_MAX_KEY_LEN]; - - /* Does the request make sense? */ -@@ -229,20 +230,22 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) - - /* Set-up crypto transform. */ - if (alg_name) { -- if (unlikely(sop->keylen > CRYPTO_CIPHER_MAX_KEY_LEN)) { -- ddebug(1, "Setting key failed for %s-%zu.", -- alg_name, (size_t)sop->keylen*8); -- ret = -EINVAL; -+ ret = cryptodev_get_cipher_keylen(&keylen, sop, aead); -+ if (unlikely(ret < 0)) - goto error_cipher; -- } - -- if (unlikely(copy_from_user(enckey, sop->key, sop->keylen))) { -- ret = -EFAULT; -+ key = kmalloc(keylen, GFP_KERNEL); -+ if (unlikely(!key)) { -+ ret = -ENOMEM; - goto error_cipher; - } - -- ret = cryptodev_cipher_init(&ses_new->cdata, alg_name, enckey, -- sop->keylen, stream, aead); -+ ret = cryptodev_get_cipher_key(key, sop, aead); -+ if (unlikely(ret < 0)) -+ goto error_cipher; -+ -+ ret = cryptodev_cipher_init(&ses_new->cdata, alg_name, key, keylen, -+ stream, aead); - if (ret < 0) { - ddebug(1, "Failed to load cipher for %s", alg_name); - ret = -EINVAL; -@@ -318,6 +321,7 @@ error_hash: - kfree(ses_new->sg); - kfree(ses_new->pages); - error_cipher: -+ kfree(key); - kfree(ses_new); - - return ret; --- -1.7.9.7 - diff --git a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0009-PKC-support-added-in-cryptodev-module.patch b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0003-PKC-support-added-in-cryptodev-module.patch similarity index 94% rename from meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0009-PKC-support-added-in-cryptodev-module.patch rename to meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0003-PKC-support-added-in-cryptodev-module.patch index b403731a..a4f7816b 100644 --- a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0009-PKC-support-added-in-cryptodev-module.patch +++ b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0003-PKC-support-added-in-cryptodev-module.patch @@ -1,22 +1,22 @@ -From 55be37e9e308990b2eeeef7f974dfbfbb1120266 Mon Sep 17 00:00:00 2001 +From 5b57fc2124cef0acc3c7e8de376ebd9aa4f1fdd3 Mon Sep 17 00:00:00 2001 From: Yashpal Dutta Date: Fri, 7 Mar 2014 06:16:09 +0545 -Subject: [[Patch][fsl 09/16] PKC support added in cryptodev module +Subject: [PATCH 3/9] PKC support added in cryptodev module Upstream-status: Pending Signed-off-by: Yashpal Dutta --- - cryptlib.c | 66 ++++++++- - cryptlib.h | 28 ++++ - crypto/cryptodev.h | 15 ++- - cryptodev_int.h | 20 ++- - ioctl.c | 196 +++++++++++++++++++++++++-- - main.c | 378 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + cryptlib.c | 66 +++++++++- + cryptlib.h | 28 ++++ + crypto/cryptodev.h | 15 ++- + cryptodev_int.h | 20 ++- + ioctl.c | 196 +++++++++++++++++++++++++-- + main.c | 378 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 685 insertions(+), 18 deletions(-) diff --git a/cryptlib.c b/cryptlib.c -index 3576f39..fa0b63f 100644 +index 44ce763..6900028 100644 --- a/cryptlib.c +++ b/cryptlib.c @@ -5,6 +5,8 @@ @@ -40,7 +40,7 @@ index 3576f39..fa0b63f 100644 static void cryptodev_complete(struct crypto_async_request *req, int err) { struct cryptodev_result *res = req->data; -@@ -244,7 +241,6 @@ static inline int waitfor(struct cryptodev_result *cr, ssize_t ret) +@@ -259,7 +256,6 @@ static inline int waitfor(struct cryptodev_result *cr, ssize_t ret) case 0: break; case -EINPROGRESS: @@ -48,7 +48,7 @@ index 3576f39..fa0b63f 100644 wait_for_completion(&cr->completion); /* At this point we known for sure the request has finished, * because wait_for_completion above was not interruptible. -@@ -424,3 +420,61 @@ int cryptodev_hash_final(struct hash_data *hdata, void *output) +@@ -439,3 +435,61 @@ int cryptodev_hash_final(struct hash_data *hdata, void *output) return waitfor(hdata->async.result, ret); } @@ -111,7 +111,7 @@ index 3576f39..fa0b63f 100644 + return ret; +} diff --git a/cryptlib.h b/cryptlib.h -index 4cb66ad..e77edc5 100644 +index a0a8a63..56d325a 100644 --- a/cryptlib.h +++ b/cryptlib.h @@ -1,3 +1,6 @@ @@ -123,7 +123,7 @@ index 4cb66ad..e77edc5 100644 @@ -89,5 +92,30 @@ void cryptodev_hash_deinit(struct hash_data *hdata); int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name, - int hmac_mode, void *mackey, unsigned int mackeylen); + int hmac_mode, void *mackey, size_t mackeylen); +/* Operation Type */ +enum offload_type { @@ -153,7 +153,7 @@ index 4cb66ad..e77edc5 100644 +int cryptodev_pkc_offload(struct cryptodev_pkc *); #endif diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h -index 3ea3d35..575ce63 100644 +index c0e8cd4..96675fe 100644 --- a/crypto/cryptodev.h +++ b/crypto/cryptodev.h @@ -1,6 +1,10 @@ @@ -169,7 +169,7 @@ index 3ea3d35..575ce63 100644 #ifndef L_CRYPTODEV_H #define L_CRYPTODEV_H -@@ -246,6 +250,9 @@ struct crypt_kop { +@@ -245,6 +249,9 @@ struct crypt_kop { __u16 crk_oparams; __u32 crk_pad1; struct crparam crk_param[CRK_MAXPARAM]; @@ -179,7 +179,7 @@ index 3ea3d35..575ce63 100644 }; enum cryptodev_crk_op_t { -@@ -290,5 +297,7 @@ enum cryptodev_crk_op_t { +@@ -289,5 +296,7 @@ enum cryptodev_crk_op_t { */ #define CIOCASYNCCRYPT _IOW('c', 110, struct crypt_op) #define CIOCASYNCFETCH _IOR('c', 111, struct crypt_op) @@ -189,7 +189,7 @@ index 3ea3d35..575ce63 100644 +#define CIOCASYMASYNFETCH _IOR('c', 113, struct crypt_kop) #endif /* L_CRYPTODEV_H */ diff --git a/cryptodev_int.h b/cryptodev_int.h -index 8891837..b08c253 100644 +index 8e687e7..fdbcc61 100644 --- a/cryptodev_int.h +++ b/cryptodev_int.h @@ -1,4 +1,6 @@ @@ -200,7 +200,7 @@ index 8891837..b08c253 100644 #ifndef CRYPTODEV_INT_H # define CRYPTODEV_INT_H -@@ -113,6 +115,14 @@ struct compat_crypt_auth_op { +@@ -112,6 +114,14 @@ struct compat_crypt_auth_op { #endif /* CONFIG_COMPAT */ @@ -215,7 +215,7 @@ index 8891837..b08c253 100644 /* kernel-internal extension to struct crypt_op */ struct kernel_crypt_op { struct crypt_op cop; -@@ -158,6 +168,14 @@ int crypto_run(struct fcrypt *fcr, struct kernel_crypt_op *kcop); +@@ -157,6 +167,14 @@ int crypto_run(struct fcrypt *fcr, struct kernel_crypt_op *kcop); #include @@ -231,7 +231,7 @@ index 8891837..b08c253 100644 struct csession { struct list_head entry; diff --git a/ioctl.c b/ioctl.c -index 63467e0..44070e1 100644 +index 1563c75..782d7fe 100644 --- a/ioctl.c +++ b/ioctl.c @@ -4,6 +4,7 @@ @@ -242,7 +242,7 @@ index 63467e0..44070e1 100644 * * This file is part of linux cryptodev. * -@@ -87,8 +88,37 @@ struct crypt_priv { +@@ -89,8 +90,37 @@ struct crypt_priv { int itemcount; struct work_struct cryptask; wait_queue_head_t user_waiter; @@ -280,7 +280,7 @@ index 63467e0..44070e1 100644 #define FILL_SG(sg, ptr, len) \ do { \ (sg)->page = virt_to_page(ptr); \ -@@ -467,7 +497,8 @@ cryptodev_open(struct inode *inode, struct file *filp) +@@ -472,7 +502,8 @@ cryptodev_open(struct inode *inode, struct file *filp) INIT_LIST_HEAD(&pcr->free.list); INIT_LIST_HEAD(&pcr->todo.list); INIT_LIST_HEAD(&pcr->done.list); @@ -290,7 +290,7 @@ index 63467e0..44070e1 100644 INIT_WORK(&pcr->cryptask, cryptask_routine); init_waitqueue_head(&pcr->user_waiter); -@@ -634,6 +665,79 @@ static int crypto_async_fetch(struct crypt_priv *pcr, +@@ -639,6 +670,79 @@ static int crypto_async_fetch(struct crypt_priv *pcr, } #endif @@ -370,7 +370,7 @@ index 63467e0..44070e1 100644 /* this function has to be called from process context */ static int fill_kcop_from_cop(struct kernel_crypt_op *kcop, struct fcrypt *fcr) { -@@ -657,11 +761,8 @@ static int fill_kcop_from_cop(struct kernel_crypt_op *kcop, struct fcrypt *fcr) +@@ -662,11 +766,8 @@ static int fill_kcop_from_cop(struct kernel_crypt_op *kcop, struct fcrypt *fcr) if (cop->iv) { rc = copy_from_user(kcop->iv, cop->iv, kcop->ivlen); @@ -383,7 +383,7 @@ index 63467e0..44070e1 100644 } return 0; -@@ -687,6 +788,25 @@ static int fill_cop_from_kcop(struct kernel_crypt_op *kcop, struct fcrypt *fcr) +@@ -692,6 +793,25 @@ static int fill_cop_from_kcop(struct kernel_crypt_op *kcop, struct fcrypt *fcr) return 0; } @@ -409,7 +409,7 @@ index 63467e0..44070e1 100644 static int kcop_from_user(struct kernel_crypt_op *kcop, struct fcrypt *fcr, void __user *arg) { -@@ -816,7 +936,8 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) +@@ -821,7 +941,8 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) switch (cmd) { case CIOCASYMFEAT: @@ -419,7 +419,7 @@ index 63467e0..44070e1 100644 case CRIOGET: fd = clonefd(filp); ret = put_user(fd, p); -@@ -852,6 +973,24 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) +@@ -857,6 +978,24 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) if (unlikely(ret)) return ret; return copy_to_user(arg, &siop, sizeof(siop)); @@ -444,7 +444,7 @@ index 63467e0..44070e1 100644 case CIOCCRYPT: if (unlikely(ret = kcop_from_user(&kcop, fcr, arg))) { dwarning(1, "Error copying from user"); -@@ -890,6 +1029,45 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) +@@ -895,6 +1034,45 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) return kcop_to_user(&kcop, fcr, arg); #endif @@ -490,7 +490,7 @@ index 63467e0..44070e1 100644 default: return -EINVAL; } -@@ -1078,9 +1256,11 @@ static unsigned int cryptodev_poll(struct file *file, poll_table *wait) +@@ -1083,9 +1261,11 @@ static unsigned int cryptodev_poll(struct file *file, poll_table *wait) poll_wait(file, &pcr->user_waiter, wait); @@ -894,5 +894,5 @@ index 57e5c38..0b7951e 100644 { struct csession *ses_ptr; -- -1.7.9.7 +1.8.3.1 diff --git a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0010-Compat-versions-of-PKC-IOCTLs.patch b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0004-Compat-versions-of-PKC-IOCTLs.patch similarity index 90% rename from meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0010-Compat-versions-of-PKC-IOCTLs.patch rename to meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0004-Compat-versions-of-PKC-IOCTLs.patch index 03204625..2eedcc72 100644 --- a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0010-Compat-versions-of-PKC-IOCTLs.patch +++ b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0004-Compat-versions-of-PKC-IOCTLs.patch @@ -1,18 +1,18 @@ -From f6550035fe2c0e66798ace17d31d1d880beacc14 Mon Sep 17 00:00:00 2001 +From 5435dfd329cd90837ce36c6dadc26166c7906cab Mon Sep 17 00:00:00 2001 From: Yashpal Dutta Date: Fri, 7 Mar 2014 06:52:13 +0545 -Subject: [[Patch][fsl 10/16] Compat versions of PKC IOCTLs +Subject: [PATCH 4/9] Compat versions of PKC IOCTLs Upstream-status: Pending Signed-off-by: Yashpal Dutta --- - cryptodev_int.h | 20 ++++++++++ - ioctl.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + cryptodev_int.h | 20 ++++++++++ + ioctl.c | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) diff --git a/cryptodev_int.h b/cryptodev_int.h -index b08c253..229fcd0 100644 +index fdbcc61..cf54dac 100644 --- a/cryptodev_int.h +++ b/cryptodev_int.h @@ -75,6 +75,24 @@ struct compat_crypt_op { @@ -40,7 +40,7 @@ index b08c253..229fcd0 100644 /* input of CIOCAUTHCRYPT */ struct compat_crypt_auth_op { uint32_t ses; /* session identifier */ -@@ -112,6 +130,8 @@ struct compat_crypt_auth_op { +@@ -111,6 +129,8 @@ struct compat_crypt_auth_op { #define COMPAT_CIOCASYNCCRYPT _IOW('c', 107, struct compat_crypt_op) #define COMPAT_CIOCASYNCFETCH _IOR('c', 108, struct compat_crypt_op) #define COMPAT_CIOCAUTHCRYPT _IOWR('c', 109, struct compat_crypt_auth_op) @@ -50,10 +50,10 @@ index b08c253..229fcd0 100644 #endif /* CONFIG_COMPAT */ diff --git a/ioctl.c b/ioctl.c -index 44070e1..ec82c69 100644 +index 782d7fe..3baf3e6 100644 --- a/ioctl.c +++ b/ioctl.c -@@ -1076,6 +1076,68 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) +@@ -1081,6 +1081,68 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) /* compatibility code for 32bit userlands */ #ifdef CONFIG_COMPAT @@ -122,7 +122,7 @@ index 44070e1..ec82c69 100644 static inline void compat_to_session_op(struct compat_session_op *compat, struct session_op *sop) { -@@ -1203,7 +1265,26 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) +@@ -1208,7 +1270,26 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) return -EFAULT; } return ret; @@ -149,7 +149,7 @@ index 44070e1..ec82c69 100644 case COMPAT_CIOCCRYPT: ret = compat_kcop_from_user(&kcop, fcr, arg); if (unlikely(ret)) -@@ -1242,6 +1323,45 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) +@@ -1247,6 +1328,45 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) return compat_kcop_to_user(&kcop, fcr, arg); #endif @@ -196,5 +196,5 @@ index 44070e1..ec82c69 100644 return -EINVAL; } -- -1.7.9.7 +1.8.3.1 diff --git a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0004-fix-scatterlist-size-for-in-place-operations.patch b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0004-fix-scatterlist-size-for-in-place-operations.patch deleted file mode 100644 index c8086062..00000000 --- a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0004-fix-scatterlist-size-for-in-place-operations.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 5a6cd042d3cee9e3bbf3b0125a89e64d75dffdc7 Mon Sep 17 00:00:00 2001 -From: Cristian Stoica -Date: Thu, 31 Oct 2013 13:13:51 +0200 -Subject: [[Patch][fsl 04/16] fix scatterlist size for in-place operations - -Upstream-status: Pending - -For in-place operations, the scatterlist must be big enough to allow for -either the source or destination data: - - for block ciphers, the destination will be bigger than the source if - the source is not multiple of blocksize - - for aead ciphers, the additional data and padding guarantees the - destination to be bigger than the source. - -Signed-off-by: Cristian Stoica -Tested-by: Horia Ioan Geanta Neag ---- - zc.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/zc.c b/zc.c -index 809a36d..8855083 100644 ---- a/zc.c -+++ b/zc.c -@@ -162,8 +162,9 @@ int get_userbuf(struct csession *ses, - } - - if (src == dst) { /* inplace operation */ -- rc = __get_userbuf(src, src_len, 1, ses->used_pages, -- ses->pages, ses->sg, task, mm); -+ rc = __get_userbuf(src, max(src_len, dst_len), 1, ses->used_pages, -+ ses->pages, ses->sg, task, mm); -+ - if (unlikely(rc)) { - derr(1, "failed to get user pages for data IO"); - return rc; --- -1.7.9.7 - diff --git a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0011-Asynchronous-interface-changes-in-cryptodev.patch b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0005-Asynchronous-interface-changes-in-cryptodev.patch similarity index 88% rename from meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0011-Asynchronous-interface-changes-in-cryptodev.patch rename to meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0005-Asynchronous-interface-changes-in-cryptodev.patch index 5331abc6..2f88eda3 100644 --- a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0011-Asynchronous-interface-changes-in-cryptodev.patch +++ b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0005-Asynchronous-interface-changes-in-cryptodev.patch @@ -1,20 +1,20 @@ -From ffa8fd090afaf3631e6abd0ab8daa6780be7c31c Mon Sep 17 00:00:00 2001 +From ddc4179a454cea79c8385fd6756d20cbf3c6dcb5 Mon Sep 17 00:00:00 2001 From: Yashpal Dutta Date: Fri, 7 Mar 2014 07:24:00 +0545 -Subject: [[Patch][fsl 11/16] Asynchronous interface changes in cryptodev +Subject: [PATCH 5/9] Asynchronous interface changes in cryptodev Upstream-status: Pending Signed-off-by: Yashpal Dutta --- - cryptlib.h | 7 ++++- - crypto/cryptodev.h | 10 ++++++- - cryptodev_int.h | 10 ++++++- - ioctl.c | 76 +++++++++++++++++++++++++++++++++++----------------- + cryptlib.h | 7 ++++- + crypto/cryptodev.h | 10 ++++++- + cryptodev_int.h | 10 ++++++- + ioctl.c | 76 +++++++++++++++++++++++++++++++++++++----------------- 4 files changed, 76 insertions(+), 27 deletions(-) diff --git a/cryptlib.h b/cryptlib.h -index e77edc5..947d845 100644 +index 56d325a..7ffa54c 100644 --- a/cryptlib.h +++ b/cryptlib.h @@ -113,7 +113,12 @@ struct cryptodev_pkc { @@ -32,10 +32,10 @@ index e77edc5..947d845 100644 }; diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h -index 575ce63..0d65899 100644 +index 96675fe..4436fbf 100644 --- a/crypto/cryptodev.h +++ b/crypto/cryptodev.h -@@ -255,6 +255,14 @@ struct crypt_kop { +@@ -254,6 +254,14 @@ struct crypt_kop { void *cookie; }; @@ -50,7 +50,7 @@ index 575ce63..0d65899 100644 enum cryptodev_crk_op_t { CRK_MOD_EXP = 0, CRK_MOD_EXP_CRT = 1, -@@ -299,5 +307,5 @@ enum cryptodev_crk_op_t { +@@ -298,5 +306,5 @@ enum cryptodev_crk_op_t { #define CIOCASYNCFETCH _IOR('c', 111, struct crypt_op) /* additional ioctls for asynchronous operation for asymmetric ciphers*/ #define CIOCASYMASYNCRYPT _IOW('c', 112, struct crypt_kop) @@ -58,7 +58,7 @@ index 575ce63..0d65899 100644 +#define CIOCASYMFETCHCOOKIE _IOR('c', 113, struct pkc_cookie_list_s) #endif /* L_CRYPTODEV_H */ diff --git a/cryptodev_int.h b/cryptodev_int.h -index 229fcd0..8beeef0 100644 +index cf54dac..5347cae 100644 --- a/cryptodev_int.h +++ b/cryptodev_int.h @@ -93,6 +93,12 @@ struct compat_crypt_kop { @@ -74,7 +74,7 @@ index 229fcd0..8beeef0 100644 /* input of CIOCAUTHCRYPT */ struct compat_crypt_auth_op { uint32_t ses; /* session identifier */ -@@ -127,11 +133,13 @@ struct compat_crypt_auth_op { +@@ -126,11 +132,13 @@ struct compat_crypt_auth_op { /* 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) @@ -90,10 +90,10 @@ index 229fcd0..8beeef0 100644 #endif /* CONFIG_COMPAT */ diff --git a/ioctl.c b/ioctl.c -index ec82c69..9f57d46 100644 +index 3baf3e6..2eb7f03 100644 --- a/ioctl.c +++ b/ioctl.c -@@ -103,8 +103,6 @@ void cryptodev_complete_asym(struct crypto_async_request *req, int err) +@@ -105,8 +105,6 @@ void cryptodev_complete_asym(struct crypto_async_request *req, int err) crypto_free_pkc(pkc->s); res->err = err; if (pkc->type == SYNCHRONOUS) { @@ -102,7 +102,7 @@ index ec82c69..9f57d46 100644 complete(&res->completion); } else { struct crypt_priv *pcr = pkc->priv; -@@ -1046,26 +1044,41 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) +@@ -1051,26 +1049,41 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) ret = 0; } return ret; @@ -155,7 +155,7 @@ index ec82c69..9f57d46 100644 } return ret; default: -@@ -1340,26 +1353,41 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) +@@ -1345,26 +1358,41 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) ret = 0; } return ret; @@ -209,5 +209,5 @@ index ec82c69..9f57d46 100644 return ret; default: -- -1.7.9.7 +1.8.3.1 diff --git a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0005-add-dst_len-parameter-to-be-provided-by-the-user.patch b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0005-add-dst_len-parameter-to-be-provided-by-the-user.patch deleted file mode 100644 index 480d2a93..00000000 --- a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0005-add-dst_len-parameter-to-be-provided-by-the-user.patch +++ /dev/null @@ -1,70 +0,0 @@ -From e673e6ec09770b624d524bcd82f911e4fe2e2075 Mon Sep 17 00:00:00 2001 -From: Cristian Stoica -Date: Thu, 31 Oct 2013 13:27:28 +0200 -Subject: [[Patch][fsl 05/16] add dst_len parameter to be provided by the user - -Upstream-status: Pending - -This allows the user to set the result length and relieves cryptodev -from making assumptions about it. - -Signed-off-by: Cristian Stoica -Tested-by: Horia Ioan Geanta Neag ---- - authenc.c | 13 +++---------- - crypto/cryptodev.h | 1 + - 2 files changed, 4 insertions(+), 10 deletions(-) - -diff --git a/authenc.c b/authenc.c -index a183820..5235973 100644 ---- a/authenc.c -+++ b/authenc.c -@@ -199,7 +199,7 @@ static int fill_kcaop_from_caop(struct kernel_crypt_auth_op *kcaop, struct fcryp - kcaop->ivlen = caop->iv ? ses_ptr->cdata.ivsize : 0; - - if (caop->flags & COP_FLAG_AEAD_TLS_TYPE) -- kcaop->dst_len = caop->len + ses_ptr->cdata.blocksize /* pad */ + caop->tag_len; -+ kcaop->dst_len = caop->dst_len; - else - kcaop->dst_len = caop->len; - -@@ -645,8 +645,6 @@ __crypto_auth_run_zc(struct csession *ses_ptr, struct kernel_crypt_auth_op *kcao - ret = tls_auth_n_crypt(ses_ptr, kcaop, auth_sg, caop->auth_len, - dst_sg, caop->len); - } else { -- int dst_len; -- - if (unlikely(ses_ptr->cdata.init == 0 || - (ses_ptr->cdata.stream == 0 && - ses_ptr->cdata.aead == 0))) { -@@ -655,13 +653,8 @@ __crypto_auth_run_zc(struct csession *ses_ptr, struct kernel_crypt_auth_op *kcao - goto free_auth_buf; - } - -- if (caop->op == COP_ENCRYPT) -- dst_len = caop->len + cryptodev_cipher_get_tag_size(&ses_ptr->cdata); -- else -- dst_len = caop->len; -- -- ret = get_userbuf(ses_ptr, caop->src, caop->len, caop->dst, dst_len, -- kcaop->task, kcaop->mm, &src_sg, &dst_sg); -+ ret = get_userbuf(ses_ptr, caop->src, caop->len, caop->dst, -+ caop->dst_len, kcaop->task, kcaop->mm, &src_sg, &dst_sg); - if (unlikely(ret)) { - derr(1, "get_userbuf(): Error getting user pages."); - goto free_auth_buf; -diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h -index c0e8cd4..3ea3d35 100644 ---- a/crypto/cryptodev.h -+++ b/crypto/cryptodev.h -@@ -137,6 +137,7 @@ struct crypt_auth_op { - __u16 op; /* COP_ENCRYPT or COP_DECRYPT */ - __u16 flags; /* see COP_FLAG_AEAD_* */ - __u32 len; /* length of source data */ -+ __u32 dst_len; /* length of result data */ - __u32 auth_len; /* length of auth data */ - __u8 __user *auth_src; /* authenticated-only data */ - --- -1.7.9.7 - diff --git a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0012-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch similarity index 88% rename from meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0012-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch rename to meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch index acb5bea7..e70a057b 100644 --- a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0012-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch +++ b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0006-ECC_KEYGEN-and-DLC_KEYGEN-supported-in-cryptodev-mod.patch @@ -1,24 +1,23 @@ -From bda8dd5839da7a8e731b60b64b9fcb531c334b99 Mon Sep 17 00:00:00 2001 +From 30fc86a09109f169815befc2cd8bbfcae79fe7e0 Mon Sep 17 00:00:00 2001 From: Yashpal Dutta Date: Fri, 7 Mar 2014 07:53:53 +0545 -Subject: [[Patch][fsl 12/16] ECC_KEYGEN and DLC_KEYGEN supported in cryptodev - module +Subject: [PATCH 6/9] ECC_KEYGEN and DLC_KEYGEN supported in cryptodev module Upstream-status: Pending Signed-off-by: Yashpal Dutta --- - cryptlib.c | 2 ++ - crypto/cryptodev.h | 5 +++- - ioctl.c | 29 ++++++++++++++++-- - main.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + cryptlib.c | 2 ++ + crypto/cryptodev.h | 5 +++- + ioctl.c | 29 +++++++++++++++++-- + main.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 118 insertions(+), 3 deletions(-) diff --git a/cryptlib.c b/cryptlib.c -index fa0b63f..41acb2c 100644 +index 6900028..47cd568 100644 --- a/cryptlib.c +++ b/cryptlib.c -@@ -437,6 +437,8 @@ int cryptodev_pkc_offload(struct cryptodev_pkc *pkc) +@@ -452,6 +452,8 @@ int cryptodev_pkc_offload(struct cryptodev_pkc *pkc) case DSA_VERIFY: case ECDSA_SIGN: case ECDSA_VERIFY: @@ -28,10 +27,10 @@ index fa0b63f..41acb2c 100644 CRYPTO_ALG_TYPE_PKC_DSA, 0); break; diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h -index 0d65899..33cca2e 100644 +index 4436fbf..275a55c 100644 --- a/crypto/cryptodev.h +++ b/crypto/cryptodev.h -@@ -269,6 +269,8 @@ enum cryptodev_crk_op_t { +@@ -268,6 +268,8 @@ enum cryptodev_crk_op_t { CRK_DSA_SIGN = 2, CRK_DSA_VERIFY = 3, CRK_DH_COMPUTE_KEY = 4, @@ -40,7 +39,7 @@ index 0d65899..33cca2e 100644 CRK_ALGORITHM_ALL }; -@@ -281,7 +283,8 @@ enum cryptodev_crk_op_t { +@@ -280,7 +282,8 @@ enum cryptodev_crk_op_t { #define CRF_DSA_SIGN (1 << CRK_DSA_SIGN) #define CRF_DSA_VERIFY (1 << CRK_DSA_VERIFY) #define CRF_DH_COMPUTE_KEY (1 << CRK_DH_COMPUTE_KEY) @@ -51,10 +50,10 @@ index 0d65899..33cca2e 100644 /* ioctl's. Compatible with old linux cryptodev.h */ diff --git a/ioctl.c b/ioctl.c -index 9f57d46..cc1a2a9 100644 +index 2eb7f03..c813c8c 100644 --- a/ioctl.c +++ b/ioctl.c -@@ -721,6 +721,23 @@ static int crypto_async_fetch_asym(struct cryptodev_pkc *pkc) +@@ -726,6 +726,23 @@ static int crypto_async_fetch_asym(struct cryptodev_pkc *pkc) dh_req->z, dh_req->z_len); } break; @@ -78,7 +77,7 @@ index 9f57d46..cc1a2a9 100644 default: ret = -EINVAL; } -@@ -934,8 +951,9 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) +@@ -939,8 +956,9 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) switch (cmd) { case CIOCASYMFEAT: @@ -90,7 +89,7 @@ index 9f57d46..cc1a2a9 100644 case CRIOGET: fd = clonefd(filp); ret = put_user(fd, p); -@@ -1079,7 +1097,14 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) +@@ -1084,7 +1102,14 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) if (cookie_list.cookie_available) copy_to_user(arg, &cookie_list, sizeof(struct pkc_cookie_list_s)); @@ -209,5 +208,5 @@ index 0b7951e..c901bc7 100644 err: return ret; -- -1.7.9.7 +1.8.3.1 diff --git a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0006-fix-build-error-on-some-targets.patch b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0006-fix-build-error-on-some-targets.patch deleted file mode 100644 index 510dee09..00000000 --- a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0006-fix-build-error-on-some-targets.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 69e00f8c1633dfe6da20ccd0cf363a481c99fc97 Mon Sep 17 00:00:00 2001 -From: Cristian Stoica -Date: Wed, 20 Nov 2013 11:29:50 +0200 -Subject: [[Patch][fsl 06/16] fix build error on some targets - -Upstream-status: Pending - -This updates incomplete patch f681e2e5fd1088bfe0aafd1ae2560c1dc9d04778 -and allows building main.o - -Signed-off-by: Cristian Stoica -Tested-by: Horia Ioan Geanta Neag ---- - cryptlib.c | 4 ++-- - cryptlib.h | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/cryptlib.c b/cryptlib.c -index 2986d09..3576f39 100644 ---- a/cryptlib.c -+++ b/cryptlib.c -@@ -113,7 +113,7 @@ error: - - - int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name, -- uint8_t *keyp, size_t keylen, int stream, int aead) -+ uint8_t *keyp, unsigned int keylen, int stream, int aead) - { - int ret; - -@@ -313,7 +313,7 @@ ssize_t cryptodev_cipher_decrypt(struct cipher_data *cdata, - /* Hash functions */ - - int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name, -- int hmac_mode, void *mackey, size_t mackeylen) -+ int hmac_mode, void *mackey, unsigned int mackeylen) - { - int ret; - -diff --git a/cryptlib.h b/cryptlib.h -index a0a8a63..4cb66ad 100644 ---- a/cryptlib.h -+++ b/cryptlib.h -@@ -23,7 +23,7 @@ struct cipher_data { - }; - - int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name, -- uint8_t *key, size_t keylen, int stream, int aead); -+ uint8_t *key, unsigned int keylen, int stream, int aead); - void cryptodev_cipher_deinit(struct cipher_data *cdata); - int cryptodev_get_cipher_key(uint8_t *key, struct session_op *sop, int aead); - int cryptodev_get_cipher_keylen(unsigned int *keylen, struct session_op *sop, -@@ -87,7 +87,7 @@ ssize_t cryptodev_hash_update(struct hash_data *hdata, - int cryptodev_hash_reset(struct hash_data *hdata); - void cryptodev_hash_deinit(struct hash_data *hdata); - int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name, -- int hmac_mode, void *mackey, size_t mackeylen); -+ int hmac_mode, void *mackey, unsigned int mackeylen); - - - #endif --- -1.7.9.7 - diff --git a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0013-RCU-stall-fixed-in-PKC-asynchronous-interface.patch b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch similarity index 88% rename from meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0013-RCU-stall-fixed-in-PKC-asynchronous-interface.patch rename to meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch index 26c01689..93a2248c 100644 --- a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0013-RCU-stall-fixed-in-PKC-asynchronous-interface.patch +++ b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0007-RCU-stall-fixed-in-PKC-asynchronous-interface.patch @@ -1,21 +1,21 @@ -From 211a494a4f8ee6d5d31a1db938b771958ea32c6b Mon Sep 17 00:00:00 2001 +From d60b9dbf53d63092fd292c00bb03c250c26703cf Mon Sep 17 00:00:00 2001 From: Yashpal Dutta Date: Fri, 7 Mar 2014 08:49:15 +0545 -Subject: [[Patch][fsl 13/16] RCU stall fixed in PKC asynchronous interface +Subject: [PATCH 7/9] RCU stall fixed in PKC asynchronous interface Upstream-status: Pending Signed-off-by: Yashpal Dutta --- - ioctl.c | 23 +++++++++++------------ - main.c | 43 +++++++++++++++++++++++++++---------------- + ioctl.c | 23 +++++++++++------------ + main.c | 43 +++++++++++++++++++++++++++---------------- 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/ioctl.c b/ioctl.c -index cc1a2a9..1752880 100644 +index c813c8c..7e4c671 100644 --- a/ioctl.c +++ b/ioctl.c -@@ -106,10 +106,9 @@ void cryptodev_complete_asym(struct crypto_async_request *req, int err) +@@ -108,10 +108,9 @@ void cryptodev_complete_asym(struct crypto_async_request *req, int err) complete(&res->completion); } else { struct crypt_priv *pcr = pkc->priv; @@ -28,7 +28,7 @@ index cc1a2a9..1752880 100644 /* wake for POLLIN */ wake_up_interruptible(&pcr->user_waiter); } -@@ -953,7 +952,7 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) +@@ -958,7 +957,7 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) case CIOCASYMFEAT: return put_user(CRF_MOD_EXP_CRT | CRF_MOD_EXP | CRF_DSA_SIGN | CRF_DSA_VERIFY | CRF_DH_COMPUTE_KEY | @@ -37,7 +37,7 @@ index cc1a2a9..1752880 100644 case CRIOGET: fd = clonefd(filp); ret = put_user(fd, p); -@@ -992,7 +991,7 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) +@@ -997,7 +996,7 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) case CIOCKEY: { struct cryptodev_pkc *pkc = @@ -46,7 +46,7 @@ index cc1a2a9..1752880 100644 if (!pkc) return -ENOMEM; -@@ -1048,7 +1047,7 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) +@@ -1053,7 +1052,7 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) case CIOCASYMASYNCRYPT: { struct cryptodev_pkc *pkc = @@ -55,7 +55,7 @@ index cc1a2a9..1752880 100644 ret = kop_from_user(&pkc->kop, arg); if (unlikely(ret)) -@@ -1065,13 +1064,12 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) +@@ -1070,13 +1069,12 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) case CIOCASYMFETCHCOOKIE: { struct cryptodev_pkc *pkc; @@ -70,7 +70,7 @@ index cc1a2a9..1752880 100644 if (!list_empty(&pcr->asym_completed_list)) { /* Run a loop in the list for upto elements and copy their response back */ -@@ -1079,6 +1077,7 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) +@@ -1084,6 +1082,7 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) list_first_entry(&pcr->asym_completed_list, struct cryptodev_pkc, list); list_del(&pkc->list); @@ -78,7 +78,7 @@ index cc1a2a9..1752880 100644 ret = crypto_async_fetch_asym(pkc); if (!ret) { cookie_list.cookie_available++; -@@ -1088,10 +1087,10 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) +@@ -1093,10 +1092,10 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) } kfree(pkc); } else { @@ -90,7 +90,7 @@ index cc1a2a9..1752880 100644 /* Reflect the updated request to user-space */ if (cookie_list.cookie_available) -@@ -1381,14 +1380,13 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) +@@ -1386,14 +1385,13 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) case COMPAT_CIOCASYMFETCHCOOKIE: { struct cryptodev_pkc *pkc; @@ -106,7 +106,7 @@ index cc1a2a9..1752880 100644 if (!list_empty(&pcr->asym_completed_list)) { /* Run a loop in the list for upto elements and copy their response back */ -@@ -1396,6 +1394,7 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) +@@ -1401,6 +1399,7 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) list_first_entry(&pcr->asym_completed_list, struct cryptodev_pkc, list); list_del(&pkc->list); @@ -114,7 +114,7 @@ index cc1a2a9..1752880 100644 ret = crypto_async_fetch_asym(pkc); if (!ret) { cookie_list.cookie_available++; -@@ -1404,10 +1403,10 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) +@@ -1409,10 +1408,10 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_) } kfree(pkc); } else { @@ -234,5 +234,5 @@ index c901bc7..2747706 100644 if (!buf) return -ENOMEM; -- -1.7.9.7 +1.8.3.1 diff --git a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0015-Add-RSA-Key-generation-offloading.patch b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0008-Add-RSA-Key-generation-offloading.patch similarity index 88% rename from meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0015-Add-RSA-Key-generation-offloading.patch rename to meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0008-Add-RSA-Key-generation-offloading.patch index a419b58a..affb2e72 100644 --- a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0015-Add-RSA-Key-generation-offloading.patch +++ b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0008-Add-RSA-Key-generation-offloading.patch @@ -1,24 +1,24 @@ -From 1d9c8084a9addaa071ca3e6c14167ebdb2673725 Mon Sep 17 00:00:00 2001 +From af5e4289f60c38ab17adab14c82d6204d155f25f Mon Sep 17 00:00:00 2001 From: Hou Zhiqiang Date: Wed, 19 Mar 2014 14:02:46 +0800 -Subject: [[Patch][fsl 15/16] Add RSA Key generation offloading +Subject: [PATCH 8/9] Add RSA Key generation offloading Upstream-status: Pending Signed-off-by: Hou Zhiqiang Tested-by: Cristian Stoica --- - cryptlib.c | 1 + - crypto/cryptodev.h | 2 ++ - ioctl.c | 3 +- - main.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++- + cryptlib.c | 1 + + crypto/cryptodev.h | 2 ++ + ioctl.c | 3 +- + main.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 84 insertions(+), 2 deletions(-) diff --git a/cryptlib.c b/cryptlib.c -index 41acb2c..89af77a 100644 +index 47cd568..4dd1847 100644 --- a/cryptlib.c +++ b/cryptlib.c -@@ -426,6 +426,7 @@ int cryptodev_pkc_offload(struct cryptodev_pkc *pkc) +@@ -441,6 +441,7 @@ int cryptodev_pkc_offload(struct cryptodev_pkc *pkc) struct pkc_request *pkc_req = &pkc->req, *pkc_requested; switch (pkc_req->type) { @@ -27,10 +27,10 @@ index 41acb2c..89af77a 100644 case RSA_PRIV_FORM1: case RSA_PRIV_FORM2: diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h -index 33cca2e..7990f27 100644 +index 275a55c..d0cc542 100644 --- a/crypto/cryptodev.h +++ b/crypto/cryptodev.h -@@ -271,6 +271,7 @@ enum cryptodev_crk_op_t { +@@ -270,6 +270,7 @@ enum cryptodev_crk_op_t { CRK_DH_COMPUTE_KEY = 4, CRK_DSA_GENERATE_KEY = 5, CRK_DH_GENERATE_KEY = 6, @@ -38,7 +38,7 @@ index 33cca2e..7990f27 100644 CRK_ALGORITHM_ALL }; -@@ -280,6 +281,7 @@ enum cryptodev_crk_op_t { +@@ -279,6 +280,7 @@ enum cryptodev_crk_op_t { */ #define CRF_MOD_EXP (1 << CRK_MOD_EXP) #define CRF_MOD_EXP_CRT (1 << CRK_MOD_EXP_CRT) @@ -47,10 +47,10 @@ index 33cca2e..7990f27 100644 #define CRF_DSA_VERIFY (1 << CRK_DSA_VERIFY) #define CRF_DH_COMPUTE_KEY (1 << CRK_DH_COMPUTE_KEY) diff --git a/ioctl.c b/ioctl.c -index 16ce72c..0344c0c 100644 +index 7e4c671..14888d6 100644 --- a/ioctl.c +++ b/ioctl.c -@@ -954,7 +954,8 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) +@@ -957,7 +957,8 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_) case CIOCASYMFEAT: return put_user(CRF_MOD_EXP_CRT | CRF_MOD_EXP | CRF_DSA_SIGN | CRF_DSA_VERIFY | CRF_DH_COMPUTE_KEY | @@ -166,5 +166,5 @@ index 2747706..14dcf40 100644 err: return ret; -- -1.7.9.7 +1.8.3.1 diff --git a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0008-fix-cipher-algorithm-memleaks.patch b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0008-fix-cipher-algorithm-memleaks.patch deleted file mode 100644 index 995fbed4..00000000 --- a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0008-fix-cipher-algorithm-memleaks.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 9675e358fe73b33029a470aa5cf47527848f4054 Mon Sep 17 00:00:00 2001 -From: Cristian Stoica -Date: Tue, 26 Nov 2013 16:36:37 +0200 -Subject: [[Patch][fsl 08/16] fix cipher algorithm memleaks - -Upstream-status: Pending - -Patch 67e743aef130d107c1b41e0aace7677f9ff53bd1 allocates memory for -cipher algorithm key without freeing it when session terminates. This -patch addresses the deallocation issue. - -Signed-off-by: Cristian Stoica -Tested-by: Horia Ioan Geanta Neag ---- - cryptodev_int.h | 1 + - ioctl.c | 2 ++ - 2 files changed, 3 insertions(+) - -diff --git a/cryptodev_int.h b/cryptodev_int.h -index 8d206c9..8891837 100644 ---- a/cryptodev_int.h -+++ b/cryptodev_int.h -@@ -166,6 +166,7 @@ struct csession { - struct hash_data hdata; - uint32_t sid; - uint32_t alignmask; -+ uint8_t *key; - - unsigned int array_size; - unsigned int used_pages; /* the number of pages that are used */ -diff --git a/ioctl.c b/ioctl.c -index 18874d3..63467e0 100644 ---- a/ioctl.c -+++ b/ioctl.c -@@ -235,6 +235,7 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) - goto error_cipher; - - key = kmalloc(keylen, GFP_KERNEL); -+ ses_new->key = key; - if (unlikely(!key)) { - ret = -ENOMEM; - goto error_cipher; -@@ -342,6 +343,7 @@ crypto_destroy_session(struct csession *ses_ptr) - ddebug(2, "freeing space for %d user pages", ses_ptr->array_size); - kfree(ses_ptr->pages); - kfree(ses_ptr->sg); -+ kfree(ses_ptr->key); - mutex_unlock(&ses_ptr->sem); - mutex_destroy(&ses_ptr->sem); - kfree(ses_ptr); --- -1.7.9.7 - diff --git a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0016-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch similarity index 55% rename from meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0016-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch rename to meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch index d5cc7f04..32757ca9 100644 --- a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0016-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch +++ b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0009-Fixed-compilation-error-of-openssl-with-fsl-cryptode.patch @@ -1,25 +1,48 @@ -From 2215332bff6034d0e22e92e8fda0993f2579a740 Mon Sep 17 00:00:00 2001 +From e791b55b03d295ee11476382a7bd93ab131e2e52 Mon Sep 17 00:00:00 2001 From: Yashpal Dutta Date: Thu, 17 Apr 2014 07:08:47 +0545 -Subject: [[Patch][fsl 16/16] Fixed compilation error of openssl with fsl - cryptodev +Subject: [PATCH 9/9] Fixed compilation error of openssl with fsl cryptodev Upstream-status: Pending Signed-off-by: Yashpal Dutta Tested-by: Cristian Stoica --- - cryptlib.c | 6 +++--- - crypto/cryptodev.h | 9 ++++++++- - cryptodev_int.h | 2 +- - ioctl.c | 6 +++++- - 4 files changed, 17 insertions(+), 6 deletions(-) + authenc.c | 1 + + cryptlib.c | 9 ++++----- + crypto/cryptodev.h | 9 ++++++++- + cryptodev_int.h | 2 +- + ioctl.c | 8 ++++++-- + main.c | 1 + + 6 files changed, 21 insertions(+), 9 deletions(-) +diff --git a/authenc.c b/authenc.c +index ef0d3db..2aa4d38 100644 +--- a/authenc.c ++++ b/authenc.c +@@ -2,6 +2,7 @@ + * Driver for /dev/crypto device (aka CryptoDev) + * + * Copyright (c) 2011, 2012 OpenSSL Software Foundation, Inc. ++ * Copyright (c) 2014 Freescale Semiconductor, Inc. + * + * Author: Nikos Mavrogiannopoulos + * diff --git a/cryptlib.c b/cryptlib.c -index 89af77a..1fc03e5 100644 +index 4dd1847..ec6693e 100644 --- a/cryptlib.c +++ b/cryptlib.c -@@ -129,7 +129,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name, +@@ -4,8 +4,7 @@ + * Copyright (c) 2010,2011 Nikos Mavrogiannopoulos + * Portions Copyright (c) 2010 Michael Weiser + * Portions Copyright (c) 2010 Phil Sutter +- * +- * Copyright 2012 Freescale Semiconductor, Inc. ++ * Copyright 2012-2014 Freescale Semiconductor, Inc. + * + * This file is part of linux cryptodev. + * +@@ -144,7 +143,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name, if (alg->max_keysize > 0 && unlikely((keylen < alg->min_keysize) || (keylen > alg->max_keysize))) { @@ -28,7 +51,7 @@ index 89af77a..1fc03e5 100644 keylen, alg_name, alg->min_keysize, alg->max_keysize); ret = -EINVAL; goto error; -@@ -156,7 +156,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name, +@@ -171,7 +170,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name, } if (unlikely(ret)) { @@ -37,7 +60,7 @@ index 89af77a..1fc03e5 100644 ret = -EINVAL; goto error; } -@@ -323,7 +323,7 @@ int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name, +@@ -338,7 +337,7 @@ int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name, if (hmac_mode != 0) { ret = crypto_ahash_setkey(hdata->async.s, mackey, mackeylen); if (unlikely(ret)) { @@ -47,10 +70,10 @@ index 89af77a..1fc03e5 100644 ret = -EINVAL; goto error; diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h -index 7990f27..77bffc9 100644 +index d0cc542..e7edd97 100644 --- a/crypto/cryptodev.h +++ b/crypto/cryptodev.h -@@ -235,6 +235,13 @@ struct crypt_auth_op { +@@ -234,6 +234,13 @@ struct crypt_auth_op { #define CRYPTO_ALG_FLAG_RNG_ENABLE 2 #define CRYPTO_ALG_FLAG_DSA_SHA 4 @@ -64,7 +87,7 @@ index 7990f27..77bffc9 100644 struct crparam { __u8 *crp_p; __u32 crp_nbits; -@@ -250,7 +257,7 @@ struct crypt_kop { +@@ -249,7 +256,7 @@ struct crypt_kop { __u16 crk_oparams; __u32 crk_pad1; struct crparam crk_param[CRK_MAXPARAM]; @@ -74,7 +97,7 @@ index 7990f27..77bffc9 100644 void *cookie; }; diff --git a/cryptodev_int.h b/cryptodev_int.h -index 7ea6976..e379eaf 100644 +index 5347cae..c83c885 100644 --- a/cryptodev_int.h +++ b/cryptodev_int.h @@ -88,7 +88,7 @@ struct compat_crypt_kop { @@ -87,10 +110,19 @@ index 7ea6976..e379eaf 100644 compat_uptr_t cookie; }; diff --git a/ioctl.c b/ioctl.c -index 0344c0c..66cb05a 100644 +index 14888d6..20ab4ca 100644 --- a/ioctl.c +++ b/ioctl.c -@@ -498,6 +498,7 @@ cryptodev_open(struct inode *inode, struct file *filp) +@@ -4,7 +4,7 @@ + * Copyright (c) 2004 Michal Ludvig , SuSE Labs + * Copyright (c) 2009,2010,2011 Nikos Mavrogiannopoulos + * Copyright (c) 2010 Phil Sutter +- * Copyright 2012 Freescale Semiconductor, Inc. ++ * Copyright 2012-2014 Freescale Semiconductor, Inc. + * + * This file is part of linux cryptodev. + * +@@ -501,6 +501,7 @@ cryptodev_open(struct inode *inode, struct file *filp) INIT_LIST_HEAD(&pcr->done.list); INIT_LIST_HEAD(&pcr->asym_completed_list); spin_lock_init(&pcr->completion_lock); @@ -98,7 +130,7 @@ index 0344c0c..66cb05a 100644 INIT_WORK(&pcr->cryptask, cryptask_routine); init_waitqueue_head(&pcr->user_waiter); -@@ -777,8 +778,11 @@ static int fill_kcop_from_cop(struct kernel_crypt_op *kcop, struct fcrypt *fcr) +@@ -780,8 +781,11 @@ static int fill_kcop_from_cop(struct kernel_crypt_op *kcop, struct fcrypt *fcr) if (cop->iv) { rc = copy_from_user(kcop->iv, cop->iv, kcop->ivlen); @@ -111,6 +143,18 @@ index 0344c0c..66cb05a 100644 } return 0; +diff --git a/main.c b/main.c +index 14dcf40..6365911 100644 +--- a/main.c ++++ b/main.c +@@ -3,6 +3,7 @@ + * + * Copyright (c) 2004 Michal Ludvig , SuSE Labs + * Copyright (c) 2009-2013 Nikos Mavrogiannopoulos ++ * Copyright (c) 2014 Freescale Semiconductor, Inc. + * + * This file is part of linux cryptodev. + * -- -1.7.9.7 +2.2.0 diff --git a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0014-use-static-allocation-for-keys-copied-from-userspace.patch b/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0014-use-static-allocation-for-keys-copied-from-userspace.patch deleted file mode 100644 index c68f3d7c..00000000 --- a/meta-fsl-ppc/recipes-kernel/cryptodev/cryptodev-fsl/0014-use-static-allocation-for-keys-copied-from-userspace.patch +++ /dev/null @@ -1,131 +0,0 @@ -From 50c116780f736b3e6a11389c9d9b3f4a1d5cab90 Mon Sep 17 00:00:00 2001 -From: Cristian Stoica -Date: Wed, 19 Mar 2014 17:59:17 +0200 -Subject: [[Patch][fsl 14/16] use static allocation for keys copied from - userspace - -Upstream-status: Pending - -There is no need to keep keys around for the entire duration of the -session. The keys are copied from user-space and then used to initialize -the ciphers. After this, the original keys can be discarded. -The total required space for keys is small and known in advance. This -patch uses this information to allocate required space on stack. - -Signed-off-by: Cristian Stoica ---- - cryptodev_int.h | 1 - - ioctl.c | 38 ++++++++++++++++++++------------------ - 2 files changed, 20 insertions(+), 19 deletions(-) - -diff --git a/cryptodev_int.h b/cryptodev_int.h -index 8beeef0..7ea6976 100644 ---- a/cryptodev_int.h -+++ b/cryptodev_int.h -@@ -212,7 +212,6 @@ struct csession { - struct hash_data hdata; - uint32_t sid; - uint32_t alignmask; -- uint8_t *key; - - unsigned int array_size; - unsigned int used_pages; /* the number of pages that are used */ -diff --git a/ioctl.c b/ioctl.c -index 1752880..16ce72c 100644 ---- a/ioctl.c -+++ b/ioctl.c -@@ -46,6 +46,8 @@ - #include - #include - #include -+#include -+#include - - #include - -@@ -136,9 +138,17 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) - const char *alg_name = NULL; - const char *hash_name = NULL; - int hmac_mode = 1, stream = 0, aead = 0; -- uint8_t *key = NULL; -- unsigned int keylen; -- uint8_t mackey[CRYPTO_HMAC_MAX_KEY_LEN]; -+ /* -+ * With aead, only ckey is used and it can cover all the struct space; -+ * otherwise both keys may be used simultaneously but they are confined -+ * to their spaces -+ */ -+ struct { -+ uint8_t ckey[CRYPTO_CIPHER_MAX_KEY_LEN]; -+ uint8_t mkey[CRYPTO_HMAC_MAX_KEY_LEN]; -+ /* padding space for aead keys */ -+ uint8_t pad[RTA_SPACE(sizeof(struct crypto_authenc_key_param))]; -+ } keys; - - /* Does the request make sense? */ - if (unlikely(!sop->cipher && !sop->mac)) { -@@ -257,23 +267,17 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) - - /* Set-up crypto transform. */ - if (alg_name) { -+ unsigned int keylen; - ret = cryptodev_get_cipher_keylen(&keylen, sop, aead); - if (unlikely(ret < 0)) - goto error_cipher; - -- key = kmalloc(keylen, GFP_KERNEL); -- ses_new->key = key; -- if (unlikely(!key)) { -- ret = -ENOMEM; -- goto error_cipher; -- } -- -- ret = cryptodev_get_cipher_key(key, sop, aead); -+ ret = cryptodev_get_cipher_key(keys.ckey, sop, aead); - if (unlikely(ret < 0)) - goto error_cipher; - -- ret = cryptodev_cipher_init(&ses_new->cdata, alg_name, key, keylen, -- stream, aead); -+ 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; -@@ -289,14 +293,14 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) - goto error_hash; - } - -- if (sop->mackey && unlikely(copy_from_user(mackey, sop->mackey, -- sop->mackeylen))) { -+ if (sop->mackey && unlikely(copy_from_user(keys.mkey, -+ sop->mackey, sop->mackeylen))) { - ret = -EFAULT; - goto error_hash; - } - - ret = cryptodev_hash_init(&ses_new->hdata, hash_name, hmac_mode, -- mackey, sop->mackeylen); -+ keys.mkey, sop->mackeylen); - if (ret != 0) { - ddebug(1, "Failed to load hash for %s", hash_name); - ret = -EINVAL; -@@ -349,7 +353,6 @@ error_hash: - kfree(ses_new->sg); - kfree(ses_new->pages); - error_cipher: -- kfree(key); - kfree(ses_new); - - return ret; -@@ -370,7 +373,6 @@ crypto_destroy_session(struct csession *ses_ptr) - ddebug(2, "freeing space for %d user pages", ses_ptr->array_size); - kfree(ses_ptr->pages); - kfree(ses_ptr->sg); -- kfree(ses_ptr->key); - mutex_unlock(&ses_ptr->sem); - mutex_destroy(&ses_ptr->sem); - kfree(ses_ptr); --- -1.7.9.7 -