X?sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget(/translations/zh_CN/crypto/crypto_enginemodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget(/translations/zh_TW/crypto/crypto_enginemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget(/translations/it_IT/crypto/crypto_enginemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget(/translations/ja_JP/crypto/crypto_enginemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget(/translations/ko_KR/crypto/crypto_enginemodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget(/translations/sp_SP/crypto/crypto_enginemodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhB/var/lib/git/docbuild/linux/Documentation/crypto/crypto_engine.rsthKubhsection)}(hhh](htitle)}(h Crypto Engineh]h Crypto Engine}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hOverviewh]hOverview}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(h5The crypto engine (CE) API is a crypto queue manager.h]h5The crypto engine (CE) API is a crypto queue manager.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h]overviewah ]h"]overviewah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Requirementh]h Requirement}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhK 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:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh literal_block)}(hIstruct your_tfm_ctx { struct crypto_engine engine; ... };h]hIstruct your_tfm_ctx { struct crypto_engine engine; ... };}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhhhhubh)}(hXThe 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 “}(hj!hhhNhNubhliteral)}(h``struct your_tfm_ctx``h]hstruct your_tfm_ctx}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1j)hj!ubhE”. The engine assumes (requires) the placement of the known member }(hj!hhhNhNubj*)}(h``struct crypto_engine``h]hstruct crypto_engine}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1j)hj!ubh at the beginning.}(hj!hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h] requirementah ]h"] requirementah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(hOrder of operationsh]hOrder of operations}(hj`hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj]hhhhhKubh)}(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](h6You are required to obtain a struct crypto_engine via }(hjnhhhNhNubj*)}(h``crypto_engine_alloc_init()``h]hcrypto_engine_alloc_init()}(hjvhhhNhNubah}(h]h ]h"]h$]h&]uh1j)hjnubh. Start it via }(hjnhhhNhNubj*)}(h``crypto_engine_start()``h]hcrypto_engine_start()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j)hjnubh;. When finished with your work, shut down the engine using }(hjnhhhNhNubj*)}(h``crypto_engine_stop()``h]hcrypto_engine_stop()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j)hjnubh and destroy the engine with }(hjnhhhNhNubj*)}(h``crypto_engine_exit()``h]hcrypto_engine_exit()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j)hjnubh.}(hjnhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj]hhubh)}(hqBefore transferring any request, you have to fill the context enginectx by providing functions for the following:h]hqBefore transferring any request, you have to fill the context enginectx by providing functions for the following:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK$hj]hhubh bullet_list)}(hhh](h list_item)}(hQ``prepare_crypt_hardware``: Called once before any prepare functions are called. h]h)}(hP``prepare_crypt_hardware``: Called once before any prepare functions are called.h](j*)}(h``prepare_crypt_hardware``h]hprepare_crypt_hardware}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j)hjubh6: Called once before any prepare functions are called.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK'hjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hZ``unprepare_crypt_hardware``: Called once after all unprepare functions have been called. h]h)}(hY``unprepare_crypt_hardware``: Called once after all unprepare functions have been called.h](j*)}(h``unprepare_crypt_hardware``h]hunprepare_crypt_hardware}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j)hjubh=: Called once after all unprepare functions have been called.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK*hjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(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]hprepare_cipher_request}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1j)hj)ubh/}(hj)hhhNhNubj*)}(h``prepare_hash_request``h]hprepare_hash_request}(hj?hhhNhNubah}(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)hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK-hj%ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(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]hunprepare_cipher_request}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1j)hjaubh/}(hjahhhNhNubj*)}(h``unprepare_hash_request``h]hunprepare_hash_request}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1j)hjaubh^: Called after each request is handled. Clean up / undo what was done in the prepare function.}(hjahhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK1hj]ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(he``cipher_one_request``/``hash_one_request``: Handle the current request by performing the operation. h]h)}(hd``cipher_one_request``/``hash_one_request``: Handle the current request by performing the operation.h](j*)}(h``cipher_one_request``h]hcipher_one_request}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j)hjubh/}(hjhhhNhNubj*)}(h``hash_one_request``h]hhash_one_request}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j)hjubh9: Handle the current request by performing the operation.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK4hjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]bullet*uh1jhhhK'hj]hhubh)}(hNote 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]hNote that these functions access the crypto_async_request structure associated with the received request. You are able to retrieve the original request by using:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK7hj]hhubj)}(h9container_of(areq, struct yourrequesttype_request, base);h]h9container_of(areq, struct yourrequesttype_request, base);}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhK=hj]hhubh)}(hdWhen your driver receives a crypto_request, you must to transfer it to the crypto engine via one of:h]hdWhen your driver receives a crypto_request, you must to transfer it to the crypto engine via one of:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK?hj]hhubj)}(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()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKBhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h-crypto_transfer_akcipher_request_to_engine() h]h)}(h,crypto_transfer_akcipher_request_to_engine()h]h,crypto_transfer_akcipher_request_to_engine()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKDhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h)crypto_transfer_hash_request_to_engine() h]h)}(h(crypto_transfer_hash_request_to_engine()h]h(crypto_transfer_hash_request_to_engine()}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKFhj2ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h(crypto_transfer_kpp_request_to_engine() h]h)}(h'crypto_transfer_kpp_request_to_engine()h]h'crypto_transfer_kpp_request_to_engine()}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKHhjJubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h-crypto_transfer_skcipher_request_to_engine() h]h)}(h,crypto_transfer_skcipher_request_to_engine()h]h,crypto_transfer_skcipher_request_to_engine()}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKJhjbubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jhhhKBhj]hhubh)}(hVAt the end of the request process, a call to one of the following functions is needed:h]hVAt the end of the request process, a call to one of the following functions is needed:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKLhj]hhubj)}(hhh](j)}(hcrypto_finalize_aead_request() h]h)}(hcrypto_finalize_aead_request()h]hcrypto_finalize_aead_request()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKNhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h#crypto_finalize_akcipher_request() h]h)}(h"crypto_finalize_akcipher_request()h]h"crypto_finalize_akcipher_request()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKPhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hcrypto_finalize_hash_request() h]h)}(hcrypto_finalize_hash_request()h]hcrypto_finalize_hash_request()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKRhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hcrypto_finalize_kpp_request() h]h)}(hcrypto_finalize_kpp_request()h]hcrypto_finalize_kpp_request()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKThjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h"crypto_finalize_skcipher_request()h]h)}(hjh]h"crypto_finalize_skcipher_request()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKVhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jhhhKNhj]hhubeh}(h]order-of-operationsah ]h"]order of operationsah$]h&]uh1hhhhhhhhKubeh}(h] crypto-engineah ]h"] crypto engineah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjAerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jjhhjZjWjju nametypes}(jhjZjuh}(jhhhjWhjj]u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.