aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe.montjoie@gmail.com>2016-08-31 08:02:58 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2016-09-07 09:08:27 -0400
commit4cba7cf025f35599f8de3282c8a7278ecc43eea4 (patch)
tree01467e06408825abc6bc9b370b575d7b21774a5d /include/crypto
parent2589ad84047f1dbed741b48785680b152db2e5db (diff)
crypto: engine - permit to enqueue ashash_request
The current crypto engine allow only ablkcipher_request to be enqueued. Thus denying any use of it for hardware that also handle hash algo. This patch modify the API for allowing to enqueue ciphers and hash. Since omap-aes/omap-des are the only users, this patch also convert them to the new cryptoengine API. Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto')
-rw-r--r--include/crypto/engine.h49
1 files changed, 33 insertions, 16 deletions
diff --git a/include/crypto/engine.h b/include/crypto/engine.h
index 40899bd246ec..04eb5c77addd 100644
--- a/include/crypto/engine.h
+++ b/include/crypto/engine.h
@@ -17,6 +17,7 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/kthread.h> 18#include <linux/kthread.h>
19#include <crypto/algapi.h> 19#include <crypto/algapi.h>
20#include <crypto/hash.h>
20 21
21#define ENGINE_NAME_LEN 30 22#define ENGINE_NAME_LEN 30
22/* 23/*
@@ -36,9 +37,12 @@
36 * @unprepare_crypt_hardware: there are currently no more requests on the 37 * @unprepare_crypt_hardware: there are currently no more requests on the
37 * queue so the subsystem notifies the driver that it may relax the 38 * queue so the subsystem notifies the driver that it may relax the
38 * hardware by issuing this call 39 * hardware by issuing this call
39 * @prepare_request: do some prepare if need before handle the current request 40 * @prepare_cipher_request: do some prepare if need before handle the current request
40 * @unprepare_request: undo any work done by prepare_message() 41 * @unprepare_cipher_request: undo any work done by prepare_cipher_request()
41 * @crypt_one_request: do encryption for current request 42 * @cipher_one_request: do encryption for current request
43 * @prepare_hash_request: do some prepare if need before handle the current request
44 * @unprepare_hash_request: undo any work done by prepare_hash_request()
45 * @hash_one_request: do hash for current request
42 * @kworker: thread struct for request pump 46 * @kworker: thread struct for request pump
43 * @kworker_task: pointer to task for request pump kworker thread 47 * @kworker_task: pointer to task for request pump kworker thread
44 * @pump_requests: work struct for scheduling work to the request pump 48 * @pump_requests: work struct for scheduling work to the request pump
@@ -61,27 +65,40 @@ struct crypto_engine {
61 int (*prepare_crypt_hardware)(struct crypto_engine *engine); 65 int (*prepare_crypt_hardware)(struct crypto_engine *engine);
62 int (*unprepare_crypt_hardware)(struct crypto_engine *engine); 66 int (*unprepare_crypt_hardware)(struct crypto_engine *engine);
63 67
64 int (*prepare_request)(struct crypto_engine *engine, 68 int (*prepare_cipher_request)(struct crypto_engine *engine,
65 struct ablkcipher_request *req); 69 struct ablkcipher_request *req);
66 int (*unprepare_request)(struct crypto_engine *engine, 70 int (*unprepare_cipher_request)(struct crypto_engine *engine,
67 struct ablkcipher_request *req); 71 struct ablkcipher_request *req);
68 int (*crypt_one_request)(struct crypto_engine *engine, 72 int (*prepare_hash_request)(struct crypto_engine *engine,
69 struct ablkcipher_request *req); 73 struct ahash_request *req);
74 int (*unprepare_hash_request)(struct crypto_engine *engine,
75 struct ahash_request *req);
76 int (*cipher_one_request)(struct crypto_engine *engine,
77 struct ablkcipher_request *req);
78 int (*hash_one_request)(struct crypto_engine *engine,
79 struct ahash_request *req);
70 80
71 struct kthread_worker kworker; 81 struct kthread_worker kworker;
72 struct task_struct *kworker_task; 82 struct task_struct *kworker_task;
73 struct kthread_work pump_requests; 83 struct kthread_work pump_requests;
74 84
75 void *priv_data; 85 void *priv_data;
76 struct ablkcipher_request *cur_req; 86 struct crypto_async_request *cur_req;
77}; 87};
78 88
79int crypto_transfer_request(struct crypto_engine *engine, 89int crypto_transfer_cipher_request(struct crypto_engine *engine,
80 struct ablkcipher_request *req, bool need_pump); 90 struct ablkcipher_request *req,
81int crypto_transfer_request_to_engine(struct crypto_engine *engine, 91 bool need_pump);
82 struct ablkcipher_request *req); 92int crypto_transfer_cipher_request_to_engine(struct crypto_engine *engine,
83void crypto_finalize_request(struct crypto_engine *engine, 93 struct ablkcipher_request *req);
84 struct ablkcipher_request *req, int err); 94int crypto_transfer_hash_request(struct crypto_engine *engine,
95 struct ahash_request *req, bool need_pump);
96int crypto_transfer_hash_request_to_engine(struct crypto_engine *engine,
97 struct ahash_request *req);
98void crypto_finalize_cipher_request(struct crypto_engine *engine,
99 struct ablkcipher_request *req, int err);
100void crypto_finalize_hash_request(struct crypto_engine *engine,
101 struct ahash_request *req, int err);
85int crypto_engine_start(struct crypto_engine *engine); 102int crypto_engine_start(struct crypto_engine *engine);
86int crypto_engine_stop(struct crypto_engine *engine); 103int crypto_engine_stop(struct crypto_engine *engine);
87struct crypto_engine *crypto_engine_alloc_init(struct device *dev, bool rt); 104struct crypto_engine *crypto_engine_alloc_init(struct device *dev, bool rt);