aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-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);