Xsphinx.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]hPortuguese (Brazilian)}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget'/translations/pt_BR/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)}(hAF_ALG provides unprivileged userspace programs access to arbitrary hash, symmetric cipher, AEAD, and RNG algorithms that are implemented in kernel-mode code.h]hAF_ALG provides unprivileged userspace programs access to arbitrary hash, symmetric cipher, AEAD, and RNG algorithms that are implemented in kernel-mode code.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hAF_ALG is insecure and is deprecated. Originally added to the kernel in 2010, most kernel developers now consider it to be a mistake. Support for hardware accelerators, which was the original purpose of AF_ALG, has been removed.h]hAF_ALG is insecure and is deprecated. Originally added to the kernel in 2010, most kernel developers now consider it to be a mistake. Support for hardware accelerators, which was the original purpose of AF_ALG, has been removed.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hAF_ALG continues to be supported only for backwards compatibility. On systems where no programs using AF_ALG remain, the support for it should be disabled by disabling ``CONFIG_CRYPTO_USER_API_*``.h](hAF_ALG continues to be supported only for backwards compatibility. On systems where no programs using AF_ALG remain, the support for it should be disabled by disabling }(hhhhhNhNubhliteral)}(h``CONFIG_CRYPTO_USER_API_*``h]hCONFIG_CRYPTO_USER_API_*}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhubh.}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h] introductionah ]h"] introductionah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Deprecationh]h Deprecation}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj$hhhhhKubh)}(hAF_ALG was originally intended to provide userspace programs access to crypto accelerators that they wouldn't otherwise have access to.h]hAF_ALG was originally intended to provide userspace programs access to crypto accelerators that they wouldn’t otherwise have access to.}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj$hhubh)}(hHowever, that capability turned out to not be useful on very many systems. More significantly, the actual implementation exposes a vastly greater amount of functionality than that. It actually provides access to all software algorithms.h]hHowever, that capability turned out to not be useful on very many systems. More significantly, the actual implementation exposes a vastly greater amount of functionality than that. It actually provides access to all software algorithms.}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj$hhubh)}(hX6This includes arbitrary compositions of different algorithms created via a complex template system, as well as algorithms that only make sense as internal implementation details of other algorithms. In the past, it also included full zero-copy support, which was difficult for the kernel to implement securely.h]hX6This includes arbitrary compositions of different algorithms created via a complex template system, as well as algorithms that only make sense as internal implementation details of other algorithms. In the past, it also included full zero-copy support, which was difficult for the kernel to implement securely.}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj$hhubh)}(hUltimately, these algorithms are just math computations. They use the same instructions that userspace programs already have access to, just accessed in a much more convoluted and less efficient way.h]hUltimately, these algorithms are just math computations. They use the same instructions that userspace programs already have access to, just accessed in a much more convoluted and less efficient way.}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK"hj$hhubh)}(hIndeed, userspace code is nearly always what is being used anyway. These same algorithms are widely implemented in userspace crypto libraries.h]hIndeed, userspace code is nearly always what is being used anyway. These same algorithms are widely implemented in userspace crypto libraries.}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK&hj$hhubh)}(hXEven when zero-copy and off-CPU accelerators were supported, AF_ALG was usually much slower than optimized software cryptography in userspace. This was especially true for the small message sizes usually seen in performance-critical workloads. While it was possible to demonstrate performance wins for hashing large files on embedded devices, it is hard to imagine a situation where this would be performance-critical.h]hXEven when zero-copy and off-CPU accelerators were supported, AF_ALG was usually much slower than optimized software cryptography in userspace. This was especially true for the small message sizes usually seen in performance-critical workloads. While it was possible to demonstrate performance wins for hashing large files on embedded devices, it is hard to imagine a situation where this would be performance-critical.}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK)hj$hhubh)}(hXNowadays, AF_ALG no longer supports zero-copy or off-CPU accelerators. Therefore, it is *always* slower than an optimized userspace implementation, even for large messages. The only possible advantage left is that it avoids duplicating code between kernel and userspace. However, userspace implementations, especially hardware-accelerated ones, do not need to be large. Just because OpenSSL is huge does not mean that all userspace cryptography libraries are.h](hXNowadays, AF_ALG no longer supports zero-copy or off-CPU accelerators. Therefore, it is }(hjhhhNhNubhemphasis)}(h*always*h]halways}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhXk slower than an optimized userspace implementation, even for large messages. The only possible advantage left is that it avoids duplicating code between kernel and userspace. However, userspace implementations, especially hardware-accelerated ones, do not need to be large. Just because OpenSSL is huge does not mean that all userspace cryptography libraries are.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK0hj$hhubh)}(hMeanwhile, AF_ALG hasn't been withstanding modern vulnerability discovery tools such as syzbot and large language models. It receives a steady stream of CVEs. Some of the examples include:h]hMeanwhile, AF_ALG hasn’t been withstanding modern vulnerability discovery tools such as syzbot and large language models. It receives a steady stream of CVEs. Some of the examples include:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK8hj$hhubh bullet_list)}(hhh](h list_item)}(hCVE-2026-31677h]h)}(hjh]hCVE-2026-31677}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hCVE-2025-37808h]h)}(hjh]hCVE-2025-37808}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK?hjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hCVE-2024-26824h]h)}(hj3h]hCVE-2024-26824}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK@hj1ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hCVE-2022-48781h]h)}(hjJh]hCVE-2022-48781}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKAhjHubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h CVE-2019-8912h]h)}(hjah]h CVE-2019-8912}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKBhj_ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hCVE-2018-14619h]h)}(hjxh]hCVE-2018-14619}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKChjvubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hCVE-2017-18075h]h)}(hjh]hCVE-2017-18075}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKDhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hCVE-2017-17806h]h)}(hjh]hCVE-2017-17806}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKEhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hCVE-2017-17805h]h)}(hjh]hCVE-2017-17805}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKFhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hCVE-2016-10147h]h)}(hjh]hCVE-2016-10147}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKGhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h CVE-2015-8970h]h)}(hjh]h CVE-2015-8970}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKHhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h CVE-2015-3331h]h)}(hjh]h CVE-2015-3331}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKIhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h CVE-2014-9644h]h)}(hjh]h CVE-2014-9644}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKJhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(h CVE-2013-7421h]h)}(hj0h]h CVE-2013-7421}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKKhj.ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hCVE-2011-4081 h]h)}(h CVE-2011-4081h]h CVE-2011-4081}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKLhjEubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]bullet-uh1jhhhK