summaryrefslogtreecommitdiffstats
path: root/recipes-connectivity/openssl/openssl-qoriq/qoriq/0020-cryptodev-clean-up-code-layout.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-connectivity/openssl/openssl-qoriq/qoriq/0020-cryptodev-clean-up-code-layout.patch')
-rw-r--r--recipes-connectivity/openssl/openssl-qoriq/qoriq/0020-cryptodev-clean-up-code-layout.patch73
1 files changed, 73 insertions, 0 deletions
diff --git a/recipes-connectivity/openssl/openssl-qoriq/qoriq/0020-cryptodev-clean-up-code-layout.patch b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0020-cryptodev-clean-up-code-layout.patch
new file mode 100644
index 00000000..c600bdab
--- /dev/null
+++ b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0020-cryptodev-clean-up-code-layout.patch
@@ -0,0 +1,73 @@
1From 453c617b10fb2c4e748b5799ab4b00c184470c60 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@freescale.com>
3Date: Wed, 18 Feb 2015 10:39:46 +0200
4Subject: [PATCH 20/48] cryptodev: clean-up code layout
5
6This is just a refactoring that uses else branch to check for malloc failures
7
8Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
9---
10 crypto/engine/eng_cryptodev.c | 45 ++++++++++++++++++++-----------------------
11 1 file changed, 21 insertions(+), 24 deletions(-)
12
13diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c
14index bbc903b..14dcddf 100644
15--- a/crypto/engine/eng_cryptodev.c
16+++ b/crypto/engine/eng_cryptodev.c
17@@ -1865,32 +1865,29 @@ cryptodev_asym_async(struct crypt_kop *kop, int rlen, BIGNUM *r, int slen,
18 fd = *(int *)cookie->eng_handle;
19
20 eng_cookie = malloc(sizeof(struct cryptodev_cookie_s));
21-
22- if (eng_cookie) {
23- memset(eng_cookie, 0, sizeof(struct cryptodev_cookie_s));
24- if (r) {
25- kop->crk_param[kop->crk_iparams].crp_p =
26- calloc(rlen, sizeof(char));
27- if (!kop->crk_param[kop->crk_iparams].crp_p)
28- return -ENOMEM;
29- kop->crk_param[kop->crk_iparams].crp_nbits = rlen * 8;
30- kop->crk_oparams++;
31- eng_cookie->r = r;
32- eng_cookie->r_param = kop->crk_param[kop->crk_iparams];
33- }
34- if (s) {
35- kop->crk_param[kop->crk_iparams + 1].crp_p =
36- calloc(slen, sizeof(char));
37- if (!kop->crk_param[kop->crk_iparams + 1].crp_p)
38- return -ENOMEM;
39- kop->crk_param[kop->crk_iparams + 1].crp_nbits = slen * 8;
40- kop->crk_oparams++;
41- eng_cookie->s = s;
42- eng_cookie->s_param = kop->crk_param[kop->crk_iparams + 1];
43- }
44- } else
45+ if (!eng_cookie)
46 return -ENOMEM;
47
48+ memset(eng_cookie, 0, sizeof(struct cryptodev_cookie_s));
49+ if (r) {
50+ kop->crk_param[kop->crk_iparams].crp_p = calloc(rlen, sizeof(char));
51+ if (!kop->crk_param[kop->crk_iparams].crp_p)
52+ return -ENOMEM;
53+ kop->crk_param[kop->crk_iparams].crp_nbits = rlen * 8;
54+ kop->crk_oparams++;
55+ eng_cookie->r = r;
56+ eng_cookie->r_param = kop->crk_param[kop->crk_iparams];
57+ }
58+ if (s) {
59+ kop->crk_param[kop->crk_iparams + 1].crp_p =
60+ calloc(slen, sizeof(char));
61+ if (!kop->crk_param[kop->crk_iparams + 1].crp_p)
62+ return -ENOMEM;
63+ kop->crk_param[kop->crk_iparams + 1].crp_nbits = slen * 8;
64+ kop->crk_oparams++;
65+ eng_cookie->s = s;
66+ eng_cookie->s_param = kop->crk_param[kop->crk_iparams + 1];
67+ }
68 eng_cookie->kop = kop;
69 cookie->eng_cookie = eng_cookie;
70 return ioctl(fd, CIOCASYMASYNCRYPT, kop);
71--
722.7.0
73