summaryrefslogtreecommitdiffstats
path: root/recipes-connectivity/openssl/openssl-qoriq/qoriq/0027-cryptodev-put-all-digest-ioctls-into-a-single-functi.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-connectivity/openssl/openssl-qoriq/qoriq/0027-cryptodev-put-all-digest-ioctls-into-a-single-functi.patch')
-rw-r--r--recipes-connectivity/openssl/openssl-qoriq/qoriq/0027-cryptodev-put-all-digest-ioctls-into-a-single-functi.patch108
1 files changed, 0 insertions, 108 deletions
diff --git a/recipes-connectivity/openssl/openssl-qoriq/qoriq/0027-cryptodev-put-all-digest-ioctls-into-a-single-functi.patch b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0027-cryptodev-put-all-digest-ioctls-into-a-single-functi.patch
deleted file mode 100644
index 08108897..00000000
--- a/recipes-connectivity/openssl/openssl-qoriq/qoriq/0027-cryptodev-put-all-digest-ioctls-into-a-single-functi.patch
+++ /dev/null
@@ -1,108 +0,0 @@
1From 0307a70fc4399a0ee758172e385d4daaae669ce6 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Tue, 15 Dec 2015 12:23:13 +0200
4Subject: [PATCH 27/48] cryptodev: put all digest ioctls into a single function
5
6Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
7---
8 crypto/engine/eng_cryptodev.c | 44 +++++++++++++++++++------------------------
9 1 file changed, 19 insertions(+), 25 deletions(-)
10
11diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c
12index a8652bf..8b8710a 100644
13--- a/crypto/engine/eng_cryptodev.c
14+++ b/crypto/engine/eng_cryptodev.c
15@@ -1578,13 +1578,6 @@ static int cryptodev_digest_init(EVP_MD_CTX *ctx)
16 sess->mackeylen = digest_key_length(ctx->digest->type);
17 sess->mac = digest;
18
19- if (ioctl(state->d_fd, CIOCGSESSION, sess) < 0) {
20- put_dev_crypto(state->d_fd);
21- state->d_fd = -1;
22- printf("cryptodev_digest_init: Open session failed\n");
23- return (0);
24- }
25-
26 return (1);
27 }
28
29@@ -1624,6 +1617,7 @@ static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data,
30
31 static int cryptodev_digest_final(EVP_MD_CTX *ctx, unsigned char *md)
32 {
33+ int ret = 1;
34 struct crypt_op cryp;
35 struct dev_crypto_state *state = ctx->md_data;
36 struct session_op *sess = &state->d_sess;
37@@ -1633,6 +1627,11 @@ static int cryptodev_digest_final(EVP_MD_CTX *ctx, unsigned char *md)
38 return (0);
39 }
40
41+ if (ioctl(state->d_fd, CIOCGSESSION, sess) < 0) {
42+ printf("cryptodev_digest_init: Open session failed\n");
43+ return (0);
44+ }
45+
46 memset(&cryp, 0, sizeof(cryp));
47
48 cryp.ses = sess->ses;
49@@ -1643,43 +1642,38 @@ static int cryptodev_digest_final(EVP_MD_CTX *ctx, unsigned char *md)
50
51 if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) {
52 printf("cryptodev_digest_final: digest failed\n");
53- return (0);
54+ ret = 0;
55 }
56
57- return (1);
58+ if (ioctl(state->d_fd, CIOCFSESSION, &sess->ses) < 0) {
59+ printf("cryptodev_digest_cleanup: failed to close session\n");
60+ }
61+
62+ return ret;
63 }
64
65 static int cryptodev_digest_cleanup(EVP_MD_CTX *ctx)
66 {
67- int ret = 1;
68 struct dev_crypto_state *state = ctx->md_data;
69 struct session_op *sess = &state->d_sess;
70
71- if (state == NULL)
72+ if (state == NULL) {
73 return 0;
74-
75- if (state->d_fd < 0) {
76- printf("cryptodev_digest_cleanup: illegal input\n");
77- return (0);
78 }
79
80 if (!(ctx->flags & EVP_MD_CTX_FLAG_ONESHOT)) {
81 OPENSSL_free(state->mac_data);
82 }
83- state->mac_data = NULL;
84- state->mac_len = 0;
85
86- if (ioctl(state->d_fd, CIOCFSESSION, &sess->ses) < 0) {
87- printf("cryptodev_digest_cleanup: failed to close session\n");
88- ret = 0;
89- } else {
90- ret = 1;
91+ if (state->d_fd >= 0) {
92+ put_dev_crypto(state->d_fd);
93+ state->d_fd = -1;
94 }
95
96- put_dev_crypto(state->d_fd);
97- state->d_fd = -1;
98+ state->mac_data = NULL;
99+ state->mac_len = 0;
100
101- return (ret);
102+ return 1;
103 }
104
105 static int cryptodev_digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from)
106--
1072.7.3
108