€• <Œsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ(/translations/zh_CN/crypto/crypto_engine”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/zh_TW/crypto/crypto_engine”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/it_IT/crypto/crypto_engine”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/ja_JP/crypto/crypto_engine”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/ko_KR/crypto/crypto_engine”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/pt_BR/crypto/crypto_engine”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/sp_SP/crypto/crypto_engine”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…””}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒB/var/lib/git/docbuild/linux/Documentation/crypto/crypto_engine.rst”h´KubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒ Crypto Engine”h]”hŒ Crypto Engine”…””}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´KubhÉ)”}”(hhh]”(hÎ)”}”(hŒOverview”h]”hŒOverview”…””}”(hhàh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÝh²hh³hÇh´KubhŒ paragraph”“”)”}”(hŒ5The crypto engine (CE) API is a crypto queue manager.”h]”hŒ5The crypto engine (CE) API is a crypto queue manager.”…””}”(hhðh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KhhÝh²hubeh}”(h]”Œoverview”ah ]”h"]”Œoverview”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KubhÉ)”}”(hhh]”(hÎ)”}”(hŒ Requirement”h]”hŒ Requirement”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjh²hh³hÇh´K ubhï)”}”(hŒ_You must put, at the start of your transform context your_tfm_ctx, the structure crypto_engine:”h]”hŒ_You must put, at the start of your transform context your_tfm_ctx, the structure crypto_engine:”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K hjh²hubhŒ literal_block”“”)”}”(hŒIstruct your_tfm_ctx { struct crypto_engine engine; ... };”h]”hŒIstruct your_tfm_ctx { struct crypto_engine engine; ... };”…””}”hj'sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j%h³hÇh´Khjh²hubhï)”}”(hX·The crypto engine only manages asynchronous requests in the form of crypto_async_request. It cannot know the underlying request type and thus only has access to the transform structure. It is not possible to access the context using container_of. In addition, the engine knows nothing about your structure "``struct your_tfm_ctx``". The engine assumes (requires) the placement of the known member ``struct crypto_engine`` at the beginning.”h]”(hX5The crypto engine only manages asynchronous requests in the form of crypto_async_request. It cannot know the underlying request type and thus only has access to the transform structure. It is not possible to access the context using container_of. In addition, the engine knows nothing about your structure “”…””}”(hj5h²hh³Nh´NubhŒliteral”“”)”}”(hŒ``struct your_tfm_ctx``”h]”hŒstruct your_tfm_ctx”…””}”(hj?h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j=hj5ubhŒEâ€. The engine assumes (requires) the placement of the known member ”…””}”(hj5h²hh³Nh´Nubj>)”}”(hŒ``struct crypto_engine``”h]”hŒstruct crypto_engine”…””}”(hjQh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j=hj5ubhŒ at the beginning.”…””}”(hj5h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Khjh²hubeh}”(h]”Œ requirement”ah ]”h"]”Œ requirement”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K ubhÉ)”}”(hhh]”(hÎ)”}”(hŒOrder of operations”h]”hŒOrder of operations”…””}”(hjth²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjqh²hh³hÇh´Kubhï)”}”(hXYou are required to obtain a struct crypto_engine via ``crypto_engine_alloc_init()``. Start it via ``crypto_engine_start()``. When finished with your work, shut down the engine using ``crypto_engine_stop()`` and destroy the engine with ``crypto_engine_exit()``.”h]”(hŒ6You are required to obtain a struct crypto_engine via ”…””}”(hj‚h²hh³Nh´Nubj>)”}”(hŒ``crypto_engine_alloc_init()``”h]”hŒcrypto_engine_alloc_init()”…””}”(hjŠh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j=hj‚ubhŒ. Start it via ”…””}”(hj‚h²hh³Nh´Nubj>)”}”(hŒ``crypto_engine_start()``”h]”hŒcrypto_engine_start()”…””}”(hjœh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j=hj‚ubhŒ;. When finished with your work, shut down the engine using ”…””}”(hj‚h²hh³Nh´Nubj>)”}”(hŒ``crypto_engine_stop()``”h]”hŒcrypto_engine_stop()”…””}”(hj®h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j=hj‚ubhŒ and destroy the engine with ”…””}”(hj‚h²hh³Nh´Nubj>)”}”(hŒ``crypto_engine_exit()``”h]”hŒcrypto_engine_exit()”…””}”(hjÀh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j=hj‚ubhŒ.”…””}”(hj‚h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Khjqh²hubhï)”}”(hŒqBefore transferring any request, you have to fill the context enginectx by providing functions for the following:”h]”hŒqBefore transferring any request, you have to fill the context enginectx by providing functions for the following:”…””}”(hjØh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K$hjqh²hubhŒ bullet_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hŒ²``prepare_cipher_request``/``prepare_hash_request``: Called before each corresponding request is performed. If some processing or other preparatory work is required, do it here. ”h]”hï)”}”(hŒ±``prepare_cipher_request``/``prepare_hash_request``: Called before each corresponding request is performed. If some processing or other preparatory work is required, do it here.”h]”(j>)”}”(hŒ``prepare_cipher_request``”h]”hŒprepare_cipher_request”…””}”(hjõh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j=hjñubhŒ/”…””}”(hjñh²hh³Nh´Nubj>)”}”(hŒ``prepare_hash_request``”h]”hŒprepare_hash_request”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j=hjñubhŒ~: Called before each corresponding request is performed. If some processing or other preparatory work is required, do it here.”…””}”(hjñh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K'hjíubah}”(h]”h ]”h"]”h$]”h&]”uh1jëhjèh²hh³hÇh´Nubjì)”}”(hŒ–``unprepare_cipher_request``/``unprepare_hash_request``: Called after each request is handled. Clean up / undo what was done in the prepare function. ”h]”hï)”}”(hŒ•``unprepare_cipher_request``/``unprepare_hash_request``: Called after each request is handled. Clean up / undo what was done in the prepare function.”h]”(j>)”}”(hŒ``unprepare_cipher_request``”h]”hŒunprepare_cipher_request”…””}”(hj-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j=hj)ubhŒ/”…””}”(hj)h²hh³Nh´Nubj>)”}”(hŒ``unprepare_hash_request``”h]”hŒunprepare_hash_request”…””}”(hj?h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j=hj)ubhŒ^: Called after each request is handled. Clean up / undo what was done in the prepare function.”…””}”(hj)h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K+hj%ubah}”(h]”h ]”h"]”h$]”h&]”uh1jëhjèh²hh³hÇh´Nubjì)”}”(hŒe``cipher_one_request``/``hash_one_request``: Handle the current request by performing the operation. ”h]”hï)”}”(hŒd``cipher_one_request``/``hash_one_request``: Handle the current request by performing the operation.”h]”(j>)”}”(hŒ``cipher_one_request``”h]”hŒcipher_one_request”…””}”(hjeh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j=hjaubhŒ/”…””}”(hjah²hh³Nh´Nubj>)”}”(hŒ``hash_one_request``”h]”hŒhash_one_request”…””}”(hjwh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j=hjaubhŒ9: Handle the current request by performing the operation.”…””}”(hjah²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K.hj]ubah}”(h]”h ]”h"]”h$]”h&]”uh1jëhjèh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ*”uh1jæh³hÇh´K'hjqh²hubhï)”}”(hŒ¡Note that these functions access the crypto_async_request structure associated with the received request. You are able to retrieve the original request by using:”h]”hŒ¡Note that these functions access the crypto_async_request structure associated with the received request. You are able to retrieve the original request by using:”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K1hjqh²hubj&)”}”(hŒ9container_of(areq, struct yourrequesttype_request, base);”h]”hŒ9container_of(areq, struct yourrequesttype_request, base);”…””}”hj«sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j%h³hÇh´K7hjqh²hubhï)”}”(hŒdWhen your driver receives a crypto_request, you must to transfer it to the crypto engine via one of:”h]”hŒdWhen your driver receives a crypto_request, you must to transfer it to the crypto engine via one of:”…””}”(hj¹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K9hjqh²hubjç)”}”(hhh]”(jì)”}”(hŒ)crypto_transfer_aead_request_to_engine() ”h]”hï)”}”(hŒ(crypto_transfer_aead_request_to_engine()”h]”hŒ(crypto_transfer_aead_request_to_engine()”…””}”(hjÎh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Khjâubah}”(h]”h ]”h"]”h$]”h&]”uh1jëhjÇh²hh³hÇh´Nubjì)”}”(hŒ)crypto_transfer_hash_request_to_engine() ”h]”hï)”}”(hŒ(crypto_transfer_hash_request_to_engine()”h]”hŒ(crypto_transfer_hash_request_to_engine()”…””}”(hjþh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K@hjúubah}”(h]”h ]”h"]”h$]”h&]”uh1jëhjÇh²hh³hÇh´Nubjì)”}”(hŒ(crypto_transfer_kpp_request_to_engine() ”h]”hï)”}”(hŒ'crypto_transfer_kpp_request_to_engine()”h]”hŒ'crypto_transfer_kpp_request_to_engine()”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KBhjubah}”(h]”h ]”h"]”h$]”h&]”uh1jëhjÇh²hh³hÇh´Nubjì)”}”(hŒ-crypto_transfer_skcipher_request_to_engine() ”h]”hï)”}”(hŒ,crypto_transfer_skcipher_request_to_engine()”h]”hŒ,crypto_transfer_skcipher_request_to_engine()”…””}”(hj.h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KDhj*ubah}”(h]”h ]”h"]”h$]”h&]”uh1jëhjÇh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”j›jœuh1jæh³hÇh´K