summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/cryptodev/cryptodev-fsl/0002-use-function-local-storage-for-cipher-and-hmac-keys.patch
diff options
context:
space:
mode:
authorZhenhua Luo <zhenhua.luo@freescale.com>2014-06-14 14:38:18 +0800
committerZhenhua Luo <zhenhua.luo@freescale.com>2014-07-11 13:35:10 +0800
commit639cc0b816cb2fe8941879bf311699e5febe6f77 (patch)
treef390906896f46b059704d2d12ab365565266cb17 /recipes-kernel/cryptodev/cryptodev-fsl/0002-use-function-local-storage-for-cipher-and-hmac-keys.patch
parentb145a013cbbcdc11832d0d9c6a3a71a52d91a5c3 (diff)
downloadmeta-fsl-ppc-639cc0b816cb2fe8941879bf311699e5febe6f77.tar.gz
cryptodev-linux/module: use fsl maintained source
FSL SDK released its own cryptodev based on 1.6, but not all the codes was upstreamed, add bbappend to use fsl maintained source. This change only be applied for fsl machines Signed-off-by: Zhenhua Luo <zhenhua.luo@freescale.com> Signed-off-by: Ting Liu <b28495@freescale.com>
Diffstat (limited to 'recipes-kernel/cryptodev/cryptodev-fsl/0002-use-function-local-storage-for-cipher-and-hmac-keys.patch')
-rw-r--r--recipes-kernel/cryptodev/cryptodev-fsl/0002-use-function-local-storage-for-cipher-and-hmac-keys.patch87
1 files changed, 87 insertions, 0 deletions
diff --git a/recipes-kernel/cryptodev/cryptodev-fsl/0002-use-function-local-storage-for-cipher-and-hmac-keys.patch b/recipes-kernel/cryptodev/cryptodev-fsl/0002-use-function-local-storage-for-cipher-and-hmac-keys.patch
new file mode 100644
index 0000000..4702fd4
--- /dev/null
+++ b/recipes-kernel/cryptodev/cryptodev-fsl/0002-use-function-local-storage-for-cipher-and-hmac-keys.patch
@@ -0,0 +1,87 @@
1From cc65307405a21c3b709ca6f2a6f64ff0c67c0eed Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@freescale.com>
3Date: Wed, 18 Sep 2013 13:42:31 +0300
4Subject: [[Patch][fsl 02/16] use function-local storage for cipher and hmac
5 keys
6
7Upstream-status: Pending
8
9This refactorization is necessary for next patches that add support for
10aead composite ciphers where the aead key is the sum of cipher and hmac
11keys.
12
13Without this patch, the hmac and cipher keys can't be combined in the
14same ioctl.
15
16Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
17Tested-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com>
18---
19 ioctl.c | 14 ++++++--------
20 1 file changed, 6 insertions(+), 8 deletions(-)
21
22diff --git a/ioctl.c b/ioctl.c
23index a0f1db1..c614373 100644
24--- a/ioctl.c
25+++ b/ioctl.c
26@@ -109,6 +109,8 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
27 const char *alg_name = NULL;
28 const char *hash_name = NULL;
29 int hmac_mode = 1, stream = 0, aead = 0;
30+ uint8_t enckey[CRYPTO_CIPHER_MAX_KEY_LEN];
31+ uint8_t mackey[CRYPTO_HMAC_MAX_KEY_LEN];
32
33 /* Does the request make sense? */
34 if (unlikely(!sop->cipher && !sop->mac)) {
35@@ -227,8 +229,6 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
36
37 /* Set-up crypto transform. */
38 if (alg_name) {
39- uint8_t keyp[CRYPTO_CIPHER_MAX_KEY_LEN];
40-
41 if (unlikely(sop->keylen > CRYPTO_CIPHER_MAX_KEY_LEN)) {
42 ddebug(1, "Setting key failed for %s-%zu.",
43 alg_name, (size_t)sop->keylen*8);
44@@ -236,12 +236,12 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
45 goto error_cipher;
46 }
47
48- if (unlikely(copy_from_user(keyp, sop->key, sop->keylen))) {
49+ if (unlikely(copy_from_user(enckey, sop->key, sop->keylen))) {
50 ret = -EFAULT;
51 goto error_cipher;
52 }
53
54- ret = cryptodev_cipher_init(&ses_new->cdata, alg_name, keyp,
55+ ret = cryptodev_cipher_init(&ses_new->cdata, alg_name, enckey,
56 sop->keylen, stream, aead);
57 if (ret < 0) {
58 ddebug(1, "Failed to load cipher for %s", alg_name);
59@@ -251,8 +251,6 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
60 }
61
62 if (hash_name && aead == 0) {
63- uint8_t keyp[CRYPTO_HMAC_MAX_KEY_LEN];
64-
65 if (unlikely(sop->mackeylen > CRYPTO_HMAC_MAX_KEY_LEN)) {
66 ddebug(1, "Setting key failed for %s-%zu.",
67 hash_name, (size_t)sop->mackeylen*8);
68@@ -260,14 +258,14 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
69 goto error_hash;
70 }
71
72- if (sop->mackey && unlikely(copy_from_user(keyp, sop->mackey,
73+ if (sop->mackey && unlikely(copy_from_user(mackey, sop->mackey,
74 sop->mackeylen))) {
75 ret = -EFAULT;
76 goto error_hash;
77 }
78
79 ret = cryptodev_hash_init(&ses_new->hdata, hash_name, hmac_mode,
80- keyp, sop->mackeylen);
81+ mackey, sop->mackeylen);
82 if (ret != 0) {
83 ddebug(1, "Failed to load hash for %s", hash_name);
84 ret = -EINVAL;
85--
861.7.9.7
87