summaryrefslogtreecommitdiffstats
path: root/recipes-connectivity/openssl/openssl-qoriq/qoriq/0029-cryptodev-use-CIOCHASH-ioctl-for-digest-operations.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-connectivity/openssl/openssl-qoriq/qoriq/0029-cryptodev-use-CIOCHASH-ioctl-for-digest-operations.patch')
-rw-r--r--recipes-connectivity/openssl/openssl-qoriq/qoriq/0029-cryptodev-use-CIOCHASH-ioctl-for-digest-operations.patch91
1 files changed, 91 insertions, 0 deletions
diff --git a/recipes-connectivity/openssl/openssl-qoriq/qoriq/0029-cryptodev-use-CIOCHASH-ioctl-for-digest-operations.patch b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0029-cryptodev-use-CIOCHASH-ioctl-for-digest-operations.patch
new file mode 100644
index 0000000..3dc2b92
--- /dev/null
+++ b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0029-cryptodev-use-CIOCHASH-ioctl-for-digest-operations.patch
@@ -0,0 +1,91 @@
1From 3fe44ab50a87106af3349148e81ec8a1d524de82 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Tue, 15 Dec 2015 15:43:28 +0200
4Subject: [PATCH 29/48] cryptodev: use CIOCHASH ioctl for digest operations
5
6Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
7---
8 crypto/engine/eng_cryptodev.c | 34 +++++++++++-----------------------
9 1 file changed, 11 insertions(+), 23 deletions(-)
10
11diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c
12index 1585009..dc27b55 100644
13--- a/crypto/engine/eng_cryptodev.c
14+++ b/crypto/engine/eng_cryptodev.c
15@@ -84,6 +84,7 @@ struct dev_crypto_state {
16 unsigned char *iv;
17 int ivlen;
18 # ifdef USE_CRYPTODEV_DIGESTS
19+ struct hash_op_data hash_op;
20 char dummy_mac_key[HASH_MAX_LEN];
21 unsigned char digest_res[HASH_MAX_LEN];
22 char *mac_data;
23@@ -1556,7 +1557,7 @@ static int digest_key_length(int nid)
24 static int cryptodev_digest_init(EVP_MD_CTX *ctx)
25 {
26 struct dev_crypto_state *state = ctx->md_data;
27- struct session_op *sess = &state->d_sess;
28+ struct hash_op_data *hash_op = &state->hash_op;
29 int digest;
30
31 memset(state, 0, sizeof(struct dev_crypto_state));
32@@ -1573,9 +1574,9 @@ static int cryptodev_digest_init(EVP_MD_CTX *ctx)
33 return (0);
34 }
35
36- sess->mackey = state->dummy_mac_key;
37- sess->mackeylen = digest_key_length(ctx->digest->type);
38- sess->mac = digest;
39+ hash_op->mac_op = digest;
40+ hash_op->mackey = state->dummy_mac_key;
41+ hash_op->mackeylen = digest_key_length(ctx->digest->type);
42
43 return (1);
44 }
45@@ -1617,37 +1618,24 @@ static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data,
46 static int cryptodev_digest_final(EVP_MD_CTX *ctx, unsigned char *md)
47 {
48 int ret = 1;
49- struct crypt_op cryp;
50 struct dev_crypto_state *state = ctx->md_data;
51- struct session_op *sess = &state->d_sess;
52+ struct hash_op_data *hash_op = &state->hash_op;
53
54 if (!md || state->d_fd < 0) {
55 printf("%s: illegal input\n", __func__);
56 return (0);
57 }
58
59- if (ioctl(state->d_fd, CIOCGSESSION, sess) < 0) {
60- printf("%s: Open session failed\n", __func__);
61- return (0);
62- }
63-
64- memset(&cryp, 0, sizeof(cryp));
65+ hash_op->flags = 0;
66+ hash_op->len = state->mac_len;
67+ hash_op->src = state->mac_data;
68+ hash_op->mac_result = md;
69
70- cryp.ses = sess->ses;
71- cryp.flags = 0;
72- cryp.len = state->mac_len;
73- cryp.src = state->mac_data;
74- cryp.mac = md;
75-
76- if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) {
77+ if (ioctl(state->d_fd, CIOCHASH, hash_op) < 0) {
78 printf("%s: digest failed\n", __func__);
79 ret = 0;
80 }
81
82- if (ioctl(state->d_fd, CIOCFSESSION, &sess->ses) < 0) {
83- printf("%s: failed to close session\n", __func__);
84- }
85-
86 return ret;
87 }
88
89--
902.7.0
91