summaryrefslogtreecommitdiffstats
path: root/recipes-connectivity/openssl/openssl-qoriq/qoriq/0023-cryptodev-clean-up-code-layout.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-connectivity/openssl/openssl-qoriq/qoriq/0023-cryptodev-clean-up-code-layout.patch')
-rw-r--r--recipes-connectivity/openssl/openssl-qoriq/qoriq/0023-cryptodev-clean-up-code-layout.patch72
1 files changed, 72 insertions, 0 deletions
diff --git a/recipes-connectivity/openssl/openssl-qoriq/qoriq/0023-cryptodev-clean-up-code-layout.patch b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0023-cryptodev-clean-up-code-layout.patch
new file mode 100644
index 0000000..5ff1c5c
--- /dev/null
+++ b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0023-cryptodev-clean-up-code-layout.patch
@@ -0,0 +1,72 @@
1From 4453b06b940fc03a0973cfd96f908e46cce61054 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 23/26] cryptodev: clean-up code layout
5
6This is just a refactoring that uses else branch to check for malloc failures
7
8Change-Id: I6dc157af36d6ec51a4edfc82cf97fae2e7e83628
9Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
10Reviewed-on: http://git.am.freescale.net:8181/34218
11---
12 crypto/engine/eng_cryptodev.c | 42 ++++++++++++++++++++----------------------
13 1 file changed, 20 insertions(+), 22 deletions(-)
14
15diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c
16index dbc5989..dceb4f5 100644
17--- a/crypto/engine/eng_cryptodev.c
18+++ b/crypto/engine/eng_cryptodev.c
19@@ -1745,30 +1745,28 @@ cryptodev_asym_async(struct crypt_kop *kop, int rlen, BIGNUM *r, int slen,
20 fd = *(int *)cookie->eng_handle;
21
22 eng_cookie = malloc(sizeof(struct cryptodev_cookie_s));
23-
24- if (eng_cookie) {
25- memset(eng_cookie, 0, sizeof(struct cryptodev_cookie_s));
26- if (r) {
27- kop->crk_param[kop->crk_iparams].crp_p = calloc(rlen, sizeof(char));
28- if (!kop->crk_param[kop->crk_iparams].crp_p)
29- return -ENOMEM;
30- kop->crk_param[kop->crk_iparams].crp_nbits = rlen * 8;
31- kop->crk_oparams++;
32- eng_cookie->r = r;
33- eng_cookie->r_param = kop->crk_param[kop->crk_iparams];
34- }
35- if (s) {
36- kop->crk_param[kop->crk_iparams+1].crp_p = 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 = calloc(slen, sizeof(char));
60+ if (!kop->crk_param[kop->crk_iparams+1].crp_p)
61+ return -ENOMEM;
62+ kop->crk_param[kop->crk_iparams+1].crp_nbits = slen * 8;
63+ kop->crk_oparams++;
64+ eng_cookie->s = s;
65+ eng_cookie->s_param = kop->crk_param[kop->crk_iparams + 1];
66+ }
67 eng_cookie->kop = kop;
68 cookie->eng_cookie = eng_cookie;
69 return ioctl(fd, CIOCASYMASYNCRYPT, kop);
70--
712.3.5
72