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/userspace-ifmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget'/translations/zh_TW/crypto/userspace-ifmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget'/translations/it_IT/crypto/userspace-ifmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget'/translations/ja_JP/crypto/userspace-ifmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget'/translations/ko_KR/crypto/userspace-ifmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget'/translations/sp_SP/crypto/userspace-ifmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(hUser Space Interfaceh]hUser Space Interface}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhA/var/lib/git/docbuild/linux/Documentation/crypto/userspace-if.rsthKubh)}(hhh](h)}(h Introductionh]h Introduction}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hThe concepts of the kernel crypto API visible to kernel space is fully applicable to the user space interface as well. Therefore, the kernel crypto API high level discussion for the in-kernel use cases applies here as well.h]hThe concepts of the kernel crypto API visible to kernel space is fully applicable to the user space interface as well. Therefore, the kernel crypto API high level discussion for the in-kernel use cases applies here as well.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hThe major difference, however, is that user space can only act as a consumer and never as a provider of a transformation or cipher algorithm.h]hThe major difference, however, is that user space can only act as a consumer and never as a provider of a transformation or cipher algorithm.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hX The following covers the user space interface exported by the kernel crypto API. A working example of this description is libkcapi that can be obtained from [1]. That library can be used by user space applications that require cryptographic services from the kernel.h]hX The following covers the user space interface exported by the kernel crypto API. A working example of this description is libkcapi that can be obtained from [1]. That library can be used by user space applications that require cryptographic services from the kernel.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hSome details of the in-kernel kernel crypto API aspects do not apply to user space, however. This includes the difference between synchronous and asynchronous invocations. The user space API call is fully synchronous.h]hSome details of the in-kernel kernel crypto API aspects do not apply to user space, however. This includes the difference between synchronous and asynchronous invocations. The user space API call is fully synchronous.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(h([1] https://www.chronox.de/libkcapi.htmlh](h[1] }(hjhhhNhNubh reference)}(h$https://www.chronox.de/libkcapi.htmlh]h$https://www.chronox.de/libkcapi.html}(hj hhhNhNubah}(h]h ]h"]h$]h&]refurijuh1j hjubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h] introductionah ]h"] introductionah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hUser Space API General Remarksh]hUser Space API General Remarks}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj)hhhhhKubh)}(heThe kernel crypto API is accessible from user space. Currently, the following ciphers are accessible:h]heThe kernel crypto API is accessible from user space. Currently, the following ciphers are accessible:}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj)hhubh bullet_list)}(hhh](h list_item)}(h;Message digest including keyed message digest (HMAC, CMAC) h]h)}(h:Message digest including keyed message digest (HMAC, CMAC)h]h:Message digest including keyed message digest (HMAC, CMAC)}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK"hjOubah}(h]h ]h"]h$]h&]uh1jMhjJhhhhhNubjN)}(hSymmetric ciphers h]h)}(hSymmetric ciphersh]hSymmetric ciphers}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK$hjgubah}(h]h ]h"]h$]h&]uh1jMhjJhhhhhNubjN)}(h AEAD ciphers h]h)}(h AEAD ciphersh]h AEAD ciphers}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK&hjubah}(h]h ]h"]h$]h&]uh1jMhjJhhhhhNubjN)}(hRandom Number Generators h]h)}(hRandom Number Generatorsh]hRandom Number Generators}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK(hjubah}(h]h ]h"]h$]h&]uh1jMhjJhhhhhNubeh}(h]h ]h"]h$]h&]bullet-uh1jHhhhK"hj)hhubh)}(hThe interface is provided via socket type using the type AF_ALG. In addition, the setsockopt option type is SOL_ALG. In case the user space header files do not export these flags yet, use the following macros:h]hThe interface is provided via socket type using the type AF_ALG. In addition, the setsockopt option type is SOL_ALG. In case the user space header files do not export these flags yet, use the following macros:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK*hj)hhubh literal_block)}(hR#ifndef AF_ALG #define AF_ALG 38 #endif #ifndef SOL_ALG #define SOL_ALG 279 #endifh]hR#ifndef AF_ALG #define AF_ALG 38 #endif #ifndef SOL_ALG #define SOL_ALG 279 #endif}hjsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1jhhhK0hj)hhubh)}(hA cipher is accessed with the same name as done for the in-kernel API calls. This includes the generic vs. unique naming schema for ciphers as well as the enforcement of priorities for generic names.h]hA cipher is accessed with the same name as done for the in-kernel API calls. This includes the generic vs. unique naming schema for ciphers as well as the enforcement of priorities for generic names.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK8hj)hhubh)}(hX To interact with the kernel crypto API, a socket must be created by the user space application. User space invokes the cipher operation with the send()/write() system call family. The result of the cipher operation is obtained with the read()/recv() system call family.h]hX To interact with the kernel crypto API, a socket must be created by the user space application. User space invokes the cipher operation with the send()/write() system call family. The result of the cipher operation is obtained with the read()/recv() system call family.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK