1 /* SPDX-License-Identifier: GPL-2.0-or-later */
5 * Copyright (c) 2016 Baolin Wang <baolin.wang@linaro.org>
7 #ifndef _CRYPTO_ENGINE_H
8 #define _CRYPTO_ENGINE_H
10 #include <linux/types.h>
14 struct akcipher_request;
18 struct skcipher_request;
21 * struct crypto_engine_op - crypto hardware engine operations
22 * @do_one_request: do encryption for current request
24 struct crypto_engine_op {
25 int (*do_one_request)(struct crypto_engine *engine,
29 struct crypto_engine_ctx {
30 struct crypto_engine_op op;
33 int crypto_transfer_aead_request_to_engine(struct crypto_engine *engine,
34 struct aead_request *req);
35 int crypto_transfer_akcipher_request_to_engine(struct crypto_engine *engine,
36 struct akcipher_request *req);
37 int crypto_transfer_hash_request_to_engine(struct crypto_engine *engine,
38 struct ahash_request *req);
39 int crypto_transfer_kpp_request_to_engine(struct crypto_engine *engine,
40 struct kpp_request *req);
41 int crypto_transfer_skcipher_request_to_engine(struct crypto_engine *engine,
42 struct skcipher_request *req);
43 void crypto_finalize_aead_request(struct crypto_engine *engine,
44 struct aead_request *req, int err);
45 void crypto_finalize_akcipher_request(struct crypto_engine *engine,
46 struct akcipher_request *req, int err);
47 void crypto_finalize_hash_request(struct crypto_engine *engine,
48 struct ahash_request *req, int err);
49 void crypto_finalize_kpp_request(struct crypto_engine *engine,
50 struct kpp_request *req, int err);
51 void crypto_finalize_skcipher_request(struct crypto_engine *engine,
52 struct skcipher_request *req, int err);
53 int crypto_engine_start(struct crypto_engine *engine);
54 int crypto_engine_stop(struct crypto_engine *engine);
55 struct crypto_engine *crypto_engine_alloc_init(struct device *dev, bool rt);
56 struct crypto_engine *crypto_engine_alloc_init_and_set(struct device *dev,
58 int (*cbk_do_batch)(struct crypto_engine *engine),
60 int crypto_engine_exit(struct crypto_engine *engine);
62 #endif /* _CRYPTO_ENGINE_H */