summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/cryptodev/sdk_patches/0030-remove-code-duplication-in-cryptodev_hash_init.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/cryptodev/sdk_patches/0030-remove-code-duplication-in-cryptodev_hash_init.patch')
-rw-r--r--recipes-kernel/cryptodev/sdk_patches/0030-remove-code-duplication-in-cryptodev_hash_init.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/recipes-kernel/cryptodev/sdk_patches/0030-remove-code-duplication-in-cryptodev_hash_init.patch b/recipes-kernel/cryptodev/sdk_patches/0030-remove-code-duplication-in-cryptodev_hash_init.patch
new file mode 100644
index 0000000..1e3ebf3
--- /dev/null
+++ b/recipes-kernel/cryptodev/sdk_patches/0030-remove-code-duplication-in-cryptodev_hash_init.patch
@@ -0,0 +1,59 @@
1From f4534df637b078fce275763bd8bc2a83bfad25e0 Mon Sep 17 00:00:00 2001
2From: Cristian Stoica <cristian.stoica@nxp.com>
3Date: Mon, 11 Jan 2016 18:01:06 +0200
4Subject: [PATCH 30/38] remove code duplication in cryptodev_hash_init
5
6cryptodev_hash_init is concerned mostly with allocating data structures
7for hash operations.
8This patch replaces the call it makes to crypto_ahash_init with
9one to cryptodev_hash_reset to avoid code duplication. This call is made
10now outside of the original function to increase modularity.
11
12Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
13---
14 cryptlib.c | 9 ---------
15 ioctl.c | 5 +++++
16 2 files changed, 5 insertions(+), 9 deletions(-)
17
18diff --git a/cryptlib.c b/cryptlib.c
19index eba4616..4fd29eb 100644
20--- a/cryptlib.c
21+++ b/cryptlib.c
22@@ -362,18 +362,9 @@ int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name,
23
24 ahash_request_set_callback(hdata->async.request, 0,
25 cryptodev_complete, hdata->async.result);
26-
27- ret = crypto_ahash_init(hdata->async.request);
28- if (unlikely(ret)) {
29- derr(0, "error in crypto_hash_init()");
30- goto error_request;
31- }
32-
33 hdata->init = 1;
34 return 0;
35
36-error_request:
37- ahash_request_free(hdata->async.request);
38 error:
39 kfree(hdata->async.result);
40 crypto_free_ahash(hdata->async.s);
41diff --git a/ioctl.c b/ioctl.c
42index b36dd03..a537886 100644
43--- a/ioctl.c
44+++ b/ioctl.c
45@@ -338,6 +338,11 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
46 ret = -EINVAL;
47 goto session_error;
48 }
49+
50+ ret = cryptodev_hash_reset(&ses_new->hdata);
51+ if (ret != 0) {
52+ goto session_error;
53+ }
54 }
55
56 ses_new->alignmask = max(ses_new->cdata.alignmask,
57--
582.7.0
59