diff options
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.patch | 108 |
1 files changed, 108 insertions, 0 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 new file mode 100644 index 00000000..46b3ced9 --- /dev/null +++ b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0027-cryptodev-put-all-digest-ioctls-into-a-single-functi.patch | |||
@@ -0,0 +1,108 @@ | |||
1 | From 2187b18ffe4851efcb6465ca02ac036d2fe031b8 Mon Sep 17 00:00:00 2001 | ||
2 | From: Cristian Stoica <cristian.stoica@nxp.com> | ||
3 | Date: Tue, 15 Dec 2015 12:23:13 +0200 | ||
4 | Subject: [PATCH 27/48] cryptodev: put all digest ioctls into a single function | ||
5 | |||
6 | Signed-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 | |||
11 | diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c | ||
12 | index 048e050..76faa35 100644 | ||
13 | --- a/crypto/engine/eng_cryptodev.c | ||
14 | +++ b/crypto/engine/eng_cryptodev.c | ||
15 | @@ -1577,13 +1577,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 | @@ -1623,6 +1616,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 | @@ -1632,6 +1626,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 | @@ -1642,43 +1641,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 | -- | ||
107 | 2.7.0 | ||
108 | |||