1=============
2CRYPTO ENGINE
3=============
4
5Overview
6--------
7The crypto engine API (CE), is a crypto queue manager.
8
9Requirement
10-----------
11You have to put at start of your tfm_ctx the struct crypto_engine_ctx::
12
13  struct your_tfm_ctx {
14        struct crypto_engine_ctx enginectx;
15        ...
16  };
17
18Why: Since CE manage only crypto_async_request, it cannot know the underlying
19request_type and so have access only on the TFM.
20So using container_of for accessing __ctx is impossible.
21Furthermore, the crypto engine cannot know the "struct your_tfm_ctx",
22so it must assume that crypto_engine_ctx is at start of it.
23
24Order of operations
25-------------------
26You have to obtain a struct crypto_engine via crypto_engine_alloc_init().
27And start it via crypto_engine_start().
28
29Before transferring any request, you have to fill the enginectx.
30- prepare_request: (taking a function pointer) If you need to do some processing before doing the request
31- unprepare_request: (taking a function pointer) Undoing what's done in prepare_request
32- do_one_request: (taking a function pointer) Do encryption for current request
33
34Note: that those three functions get the crypto_async_request associated with the received request.
35So your need to get the original request via container_of(areq, struct yourrequesttype_request, base);
36
37When your driver receive a crypto_request, you have to transfer it to
38the cryptoengine via one of:
39- crypto_transfer_ablkcipher_request_to_engine()
40- crypto_transfer_aead_request_to_engine()
41- crypto_transfer_akcipher_request_to_engine()
42- crypto_transfer_hash_request_to_engine()
43- crypto_transfer_skcipher_request_to_engine()
44
45At the end of the request process, a call to one of the following function is needed:
46- crypto_finalize_ablkcipher_request
47- crypto_finalize_aead_request
48- crypto_finalize_akcipher_request
49- crypto_finalize_hash_request
50- crypto_finalize_skcipher_request
51