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