aboutsummaryrefslogtreecommitdiffstats
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 @@
+From 4453b06b940fc03a0973cfd96f908e46cce61054 Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica@freescale.com>
+Date: Wed, 18 Feb 2015 10:39:46 +0200
+Subject: [PATCH 23/26] cryptodev: clean-up code layout
+
+This is just a refactoring that uses else branch to check for malloc failures
+
+Change-Id: I6dc157af36d6ec51a4edfc82cf97fae2e7e83628
+Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
+Reviewed-on: http://git.am.freescale.net:8181/34218
+---
+ crypto/engine/eng_cryptodev.c | 42 ++++++++++++++++++++----------------------
+ 1 file changed, 20 insertions(+), 22 deletions(-)
+
+diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c
+index dbc5989..dceb4f5 100644
+--- a/crypto/engine/eng_cryptodev.c
++++ b/crypto/engine/eng_cryptodev.c
+@@ -1745,30 +1745,28 @@ cryptodev_asym_async(struct crypt_kop *kop, int rlen, BIGNUM *r, int slen,
+ fd = *(int *)cookie->eng_handle;
+
+ eng_cookie = malloc(sizeof(struct cryptodev_cookie_s));
+-
+- if (eng_cookie) {
+- memset(eng_cookie, 0, sizeof(struct cryptodev_cookie_s));
+- if (r) {
+- kop->crk_param[kop->crk_iparams].crp_p = calloc(rlen, sizeof(char));
+- if (!kop->crk_param[kop->crk_iparams].crp_p)
+- return -ENOMEM;
+- kop->crk_param[kop->crk_iparams].crp_nbits = rlen * 8;
+- kop->crk_oparams++;
+- eng_cookie->r = r;
+- eng_cookie->r_param = kop->crk_param[kop->crk_iparams];
+- }
+- if (s) {
+- kop->crk_param[kop->crk_iparams+1].crp_p = calloc(slen, sizeof(char));
+- if (!kop->crk_param[kop->crk_iparams+1].crp_p)
+- return -ENOMEM;
+- kop->crk_param[kop->crk_iparams+1].crp_nbits = slen * 8;
+- kop->crk_oparams++;
+- eng_cookie->s = s;
+- eng_cookie->s_param = kop->crk_param[kop->crk_iparams + 1];
+- }
+- } else
++ if (!eng_cookie)
+ return -ENOMEM;
+
++ memset(eng_cookie, 0, sizeof(struct cryptodev_cookie_s));
++ if (r) {
++ kop->crk_param[kop->crk_iparams].crp_p = calloc(rlen, sizeof(char));
++ if (!kop->crk_param[kop->crk_iparams].crp_p)
++ return -ENOMEM;
++ kop->crk_param[kop->crk_iparams].crp_nbits = rlen * 8;
++ kop->crk_oparams++;
++ eng_cookie->r = r;
++ eng_cookie->r_param = kop->crk_param[kop->crk_iparams];
++ }
++ if (s) {
++ kop->crk_param[kop->crk_iparams+1].crp_p = calloc(slen, sizeof(char));
++ if (!kop->crk_param[kop->crk_iparams+1].crp_p)
++ return -ENOMEM;
++ kop->crk_param[kop->crk_iparams+1].crp_nbits = slen * 8;
++ kop->crk_oparams++;
++ eng_cookie->s = s;
++ eng_cookie->s_param = kop->crk_param[kop->crk_iparams + 1];
++ }
+ eng_cookie->kop = kop;
+ cookie->eng_cookie = eng_cookie;
+ return ioctl(fd, CIOCASYMASYNCRYPT, kop);
+--
+2.3.5
+