Skip to contentSkip to conversation

crypto: af_alg - Document the deprecation of AF_ALG

PATCH In review Eric Biggers 10 participants 24 messages Apr 30 – Jun 23

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: af_alg - Document the deprecation of AF_ALG

AF_ALG is almost completely unnecessary, and it exposes a massive attack surface that hasn't been standing up to modern vulnerability discovery tools. The latest one even has its own website, providing a small Python script that reliably roots most Linux distros: https://copy.fail/

This isn't sustainable, especially as LLMs have accelerated the rate the vulnerabilities are coming in. The effort that is being put into this thing is vastly disproportional to the few programs that actually use it, and those programs would be better served by userspace code anyway.

These issues have been noted in many mailing list discussions already. But until now they haven't been reflected in the documentation or kconfig menu itself, and the vulnerabilities are still coming in.

Let's go ahead and document the deprecation.

This isn't intended to change anything overnight. After all, most Linux distros won't be able to disable the kconfig options quite yet, mainly because of iwd. But this should create a bit more impetus for these userspace programs to be fixed, and the documentation update should also help prevent more users from appearing.

---

This patch is targeting crypto/master

 Documentation/crypto/userspace-if.rst | 82 ++++++++++++++++++++-------
 crypto/Kconfig                        | 69 ++++++++++++++++------
 2 files changed, 113 insertions(+), 38 deletions(-)
Documentation/crypto/userspace-if.rst +62 -20
index 021759198fe7..c39f5c79a5b7 100644
@@ -2,30 +2,72 @@ User Space Interface
 ====================
 
 Introduction
 ------------
 
-The 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.
-
-The major difference, however, is that user space can only act as a
-consumer and never as a provider of a transformation or cipher
-algorithm.
-
-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.
-
-Some 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.
-
-[1] https://www.chronox.de/libkcapi/index.html
+AF_ALG provides unprivileged userspace programs access to arbitrary hash,
+symmetric cipher, AEAD, and RNG algorithms that are implemented in kernel-mode
+code.
+
+AF_ALG is insecure and is deprecated. Originally added to the kernel in 2010,
+most kernel developers now consider it to be a mistake.
+
+AF_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_*``.
+
+Deprecation
+-----------
+
+AF_ALG was originally intended to provide userspace programs access to crypto
+accelerators that they wouldn't otherwise have access to.
+
+However, 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.
+
+This 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. It also includes full zero-copy
+support, which is difficult for the kernel to implement securely.
+
+Ultimately, 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.
+
+Indeed, userspace code is nearly always what is being used anyway. These same
+algorithms are widely implemented in userspace crypto libraries.
+
+Meanwhile, 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:
+
+- CVE-2026-31677
+- CVE-2026-31431 (https://copy.fail)
+- CVE-2025-38079
+- CVE-2025-37808
+- CVE-2024-26824
+- CVE-2022-48781
+- CVE-2019-8912
+- CVE-2018-14619
+- CVE-2017-18075
+- CVE-2017-17806
+- CVE-2017-17805
+- CVE-2016-10147
+- CVE-2015-8970
+- CVE-2015-3331
+- CVE-2014-9644
+- CVE-2013-7421
+- CVE-2011-4081
+
+It is recommended that, whenever possible, userspace programs be migrated to
+userspace crypto code (which again, is what is normally used anyway) and
+``CONFIG_CRYPTO_USER_API_*`` be disabled.  On systems that use SELinux, SELinux
+can also be used to restrict the use of AF_ALG to trusted programs.
+
+The remainder of this documentation provides the historical documentation for
+the deprecated AF_ALG interface.
 
 User Space API General Remarks
 ------------------------------
 
 The kernel crypto API is accessible from user space. Currently, the
crypto/Kconfig +51 -18

119 lines not on this page · raw message

base-commit: 57b8e2d666a31fa201432d58f5fe3469a0dd83ba

Signature · 1 line
2.54.0
maintainer
#1 lore raw
Quoted 16 lines · Eric Biggers

AF_ALG is almost completely unnecessary, and it exposes a massive attack surface that hasn't been standing up to modern vulnerability discovery tools. The latest one even has its own website, providing a small Python script that reliably roots most Linux distros: https://copy.fail/

This isn't sustainable, especially as LLMs have accelerated the rate the vulnerabilities are coming in. The effort that is being put into this thing is vastly disproportional to the few programs that actually use it, and those programs would be better served by userspace code anyway.

These issues have been noted in many mailing list discussions already. But until now they haven't been reflected in the documentation or kconfig menu itself, and the vulnerabilities are still coming in.

Let's go ahead and document the deprecation.

Quoted 7 lines

This isn't intended to change anything overnight. After all, most Linux distros won't be able to disable the kconfig options quite yet, mainly because of iwd. But this should create a bit more impetus for these userspace programs to be fixed, and the documentation update should also help prevent more users from appearing.

What about the exposure of akcipher through security/keys/keyctl_pkey.c?

There isn't even a Kconfig option to disable that user-space API. If module signatures are enabled then this automatically gets added to the kernel:

MODULE_SIG -> MODULE_SIG_FORMAT -> SYSTEM_DATA_VERIFICATION -> KEYS + ASYMMETRIC_KEY_TYPE

Cheers,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#2 lore raw
Quoted 25 lines · Herbert Xu
Quoted 16 lines · Eric Biggers

AF_ALG is almost completely unnecessary, and it exposes a massive attack surface that hasn't been standing up to modern vulnerability discovery tools. The latest one even has its own website, providing a small Python script that reliably roots most Linux distros: https://copy.fail/

This isn't sustainable, especially as LLMs have accelerated the rate the vulnerabilities are coming in. The effort that is being put into this thing is vastly disproportional to the few programs that actually use it, and those programs would be better served by userspace code anyway.

These issues have been noted in many mailing list discussions already. But until now they haven't been reflected in the documentation or kconfig menu itself, and the vulnerabilities are still coming in.

Let's go ahead and document the deprecation.

Quoted 7 lines

This isn't intended to change anything overnight. After all, most Linux distros won't be able to disable the kconfig options quite yet, mainly because of iwd. But this should create a bit more impetus for these userspace programs to be fixed, and the documentation update should also help prevent more users from appearing.

Quoted 8 lines

What about the exposure of akcipher through security/keys/keyctl_pkey.c?

There isn't even a Kconfig option to disable that user-space API. If module signatures are enabled then this automatically gets added to the kernel:

MODULE_SIG -> MODULE_SIG_FORMAT -> SYSTEM_DATA_VERIFICATION -> KEYS + ASYMMETRIC_KEY_TYPE

Yes, that would be a different patch, but KEYCTL_PKEY_* have a very similar issue. That should have a kconfig option added too.

I believe iwd is the main (or even only?) user there, as well.

- Eric

#3 lore raw
In reply to Eric Biggers
Quoted 20 lines · Eric Biggers

AF_ALG is almost completely unnecessary, and it exposes a massive attack surface that hasn't been standing up to modern vulnerability discovery tools. The latest one even has its own website, providing a small Python script that reliably roots most Linux distros: https://copy.fail/

This isn't sustainable, especially as LLMs have accelerated the rate the vulnerabilities are coming in. The effort that is being put into this thing is vastly disproportional to the few programs that actually use it, and those programs would be better served by userspace code anyway.

These issues have been noted in many mailing list discussions already. But until now they haven't been reflected in the documentation or kconfig menu itself, and the vulnerabilities are still coming in.

Let's go ahead and document the deprecation.

Quoted 8 lines

This isn't intended to change anything overnight. After all, most Linux distros won't be able to disable the kconfig options quite yet, mainly because of iwd. But this should create a bit more impetus for these userspace programs to be fixed, and the documentation update should also help prevent more users from appearing.

---

Quick passing observation
I noticed that when attempting to completely disable these Crypto APIs, I was experiencing boot failures with fips=1 enabled systems.

Using 6.18-based kernel with an el9-based user space, I see the following hang in the early boot console from dracut-pre-pivot:
Check integrity of kernel
libkcapi - Error: AF_ALG: socket syscall failed (errno: -97) Allocation of hmac(sha512) cipher failed (-97)

I haven't looked at every elX version, but at least in el9 and el10, they use libkcapi-hmaccalc to provide sha512hmac, which dracut [1] uses to calculate the HMAC value in do_fips().

Digging further, I was only able to disable RNG and AEAD APIs, but not HASH and SKCIPHER APIs when FIPS was in the picture with el9++.

I’m not sure how other distros do the same, but this could be problematic elsehwere if other distros went down the libkcapi route.

[1] https://github.com/dracutdevs/dracut/blob/059/modules.d/01fips/fips.sh#L167

#4 lore raw
Quoted 41 lines · Jon Kohler
Quoted 18 lines · Eric Biggers

AF_ALG is almost completely unnecessary, and it exposes a massive attack surface that hasn't been standing up to modern vulnerability discovery tools. The latest one even has its own website, providing a small Python script that reliably roots most Linux distros: https://copy.fail/

This isn't sustainable, especially as LLMs have accelerated the rate the vulnerabilities are coming in. The effort that is being put into this thing is vastly disproportional to the few programs that actually use it, and those programs would be better served by userspace code anyway.

These issues have been noted in many mailing list discussions already. But until now they haven't been reflected in the documentation or kconfig menu itself, and the vulnerabilities are still coming in.

Let's go ahead and document the deprecation.

Quoted 8 lines

This isn't intended to change anything overnight. After all, most Linux distros won't be able to disable the kconfig options quite yet, mainly because of iwd. But this should create a bit more impetus for these userspace programs to be fixed, and the documentation update should also help prevent more users from appearing.

---

Quick passing observation
I noticed that when attempting to completely disable these Crypto APIs, I was experiencing boot failures with fips=1 enabled systems.

Using 6.18-based kernel with an el9-based user space, I see the following hang in the early boot console from dracut-pre-pivot:
Check integrity of kernel
libkcapi - Error: AF_ALG: socket syscall failed (errno: -97) Allocation of hmac(sha512) cipher failed (-97)

I haven't looked at every elX version, but at least in el9 and el10, they use libkcapi-hmaccalc to provide sha512hmac, which dracut [1] uses to calculate the HMAC value in do_fips().

Quoted 7 lines

Digging further, I was only able to disable RNG and AEAD APIs, but not HASH and SKCIPHER APIs when FIPS was in the picture with el9++.

I’m not sure how other distros do the same, but this could be problematic elsehwere if other distros went down the libkcapi route.

[1] https://github.com/dracutdevs/dracut/blob/059/modules.d/01fips/fips.sh#L167

That seems to be an implementation of FIPS 140-3's integrity self-check. A few observations:

- It could easily use userspace SHA-512 code instead. If including libcrypto.so in the "FIPS cryptographic boundary" would cause certification difficulties, then a sha512.c file could simply be added to 'libkcapi-hmaccalc' which is already in it.

- It's compatible with all of the proposed hardening. It doesn't require zero-copy performance. It runs as root, so it would be compatible with a capability check. "hmac(sha512)" will need to be on the algorithm allowlist anyway for iwd.

- FIPS 140-3 might also allow it to be simplified to use a plain hash instead of pointlessly using HMAC with a fixed key.

Anyway, just another one of the long tail of odd users that could have solved their problem in a better way. This one is at least compatible with the hardening that's being considered.

By the way, also on the topic of FIPS 140-3, some people do use AF_ALG for ACVP (even though it's not all that great for that purpose, either). But ACVP is a testing thing, not something that is needed on production systems. ACVP can just be run as root on a testing build; there's no need to enable support for it in the actual production build.

- Eric

#5 lore raw
Quoted 8 lines · Eric Biggers

That seems to be an implementation of FIPS 140-3's integrity self-check. A few observations:

- It could easily use userspace SHA-512 code instead. If including libcrypto.so in the "FIPS cryptographic boundary" would cause certification difficulties, then a sha512.c file could simply be added to 'libkcapi-hmaccalc' which is already in it.

Indeed expanding the crypto boundary to include libcrypto.so would cause certification difficulties, it would mean certifying all of libcrypto.so with the kernel. There *may* be a case for saying that it is outside the module boundary but only if:

* The integrity mechanism is clearly external
* The cryptographic module refuses to operate unless integrity is confirmed
* The trust relationship is clearly documented

I don't see how this could be justified cleanly without significant pushback.

Quoted 8 lines

- It's compatible with all of the proposed hardening. It doesn't require zero-copy performance. It runs as root, so it would be compatible with a capability check. "hmac(sha512)" will need to be on the algorithm allowlist anyway for iwd.

- FIPS 140-3 might also allow it to be simplified to use a plain hash instead of pointlessly using HMAC with a fixed key.

FIPS 140‑3 (via ISO/IEC 19790) draws a hard distinction between:
* Integrity checking (cryptographic protection)
* Integrity measurement (detection only)

A plain hash provides no protection against an attacker who can modify both the object and its reference hash.

Quoted 6 lines

By the way, also on the topic of FIPS 140-3, some people do use AF_ALG for ACVP (even though it's not all that great for that purpose, either). But ACVP is a testing thing, not something that is needed on production systems. ACVP can just be run as root on a testing build; there's no need to enable support for it in the actual production build.

Agreed it's not a good use case. Unless/until pkcs1 is supported, I don't see how you can use it for all of the test cases. Plus as evidenced by Ubuntu's new cert, it requires validating the library.

Quoted 3 lines

- Eric

#7 lore raw
In reply to Jeff Barnes
Quoted 31 lines · Jeff Barnes
Quoted 8 lines · Eric Biggers

That seems to be an implementation of FIPS 140-3's integrity self-check. A few observations:

- It could easily use userspace SHA-512 code instead. If including libcrypto.so in the "FIPS cryptographic boundary" would cause certification difficulties, then a sha512.c file could simply be added to 'libkcapi-hmaccalc' which is already in it.

Indeed expanding the crypto boundary to include libcrypto.so would cause certification difficulties, it would mean certifying all of libcrypto.so with the kernel. There *may* be a case for saying that it is outside the module boundary but only if:

* The integrity mechanism is clearly external
* The cryptographic module refuses to operate unless integrity is confirmed
* The trust relationship is clearly documented

I don't see how this could be justified cleanly without significant pushback.

Quoted 8 lines

- It's compatible with all of the proposed hardening. It doesn't require zero-copy performance. It runs as root, so it would be compatible with a capability check. "hmac(sha512)" will need to be on the algorithm allowlist anyway for iwd.

- FIPS 140-3 might also allow it to be simplified to use a plain hash instead of pointlessly using HMAC with a fixed key.

Quoted 6 lines

FIPS 140‑3 (via ISO/IEC 19790) draws a hard distinction between:
* Integrity checking (cryptographic protection)
* Integrity measurement (detection only)

A plain hash provides no protection against an attacker who can modify both the object and its reference hash.

The integrity mechanism is not build to detect adversarial tampering (at least at level 1), that is not its purpose.

That said a HMAC is just a hash with a secret key in the mix, it does not change the conditions wrt Hash if the key is known.

Quoted 9 lines
Quoted 5 lines

By the way, also on the topic of FIPS 140-3, some people do use AF_ALG for ACVP (even though it's not all that great for that purpose, either). But ACVP is a testing thing, not something that is needed on production systems. ACVP can just be run as root on a testing build; there's no need to enable support for it in the actual production build.

Agreed it's not a good use case. Unless/until pkcs1 is supported, I don't see how you can use it for all of the test cases. Plus as evidenced by Ubuntu's new cert, it requires validating the library.

Of course it requires validating the library, validating the cryptography implementation is what FIPS is for. libcrypto.so can never be outside the boundary, unless you turn it off at runtime ...

The problems are rather that libcrypto is not instrumented to enforce KAT tests are executed before it allows operation (crypto-API did this via test manager) and does not provide an indicator (or blocks) unapproved algorithms ...

Simo.

Signature · 4 lines
Simo Sorce
Distinguished Engineer
RHEL Crypto Team
Red Hat, Inc
#8 lore raw
In reply to Jon Kohler
Quoted 10 lines · Jon Kohler

Quick passing observation
I noticed that when attempting to completely disable these Crypto APIs, I was experiencing boot failures with fips=1 enabled systems.

Using 6.18-based kernel with an el9-based user space, I see the following hang in the early boot console from dracut-pre-pivot:
Check integrity of kernel
libkcapi - Error: AF_ALG: socket syscall failed (errno: -97) Allocation of hmac(sha512) cipher failed (-97)

One thing that for certain that would cause this panic is the sha512hmac binary that does the fips integrity check. On many distros this check is called, for example by dracut among others, during initramfs to check the integrity of the kernel before any crypto is used. On failure, the kernel won't finish boot.

sha512hmac is a binary shipped with kcapitools. It uses libkcapi.

sha512hmac -> libkcapi -> AF_ALG.

Is there a planned replacement for this integrity check? I don't know of anybody doing this for FIPS yet, but is there a case where IMA / EVM could be a workaround?

Regards,
Jeff

Quoted 14 lines

I haven't looked at every elX version, but at least in el9 and el10, they use libkcapi-hmaccalc to provide sha512hmac, which dracut [1] uses to calculate the HMAC value in do_fips().

Digging further, I was only able to disable RNG and AEAD APIs, but not HASH and SKCIPHER APIs when FIPS was in the picture with el9++.

I’m not sure how other distros do the same, but this could be problematic elsehwere if other distros went down the libkcapi route.

[1] https://github.com/dracutdevs/dracut/blob/059/modules.d/01fips/fips.sh#L167

maintainer
#9 lore raw
In reply to Eric Biggers
Quoted 22 lines · Eric Biggers

AF_ALG is almost completely unnecessary, and it exposes a massive attack surface that hasn't been standing up to modern vulnerability discovery tools. The latest one even has its own website, providing a small Python script that reliably roots most Linux distros: https://copy.fail/

This isn't sustainable, especially as LLMs have accelerated the rate the vulnerabilities are coming in. The effort that is being put into this thing is vastly disproportional to the few programs that actually use it, and those programs would be better served by userspace code anyway.

These issues have been noted in many mailing list discussions already. But until now they haven't been reflected in the documentation or kconfig menu itself, and the vulnerabilities are still coming in.

Let's go ahead and document the deprecation.

This isn't intended to change anything overnight. After all, most Linux distros won't be able to disable the kconfig options quite yet, mainly because of iwd. But this should create a bit more impetus for these userspace programs to be fixed, and the documentation update should also help prevent more users from appearing.

Quoted 8 lines

---

This patch is targeting crypto/master

 Documentation/crypto/userspace-if.rst | 82 ++++++++++++++++++++-------
 crypto/Kconfig                        | 69 ++++++++++++++++------
 2 files changed, 113 insertions(+), 38 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#10 lore raw
In reply to Eric Biggers
Quoted 6 lines · Eric Biggers

AF_ALG is almost completely unnecessary, and it exposes a massive attack surface that hasn't been standing up to modern vulnerability discovery tools. The latest one even has its own website, providing a small Python script that reliably roots most Linux distros: https://copy.fail/

How about adding a configuration option, defaulted on, that requires capable(CAP_SYS_ADMIN) to create the socket (and maybe also to bind / connect it). And a sysctl to allow the administrator to override this in the unlikely event that it’s needed.

IIRC cryptsetup used to and maybe even still does require these sockets sometimes and this would let it keep working. And there's all the FIPS stuff downthread.

Quoted 255 lines

This isn't sustainable, especially as LLMs have accelerated the rate the vulnerabilities are coming in. The effort that is being put into this thing is vastly disproportional to the few programs that actually use it, and those programs would be better served by userspace code anyway.

These issues have been noted in many mailing list discussions already. But until now they haven't been reflected in the documentation or kconfig menu itself, and the vulnerabilities are still coming in.

Let's go ahead and document the deprecation.

This isn't intended to change anything overnight. After all, most Linux distros won't be able to disable the kconfig options quite yet, mainly because of iwd. But this should create a bit more impetus for these userspace programs to be fixed, and the documentation update should also help prevent more users from appearing.

---

This patch is targeting crypto/master

Documentation/crypto/userspace-if.rst | 82 ++++++++++++++++++++-------
crypto/Kconfig | 69 ++++++++++++++++------

2 files changed, 113 insertions(+), 38 deletions(-)
Documentation/crypto/userspace-if.rst +0 -0
index 021759198fe7..c39f5c79a5b7 100644
@@ -2,30 +2,72 @@ User Space Interface

====================

Introduction
------------

Documentation/crypto/userspace-if.rst +62 -20
-The 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.
-
-The major difference, however, is that user space can only act as a
-consumer and never as a provider of a transformation or cipher
-algorithm.
-
-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.
-
-Some 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.
-
-[1] https://www.chronox.de/libkcapi/index.html
+AF_ALG provides unprivileged userspace programs access to arbitrary hash,
+symmetric cipher, AEAD, and RNG algorithms that are implemented in kernel-mode
+code.
+
+AF_ALG is insecure and is deprecated. Originally added to the kernel in 2010,
+most kernel developers now consider it to be a mistake.
+
+AF_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_*``.
+
+Deprecation
+-----------
+
+AF_ALG was originally intended to provide userspace programs access to crypto
+accelerators that they wouldn't otherwise have access to.
+
+However, 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.
+
+This 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. It also includes full zero-copy
+support, which is difficult for the kernel to implement securely.
+
+Ultimately, 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.
+
+Indeed, userspace code is nearly always what is being used anyway. These same
+algorithms are widely implemented in userspace crypto libraries.
+
+Meanwhile, 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:
+
+- CVE-2026-31677
+- CVE-2026-31431 (https://copy.fail)
+- CVE-2025-38079
+- CVE-2025-37808
+- CVE-2024-26824
+- CVE-2022-48781
+- CVE-2019-8912
+- CVE-2018-14619
+- CVE-2017-18075
+- CVE-2017-17806
+- CVE-2017-17805
+- CVE-2016-10147
+- CVE-2015-8970
+- CVE-2015-3331
+- CVE-2014-9644
+- CVE-2013-7421
+- CVE-2011-4081
+
+It is recommended that, whenever possible, userspace programs be migrated to
+userspace crypto code (which again, is what is normally used anyway) and
+``CONFIG_CRYPTO_USER_API_*`` be disabled.  On systems that use SELinux, SELinux
+can also be used to restrict the use of AF_ALG to trusted programs.
+
+The remainder of this documentation provides the historical documentation for
+the deprecated AF_ALG interface.

User Space API General Remarks
------------------------------

The kernel crypto API is accessible from user space. Currently, the

crypto/Kconfig +0 -0
index 103d1f58cb7c..6cd1c478d4be 100644
@@ -1278,48 +1278,72 @@ config CRYPTO_DF80090A
   tristate
   select CRYPTO_AES
   select CRYPTO_CTR
 

endmenu

crypto/Kconfig +1 -1
-menu "Userspace interface"
+menu "Userspace interface (deprecated)"

config CRYPTO_USER_API
tristate

config CRYPTO_USER_API_HASH

crypto/Kconfig +12 -4
-    tristate "Hash algorithms"
+    tristate "Hash algorithms (deprecated)"
   depends on NET
   select CRYPTO_HASH
   select CRYPTO_USER_API
   help
-      Enable the userspace interface for hash algorithms.
+      Enable the AF_ALG userspace interface for hash algorithms.  This
+      provides unprivileged userspace programs access to arbitrary hash
+      algorithms implemented in the kernel's privileged execution context.
 
-      See Documentation/crypto/userspace-if.rst and
-      https://www.chronox.de/libkcapi/html/index.html
+      This interface is deprecated and is supported only for backwards
+      compatibility.  It regularly has vulnerabilities, and the capabilities
+      it provides are redundant with userspace crypto libraries.
+
+      Enable this only if needed for support for a program that hasn't yet
+      been converted to userspace crypto, for example iwd.
+
+      See also Documentation/crypto/userspace-if.rst

config CRYPTO_USER_API_SKCIPHER

crypto/Kconfig +14 -4
-    tristate "Symmetric key cipher algorithms"
+    tristate "Symmetric key cipher algorithms (deprecated)"
   depends on NET
   select CRYPTO_SKCIPHER
   select CRYPTO_USER_API
   help
-      Enable the userspace interface for symmetric key cipher algorithms.
+      Enable the AF_ALG userspace interface for symmetric key algorithms.
+      This provides unprivileged userspace programs access to arbitrary
+      symmetric key algorithms implemented in the kernel's privileged
+      execution context.
+
+      This interface is deprecated and is supported only for backwards
+      compatibility.  It regularly has vulnerabilities, and the capabilities
+      it provides are redundant with userspace crypto libraries.
+
+      Enable this only if needed for support for a program that hasn't yet
+      been converted to userspace crypto, for example iwd, or cryptsetup
+      with certain algorithms.
 
-      See Documentation/crypto/userspace-if.rst and
-      https://www.chronox.de/libkcapi/html/index.html
+      See also Documentation/crypto/userspace-if.rst

config CRYPTO_USER_API_RNG

crypto/Kconfig +11 -5
-    tristate "RNG (random number generator) algorithms"
+    tristate "Random number generation algorithms (deprecated)"
   depends on NET
   select CRYPTO_RNG
   select CRYPTO_USER_API
   help
-      Enable the userspace interface for RNG (random number generator)
-      algorithms.
+      Enable the AF_ALG userspace interface for random number generation
+      (RNG) algorithms.  This provides unprivileged userspace programs
+      access to arbitrary RNG algorithms implemented in the kernel's
+      privileged execution context.
 
-      See Documentation/crypto/userspace-if.rst and
-      https://www.chronox.de/libkcapi/html/index.html
+      This interface is deprecated and is supported only for backwards
+      compatibility.  It regularly has vulnerabilities, and the capabilities
+      it provides are redundant with userspace crypto libraries as well as
+      the normal kernel RNG (e.g., /dev/urandom and getrandom(2)).
+
+      See also Documentation/crypto/userspace-if.rst

config CRYPTO_USER_API_RNG_CAVP
bool "Enable CAVP testing of DRBG"
depends on CRYPTO_USER_API_RNG && CRYPTO_DRBG
help

crypto/Kconfig +0 -0
@@ -1330,20 +1354,29 @@ config CRYPTO_USER_API_RNG_CAVP
 
     This should only be enabled for CAVP testing. You should say
     no unless you know what this is.
 

config CRYPTO_USER_API_AEAD

crypto/Kconfig +13 -4
-    tristate "AEAD cipher algorithms"
+    tristate "AEAD cipher algorithms (deprecated)"
   depends on NET
   select CRYPTO_AEAD
   select CRYPTO_SKCIPHER
   select CRYPTO_USER_API
   help
-      Enable the userspace interface for AEAD cipher algorithms.
+      Enable the AF_ALG userspace interface for authenticated encryption
+      with associated data (AEAD) algorithms.  This provides unprivileged
+      userspace programs access to arbitrary AEAD algorithms implemented in
+      the kernel's privileged execution context.
+
+      This interface is deprecated and is supported only for backwards
+      compatibility.  It regularly has vulnerabilities, and the capabilities
+      it provides are redundant with userspace crypto libraries.
+
+      Enable this only if needed for support for a program that hasn't yet
+      been converted to userspace crypto, for example iwd.
 
-      See Documentation/crypto/userspace-if.rst and
-      https://www.chronox.de/libkcapi/html/index.html
+      See also Documentation/crypto/userspace-if.rst

config CRYPTO_USER_API_ENABLE_OBSOLETE
bool "Obsolete cryptographic algorithms"
depends on CRYPTO_USER_API
default y

base-commit: 57b8e2d666a31fa201432d58f5fe3469a0dd83ba --
2.54.0

#11 lore raw
Quoted 7 lines · Andy Lutomirski
Quoted 6 lines · Eric Biggers

AF_ALG is almost completely unnecessary, and it exposes a massive attack surface that hasn't been standing up to modern vulnerability discovery tools. The latest one even has its own website, providing a small Python script that reliably roots most Linux distros: https://copy.fail/

Quoted 8 lines

How about adding a configuration option, defaulted on, that requires capable(CAP_SYS_ADMIN) to create the socket (and maybe also to bind / connect it). And a sysctl to allow the administrator to override this in the unlikely event that it’s needed.

IIRC cryptsetup used to and maybe even still does require these sockets sometimes and this would let it keep working. And there's all the FIPS stuff downthread.

Yes, I'd like to add a default-on requirement to hold a capability in the initial user namespace. We're trying to figure out the details.

It sounds like iwd runs with CAP_NET_ADMIN, not necessarily CAP_SYS_ADMIN. So it may need to be:

    has_capability_noaudit(current, CAP_NET_ADMIN) || capable(CAP_SYS_ADMIN)

iwd is being discussed in the thread
https://lore.kernel.org/linux-crypto/[email protected]/

cryptsetup is normally run with CAP_SYS_ADMIN, but not always (e.g., 'cryptsetup benchmark'). It might be acceptable for users to add sudo in the exceptional cases. cryptsetup is being discussed in the thread
https://lore.kernel.org/linux-crypto/[email protected]/

bluez needs investigation.

- Eric

#12 lore raw
In reply to Andy Lutomirski

Hi,

Quoted 7 lines · Andy Lutomirski
Quoted 6 lines · Eric Biggers

AF_ALG is almost completely unnecessary, and it exposes a massive attack surface that hasn't been standing up to modern vulnerability discovery tools. The latest one even has its own website, providing a small Python script that reliably roots most Linux distros: https://copy.fail/

Quoted 8 lines

How about adding a configuration option, defaulted on, that requires capable(CAP_SYS_ADMIN) to create the socket (and maybe also to bind / connect it). And a sysctl to allow the administrator to override this in the unlikely event that it’s needed.

IIRC cryptsetup used to and maybe even still does require these sockets sometimes and this would let it keep working. And there's all the FIPS stuff downthread.

Apologize in advance for the long-winded answer.

The "FIPS stuff" centers on using sha512hmac -> libkcapi -> AF_ALG for verifying integrity. The early‑boot sha512hmac check that some distributions use (typically from initramfs) sits at an awkward intersection of multiple standards, and it may help to clarify where it actually fits and where it doesn't.

From a standards perspective, FIPS 140‑3 requires a cryptographic module to perform self‑integrity verification using an approved algorithm and to prevent the module from entering an operational state on failure. In the Linux kernel, the cryptographic module is the kernel crypto subsystem, and these requirements are met by the kernel’s internal power‑up self‑tests (KATs, etc.) on the crypto code and critical data as loaded into memory.

FIPS 199 / SP 800‑53 (e.g., SI‑7) impose system‑level integrity requirements (for Moderate impact systems), i.e., that unauthorized modification of critical components is prevented or detected and that failures result in a protective action. These controls are explicitly technology‑agnostic and are not limited to cryptographic‑module self‑tests.

The sha512hmac check is not the FIPS 140‑3 cryptographic‑module self‑integrity test. Instead, it has historically been used as a system integrity control that provides auditors with assurance that the kernel image containing the cryptographic module has not been modified prior to execution, and that a failure will halt the boot.

Although FIPS 140‑3 does not mandate an HMAC over the kernel image, the early‑boot HMAC became an accepted evidence pattern for satisfying system‑integrity expectations (FIPS 199 / SI‑7) alongside a kernel crypto validation. This is why it is often perceived as “required” for FIPS submissions, even though it is not normatively required by FIPS 140‑3 itself.

With the deprecation/removal of AF_ALG for this use case, there is no longer a supported way to perform an early‑boot, userspace‑driven HMAC using validated kernel crypto without introducing circular dependencies (e.g., relying on userspace crypto before crypto self‑tests complete). As a result, there is no drop‑in replacement for sha512hmac that preserves all of its historical properties.

This is a new development that challenges a long‑standing assumption:
that system‑integrity evidence and cryptographic‑module self‑integrity can be cleanly separated while still being demonstrated by a single early‑boot mechanism. That assumption no longer holds given proposed kernel interfaces.

A more accurate decomposition (and one that aligns with the intent of the standards) is to separate integrity enforcement by system phase.

1. Secure Boot (or equivalent platform verification) ensures that a modified kernel image is not executed at all. This satisfies the requirement that critical components are not loaded in a modified state and that integrity failure results in a protective action (boot prevention).

2. IMA (with appraisal and enforcement) ensures that modified executables, modules, or firmware cannot be loaded or executed once the kernel is running.

3. Kernel crypto self‑tests continue to satisfy FIPS 140‑3 self‑integrity requirements independently of the above.

Taken together, Secure Boot + IMA provide continuous system‑integrity enforcement without re‑introducing early‑boot HMACs or AF_ALG dependencies, while keeping cryptographic‑module self‑integrity correctly scoped to the kernel crypto subsystem.

The transition away from sha512hmac is therefore not a removal of integrity enforcement, but a shift from a single, early‑boot mechanism to a phased integrity model that better reflects the separation of concerns already present in the standards — even though this separation was previously masked by the hacky HMAC approach.

This change will require updated documentation and auditor education, but it reflects the current technical reality and avoids perpetuating an interface that no longer has a sustainable implementation path.

Quoted 279 lines
Quoted 278 lines

This isn't sustainable, especially as LLMs have accelerated the rate the vulnerabilities are coming in. The effort that is being put into this thing is vastly disproportional to the few programs that actually use it, and those programs would be better served by userspace code anyway.

These issues have been noted in many mailing list discussions already. But until now they haven't been reflected in the documentation or kconfig menu itself, and the vulnerabilities are still coming in.

Let's go ahead and document the deprecation.

This isn't intended to change anything overnight. After all, most Linux distros won't be able to disable the kconfig options quite yet, mainly because of iwd. But this should create a bit more impetus for these userspace programs to be fixed, and the documentation update should also help prevent more users from appearing.

---

This patch is targeting crypto/master

Documentation/crypto/userspace-if.rst | 82 ++++++++++++++++++++-------
crypto/Kconfig | 69 ++++++++++++++++------

2 files changed, 113 insertions(+), 38 deletions(-)
Documentation/crypto/userspace-if.rst +0 -0
index 021759198fe7..c39f5c79a5b7 100644
@@ -2,30 +2,72 @@ User Space Interface

====================

Introduction
------------

Documentation/crypto/userspace-if.rst +5 -20
-The 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.
-
-The major difference, however, is that user space can only act as a
-consumer and never as a provider of a transformation or cipher
-algorithm.
-
-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.
-
-Some 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.
-
-[1] https://www.chronox.de/libkcapi/index.html
+AF_ALG provides unprivileged userspace programs access to arbitrary hash,
+symmetric cipher, AEAD, and RNG algorithms that are implemented in kernel-mode
+code.
+
+AF_ALG is insecure and is deprecated. Originally added to the kernel

in 2010,

Documentation/crypto/userspace-if.rst +3 -0
+most kernel developers now consider it to be a mistake.
+
+AF_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

Documentation/crypto/userspace-if.rst +6 -0
+disabling ``CONFIG_CRYPTO_USER_API_*``.
+
+Deprecation
+-----------
+
+AF_ALG was originally intended to provide userspace programs access

to crypto

Documentation/crypto/userspace-if.rst +3 -0
+accelerators that they wouldn't otherwise have access to.
+
+However, that capability turned out to not be useful on very many

systems. More
+significantly, the actual implementation exposes a vastly greater amount of

Documentation/crypto/userspace-if.rst +3 -0
+functionality than that. It actually provides access to all software algorithms.
+
+This includes arbitrary compositions of different algorithms created

via a
+complex template system, as well as algorithms that only make sense as internal

Documentation/crypto/userspace-if.rst +4 -0
+implementation details of other algorithms. It also includes full zero-copy
+support, which is difficult for the kernel to implement securely.
+
+Ultimately, these algorithms are just math computations. They use

the same
+instructions that userspace programs already have access to, just accessed in a

Documentation/crypto/userspace-if.rst +3 -0
+much more convoluted and less efficient way.
+
+Indeed, userspace code is nearly always what is being used anyway.

These same

Documentation/crypto/userspace-if.rst +3 -0
+algorithms are widely implemented in userspace crypto libraries.
+
+Meanwhile, AF_ALG hasn't been withstanding modern vulnerability

discovery tools
+such as syzbot and large language models. It receives a steady stream of CVEs.

Documentation/crypto/userspace-if.rst +21 -0
+Some of the examples include:
+
+- CVE-2026-31677
+- CVE-2026-31431 (https://copy.fail)
+- CVE-2025-38079
+- CVE-2025-37808
+- CVE-2024-26824
+- CVE-2022-48781
+- CVE-2019-8912
+- CVE-2018-14619
+- CVE-2017-18075
+- CVE-2017-17806
+- CVE-2017-17805
+- CVE-2016-10147
+- CVE-2015-8970
+- CVE-2015-3331
+- CVE-2014-9644
+- CVE-2013-7421
+- CVE-2011-4081
+
+It is recommended that, whenever possible, userspace programs be

migrated to
+userspace crypto code (which again, is what is normally used anyway) and +``CONFIG_CRYPTO_USER_API_*`` be disabled. On systems that use SELinux, SELinux

Documentation/crypto/userspace-if.rst +3 -0
+can also be used to restrict the use of AF_ALG to trusted programs.
+
+The remainder of this documentation provides the historical

documentation for
+the deprecated AF_ALG interface.

User Space API General Remarks
------------------------------

The kernel crypto API is accessible from user space. Currently, the

crypto/Kconfig +0 -0
index 103d1f58cb7c..6cd1c478d4be 100644
@@ -1278,48 +1278,72 @@ config CRYPTO_DF80090A
   tristate
   select CRYPTO_AES
   select CRYPTO_CTR
 

endmenu

crypto/Kconfig +1 -1
-menu "Userspace interface"
+menu "Userspace interface (deprecated)"

config CRYPTO_USER_API
tristate

config CRYPTO_USER_API_HASH

crypto/Kconfig +9 -4
-    tristate "Hash algorithms"
+    tristate "Hash algorithms (deprecated)"
   depends on NET
   select CRYPTO_HASH
   select CRYPTO_USER_API
   help
-      Enable the userspace interface for hash algorithms.
+      Enable the AF_ALG userspace interface for hash algorithms.  This
+      provides unprivileged userspace programs access to arbitrary hash
+      algorithms implemented in the kernel's privileged execution context.
 
-      See Documentation/crypto/userspace-if.rst and
-      https://www.chronox.de/libkcapi/html/index.html
+      This interface is deprecated and is supported only for backwards
+      compatibility.  It regularly has vulnerabilities, and the capabilities
+      it provides are redundant with userspace crypto libraries.
+
+      Enable this only if needed for support for a program that

hasn't yet

crypto/Kconfig +3 -0
+      been converted to userspace crypto, for example iwd.
+
+      See also Documentation/crypto/userspace-if.rst

config CRYPTO_USER_API_SKCIPHER

crypto/Kconfig +11 -2
-    tristate "Symmetric key cipher algorithms"
+    tristate "Symmetric key cipher algorithms (deprecated)"
   depends on NET
   select CRYPTO_SKCIPHER
   select CRYPTO_USER_API
   help
-      Enable the userspace interface for symmetric key cipher algorithms.
+      Enable the AF_ALG userspace interface for symmetric key algorithms.
+      This provides unprivileged userspace programs access to arbitrary
+      symmetric key algorithms implemented in the kernel's privileged
+      execution context.
+
+      This interface is deprecated and is supported only for backwards
+      compatibility.  It regularly has vulnerabilities, and the capabilities
+      it provides are redundant with userspace crypto libraries.
+
+      Enable this only if needed for support for a program that

hasn't yet

crypto/Kconfig +3 -2
+      been converted to userspace crypto, for example iwd, or cryptsetup
+      with certain algorithms.
 
-      See Documentation/crypto/userspace-if.rst and
-      https://www.chronox.de/libkcapi/html/index.html
+      See also Documentation/crypto/userspace-if.rst

config CRYPTO_USER_API_RNG

crypto/Kconfig +8 -5
-    tristate "RNG (random number generator) algorithms"
+    tristate "Random number generation algorithms (deprecated)"
   depends on NET
   select CRYPTO_RNG
   select CRYPTO_USER_API
   help
-      Enable the userspace interface for RNG (random number generator)
-      algorithms.
+      Enable the AF_ALG userspace interface for random number generation
+      (RNG) algorithms.  This provides unprivileged userspace programs
+      access to arbitrary RNG algorithms implemented in the kernel's
+      privileged execution context.
 
-      See Documentation/crypto/userspace-if.rst and
-      https://www.chronox.de/libkcapi/html/index.html
+      This interface is deprecated and is supported only for backwards
+      compatibility.  It regularly has vulnerabilities, and the capabilities
+      it provides are redundant with userspace crypto libraries as

well as

crypto/Kconfig +3 -0
+      the normal kernel RNG (e.g., /dev/urandom and getrandom(2)).
+
+      See also Documentation/crypto/userspace-if.rst

config CRYPTO_USER_API_RNG_CAVP
bool "Enable CAVP testing of DRBG"
depends on CRYPTO_USER_API_RNG && CRYPTO_DRBG
help

crypto/Kconfig +0 -0
@@ -1330,20 +1354,29 @@ config CRYPTO_USER_API_RNG_CAVP
 
     This should only be enabled for CAVP testing. You should say
     no unless you know what this is.
 

config CRYPTO_USER_API_AEAD

crypto/Kconfig +4 -2
-    tristate "AEAD cipher algorithms"
+    tristate "AEAD cipher algorithms (deprecated)"
   depends on NET
   select CRYPTO_AEAD
   select CRYPTO_SKCIPHER
   select CRYPTO_USER_API
   help
-      Enable the userspace interface for AEAD cipher algorithms.
+      Enable the AF_ALG userspace interface for authenticated encryption
+      with associated data (AEAD) algorithms.  This provides unprivileged
+      userspace programs access to arbitrary AEAD algorithms

implemented in

crypto/Kconfig +7 -0
+      the kernel's privileged execution context.
+
+      This interface is deprecated and is supported only for backwards
+      compatibility.  It regularly has vulnerabilities, and the capabilities
+      it provides are redundant with userspace crypto libraries.
+
+      Enable this only if needed for support for a program that

hasn't yet

crypto/Kconfig +2 -2
+      been converted to userspace crypto, for example iwd.
 
-      See Documentation/crypto/userspace-if.rst and
-      https://www.chronox.de/libkcapi/html/index.html
+      See also Documentation/crypto/userspace-if.rst

config CRYPTO_USER_API_ENABLE_OBSOLETE
bool "Obsolete cryptographic algorithms"
depends on CRYPTO_USER_API
default y

base-commit: 57b8e2d666a31fa201432d58f5fe3469a0dd83ba --
2.54.0

#13 lore raw

Hi,

AF_ALG is useful not just for hardware-offloading, but also for memory isolation so that applications only get oracle access to the crypto keys and a memory-safety vulnerability in user applications would not immediately put the secret key material at risk.

I understand and appreciate the concern with complex attack surface and the increased frequency of attacks in this area. But I fear that completely removing AF_ALG increases the risk for userspace applications relying on it for memory isolation.

What alternatives do userspace applications have on Linux for ensuring crypto keys are not exposed in user memory? That is, FreeBSD and NetBSD natively provide /dev/crypto; removing AF_ALG would kill the only equivalent option on the Linux side for kernel-delegated cryptography.

Thanks,
Kamran.

Quoted 378 lines · Jeff Barnes

Hi,

Quoted 7 lines · Andy Lutomirski
Quoted 6 lines · Eric Biggers

AF_ALG is almost completely unnecessary, and it exposes a massive attack surface that hasn't been standing up to modern vulnerability discovery tools. The latest one even has its own website, providing a small Python script that reliably roots most Linux distros: https://copy.fail/

Quoted 8 lines

How about adding a configuration option, defaulted on, that requires capable(CAP_SYS_ADMIN) to create the socket (and maybe also to bind / connect it). And a sysctl to allow the administrator to override this in the unlikely event that it’s needed.

IIRC cryptsetup used to and maybe even still does require these sockets sometimes and this would let it keep working. And there's all the FIPS stuff downthread.

Apologize in advance for the long-winded answer.

The "FIPS stuff" centers on using sha512hmac -> libkcapi -> AF_ALG for verifying integrity. The early‑boot sha512hmac check that some distributions use (typically from initramfs) sits at an awkward intersection of multiple standards, and it may help to clarify where it actually fits and where it doesn't.

From a standards perspective, FIPS 140‑3 requires a cryptographic module
to perform self‑integrity verification using an approved algorithm and to prevent the module from entering an operational state on failure. In the Linux kernel, the cryptographic module is the kernel crypto subsystem, and these requirements are met by the kernel’s internal power‑up self‑tests (KATs, etc.) on the crypto code and critical data as loaded into memory.

FIPS 199 / SP 800‑53 (e.g., SI‑7) impose system‑level integrity requirements (for Moderate impact systems), i.e., that unauthorized modification of critical components is prevented or detected and that failures result in a protective action. These controls are explicitly technology‑agnostic and are not limited to cryptographic‑module self‑tests.

The sha512hmac check is not the FIPS 140‑3 cryptographic‑module self‑integrity test. Instead, it has historically been used as a system integrity control that provides auditors with assurance that the kernel image containing the cryptographic module has not been modified prior to execution, and that a failure will halt the boot.

Although FIPS 140‑3 does not mandate an HMAC over the kernel image, the early‑boot HMAC became an accepted evidence pattern for satisfying system‑integrity expectations (FIPS 199 / SI‑7) alongside a kernel crypto validation. This is why it is often perceived as “required” for FIPS submissions, even though it is not normatively required by FIPS 140‑3 itself.

With the deprecation/removal of AF_ALG for this use case, there is no longer a supported way to perform an early‑boot, userspace‑driven HMAC using validated kernel crypto without introducing circular dependencies (e.g., relying on userspace crypto before crypto self‑tests complete). As a result, there is no drop‑in replacement for sha512hmac that preserves all of its historical properties.

This is a new development that challenges a long‑standing assumption:
that system‑integrity evidence and cryptographic‑module self‑integrity can be cleanly separated while still being demonstrated by a single early‑boot mechanism. That assumption no longer holds given proposed kernel interfaces.

A more accurate decomposition (and one that aligns with the intent of the standards) is to separate integrity enforcement by system phase.

1. Secure Boot (or equivalent platform verification) ensures that a modified kernel image is not executed at all. This satisfies the requirement that critical components are not loaded in a modified state and that integrity failure results in a protective action (boot prevention).

2. IMA (with appraisal and enforcement) ensures that modified executables, modules, or firmware cannot be loaded or executed once the kernel is running.

3. Kernel crypto self‑tests continue to satisfy FIPS 140‑3 self‑integrity requirements independently of the above.

Taken together, Secure Boot + IMA provide continuous system‑integrity enforcement without re‑introducing early‑boot HMACs or AF_ALG dependencies, while keeping cryptographic‑module self‑integrity correctly scoped to the kernel crypto subsystem.

The transition away from sha512hmac is therefore not a removal of integrity enforcement, but a shift from a single, early‑boot mechanism to a phased integrity model that better reflects the separation of concerns already present in the standards — even though this separation was previously masked by the hacky HMAC approach.

This change will require updated documentation and auditor education, but it reflects the current technical reality and avoids perpetuating an interface that no longer has a sustainable implementation path.

Quoted 279 lines
Quoted 278 lines

This isn't sustainable, especially as LLMs have accelerated the rate the vulnerabilities are coming in. The effort that is being put into this thing is vastly disproportional to the few programs that actually use it, and those programs would be better served by userspace code anyway.

These issues have been noted in many mailing list discussions already. But until now they haven't been reflected in the documentation or kconfig menu itself, and the vulnerabilities are still coming in.

Let's go ahead and document the deprecation.

This isn't intended to change anything overnight. After all, most Linux distros won't be able to disable the kconfig options quite yet, mainly because of iwd. But this should create a bit more impetus for these userspace programs to be fixed, and the documentation update should also help prevent more users from appearing.

---

This patch is targeting crypto/master

Documentation/crypto/userspace-if.rst | 82 ++++++++++++++++++++-------
crypto/Kconfig | 69 ++++++++++++++++------

2 files changed, 113 insertions(+), 38 deletions(-)
Documentation/crypto/userspace-if.rst +0 -0
index 021759198fe7..c39f5c79a5b7 100644
@@ -2,30 +2,72 @@ User Space Interface

====================

Introduction
------------

Documentation/crypto/userspace-if.rst +5 -20
-The 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.
-
-The major difference, however, is that user space can only act as a
-consumer and never as a provider of a transformation or cipher
-algorithm.
-
-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.
-
-Some 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.
-
-[1] https://www.chronox.de/libkcapi/index.html
+AF_ALG provides unprivileged userspace programs access to arbitrary hash,
+symmetric cipher, AEAD, and RNG algorithms that are implemented in kernel-mode
+code.
+
+AF_ALG is insecure and is deprecated. Originally added to the kernel

in 2010,

Documentation/crypto/userspace-if.rst +3 -0
+most kernel developers now consider it to be a mistake.
+
+AF_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

Documentation/crypto/userspace-if.rst +6 -0
+disabling ``CONFIG_CRYPTO_USER_API_*``.
+
+Deprecation
+-----------
+
+AF_ALG was originally intended to provide userspace programs access

to crypto

Documentation/crypto/userspace-if.rst +3 -0
+accelerators that they wouldn't otherwise have access to.
+
+However, that capability turned out to not be useful on very many

systems. More
+significantly, the actual implementation exposes a vastly greater amount of

Documentation/crypto/userspace-if.rst +3 -0
+functionality than that. It actually provides access to all software algorithms.
+
+This includes arbitrary compositions of different algorithms created

via a
+complex template system, as well as algorithms that only make sense as internal

Documentation/crypto/userspace-if.rst +4 -0
+implementation details of other algorithms. It also includes full zero-copy
+support, which is difficult for the kernel to implement securely.
+
+Ultimately, these algorithms are just math computations. They use

the same
+instructions that userspace programs already have access to, just accessed in a

Documentation/crypto/userspace-if.rst +3 -0
+much more convoluted and less efficient way.
+
+Indeed, userspace code is nearly always what is being used anyway.

These same

Documentation/crypto/userspace-if.rst +3 -0
+algorithms are widely implemented in userspace crypto libraries.
+
+Meanwhile, AF_ALG hasn't been withstanding modern vulnerability

discovery tools
+such as syzbot and large language models. It receives a steady stream of CVEs.

Documentation/crypto/userspace-if.rst +21 -0
+Some of the examples include:
+
+- CVE-2026-31677
+- CVE-2026-31431 (https://copy.fail)
+- CVE-2025-38079
+- CVE-2025-37808
+- CVE-2024-26824
+- CVE-2022-48781
+- CVE-2019-8912
+- CVE-2018-14619
+- CVE-2017-18075
+- CVE-2017-17806
+- CVE-2017-17805
+- CVE-2016-10147
+- CVE-2015-8970
+- CVE-2015-3331
+- CVE-2014-9644
+- CVE-2013-7421
+- CVE-2011-4081
+
+It is recommended that, whenever possible, userspace programs be

migrated to
+userspace crypto code (which again, is what is normally used anyway) and +``CONFIG_CRYPTO_USER_API_*`` be disabled. On systems that use SELinux, SELinux

Documentation/crypto/userspace-if.rst +3 -0
+can also be used to restrict the use of AF_ALG to trusted programs.
+
+The remainder of this documentation provides the historical

documentation for
+the deprecated AF_ALG interface.

User Space API General Remarks
------------------------------

The kernel crypto API is accessible from user space. Currently, the

crypto/Kconfig +0 -0
index 103d1f58cb7c..6cd1c478d4be 100644
@@ -1278,48 +1278,72 @@ config CRYPTO_DF80090A
    tristate
    select CRYPTO_AES
    select CRYPTO_CTR
 

endmenu

crypto/Kconfig +1 -1
-menu "Userspace interface"
+menu "Userspace interface (deprecated)"

config CRYPTO_USER_API
tristate

config CRYPTO_USER_API_HASH

crypto/Kconfig +9 -4
-    tristate "Hash algorithms"
+    tristate "Hash algorithms (deprecated)"
    depends on NET
    select CRYPTO_HASH
    select CRYPTO_USER_API
    help
-      Enable the userspace interface for hash algorithms.
+      Enable the AF_ALG userspace interface for hash algorithms.  This
+      provides unprivileged userspace programs access to arbitrary hash
+      algorithms implemented in the kernel's privileged execution context.
 
-      See Documentation/crypto/userspace-if.rst and
-      https://www.chronox.de/libkcapi/html/index.html
+      This interface is deprecated and is supported only for backwards
+      compatibility.  It regularly has vulnerabilities, and the capabilities
+      it provides are redundant with userspace crypto libraries.
+
+      Enable this only if needed for support for a program that

hasn't yet

crypto/Kconfig +3 -0
+      been converted to userspace crypto, for example iwd.
+
+      See also Documentation/crypto/userspace-if.rst

config CRYPTO_USER_API_SKCIPHER

crypto/Kconfig +11 -2
-    tristate "Symmetric key cipher algorithms"
+    tristate "Symmetric key cipher algorithms (deprecated)"
    depends on NET
    select CRYPTO_SKCIPHER
    select CRYPTO_USER_API
    help
-      Enable the userspace interface for symmetric key cipher algorithms.
+      Enable the AF_ALG userspace interface for symmetric key algorithms.
+      This provides unprivileged userspace programs access to arbitrary
+      symmetric key algorithms implemented in the kernel's privileged
+      execution context.
+
+      This interface is deprecated and is supported only for backwards
+      compatibility.  It regularly has vulnerabilities, and the capabilities
+      it provides are redundant with userspace crypto libraries.
+
+      Enable this only if needed for support for a program that

hasn't yet

crypto/Kconfig +3 -2
+      been converted to userspace crypto, for example iwd, or cryptsetup
+      with certain algorithms.
 
-      See Documentation/crypto/userspace-if.rst and
-      https://www.chronox.de/libkcapi/html/index.html
+      See also Documentation/crypto/userspace-if.rst

config CRYPTO_USER_API_RNG

crypto/Kconfig +8 -5
-    tristate "RNG (random number generator) algorithms"
+    tristate "Random number generation algorithms (deprecated)"
    depends on NET
    select CRYPTO_RNG
    select CRYPTO_USER_API
    help
-      Enable the userspace interface for RNG (random number generator)
-      algorithms.
+      Enable the AF_ALG userspace interface for random number generation
+      (RNG) algorithms.  This provides unprivileged userspace programs
+      access to arbitrary RNG algorithms implemented in the kernel's
+      privileged execution context.
 
-      See Documentation/crypto/userspace-if.rst and
-      https://www.chronox.de/libkcapi/html/index.html
+      This interface is deprecated and is supported only for backwards
+      compatibility.  It regularly has vulnerabilities, and the capabilities
+      it provides are redundant with userspace crypto libraries as

well as

crypto/Kconfig +3 -0
+      the normal kernel RNG (e.g., /dev/urandom and getrandom(2)).
+
+      See also Documentation/crypto/userspace-if.rst

config CRYPTO_USER_API_RNG_CAVP
bool "Enable CAVP testing of DRBG"
depends on CRYPTO_USER_API_RNG && CRYPTO_DRBG
help

crypto/Kconfig +0 -0
@@ -1330,20 +1354,29 @@ config CRYPTO_USER_API_RNG_CAVP
 
      This should only be enabled for CAVP testing. You should say
      no unless you know what this is.
 

config CRYPTO_USER_API_AEAD

crypto/Kconfig +4 -2
-    tristate "AEAD cipher algorithms"
+    tristate "AEAD cipher algorithms (deprecated)"
    depends on NET
    select CRYPTO_AEAD
    select CRYPTO_SKCIPHER
    select CRYPTO_USER_API
    help
-      Enable the userspace interface for AEAD cipher algorithms.
+      Enable the AF_ALG userspace interface for authenticated encryption
+      with associated data (AEAD) algorithms.  This provides unprivileged
+      userspace programs access to arbitrary AEAD algorithms

implemented in

crypto/Kconfig +7 -0
+      the kernel's privileged execution context.
+
+      This interface is deprecated and is supported only for backwards
+      compatibility.  It regularly has vulnerabilities, and the capabilities
+      it provides are redundant with userspace crypto libraries.
+
+      Enable this only if needed for support for a program that

hasn't yet

crypto/Kconfig +2 -2
+      been converted to userspace crypto, for example iwd.
 
-      See Documentation/crypto/userspace-if.rst and
-      https://www.chronox.de/libkcapi/html/index.html
+      See also Documentation/crypto/userspace-if.rst

config CRYPTO_USER_API_ENABLE_OBSOLETE
bool "Obsolete cryptographic algorithms"
depends on CRYPTO_USER_API
default y

base-commit: 57b8e2d666a31fa201432d58f5fe3469a0dd83ba --
2.54.0

#14 lore raw
Quoted 6 lines · Kamran Khan

Hi,

AF_ALG is useful not just for hardware-offloading, but also for memory isolation so that applications only get oracle access to the crypto keys and a memory-safety vulnerability in user applications would not immediately put the secret key material at risk.

Note that if that memory-safety vulnerability leads to code execution in the application, then it doesn't matter that it "only" has oracle access. It can still decrypt any data encrypted by that key.

The relevant threat model would be arbitrary reads, not any "memory-safety vulnerability".

Quoted 9 lines

I understand and appreciate the concern with complex attack surface and the increased frequency of attacks in this area. But I fear that completely removing AF_ALG increases the risk for userspace applications relying on it for memory isolation.

What alternatives do userspace applications have on Linux for ensuring crypto keys are not exposed in user memory? That is, FreeBSD and NetBSD natively provide /dev/crypto; removing AF_ALG would kill the only equivalent option on the Linux side for kernel-delegated cryptography.

The standard solution is simply to use an isolated userspace process like ssh-agent. Yes, the keys will be in "user memory". But "not exposed in user memory" is *not* a correct statement of the problem.

(Also note that protecting not-actively-in-use data from arbitrary read primitives doesn't require cryptography at all. That can be done simply by using mprotect() to remove read permission from the memory, then temporarily adding it back when it needs to be accessed.)

In any case, any hypothetical security benefit provided by AF_ALG would have to be *very high* to outweigh the continuous stream of vulnerabilities in it. I understand that people using AF_ALG might not be familiar with that continuous stream of vulnerabilities, but it would be worth spending some time researching what has been going on.

- Eric

#15 lore raw
Quoted 5 lines · Eric Biggers

In any case, any hypothetical security benefit provided by AF_ALG would have to be *very high* to outweigh the continuous stream of vulnerabilities in it. I understand that people using AF_ALG might not be familiar with that continuous stream of vulnerabilities, but it would be worth spending some time researching what has been going on.

It would not be completely crazy to have a simple, straightforward interface by which user code could ask the kernel to do a cryptographic operation. Think:

int compute_keyed_hash(int key_fd, const void *data, size_t len);

where key_fd encodes both the key and the hash type (HMAC-SHA256 or whatever), and there is a very, very small menu of hashes to choose from.

But this is not really obviously worth the hassle. And AF_ALG is definitely not the right interface.

#16 lore raw
In reply to Eric Biggers
Quoted 10 lines · Eric Biggers
Quoted 6 lines · Kamran Khan

Hi,

AF_ALG is useful not just for hardware-offloading, but also for memory isolation so that applications only get oracle access to the crypto keys and a memory-safety vulnerability in user applications would not immediately put the secret key material at risk.

Note that if that memory-safety vulnerability leads to code execution in the application, then it doesn't matter that it "only" has oracle access. It can still decrypt any data encrypted by that key.

I don't think fully discounting hardware offloading is beneficial here. HW accelerators will be produced and without a common interface vendors would start implementing their own "bespoke" drivers with bespoke userspace interfaces (we already had such proposals), which in turn may introduce more attack surface. Yes, AF_ALG needs substantial improvement, but at least it can be a standardisation point.

Quoted 21 lines

The relevant threat model would be arbitrary reads, not any "memory-safety vulnerability".

Quoted 9 lines

I understand and appreciate the concern with complex attack surface and the increased frequency of attacks in this area. But I fear that completely removing AF_ALG increases the risk for userspace applications relying on it for memory isolation.

What alternatives do userspace applications have on Linux for ensuring crypto keys are not exposed in user memory? That is, FreeBSD and NetBSD natively provide /dev/crypto; removing AF_ALG would kill the only equivalent option on the Linux side for kernel-delegated cryptography.

The standard solution is simply to use an isolated userspace process like ssh-agent. Yes, the keys will be in "user memory". But "not exposed in user memory" is *not* a correct statement of the problem.

(Also note that protecting not-actively-in-use data from arbitrary read primitives doesn't require cryptography at all. That can be done simply by using mprotect() to remove read permission from the memory, then temporarily adding it back when it needs to be accessed.)

Quoted 4 lines

In any case, any hypothetical security benefit provided by AF_ALG would have to be *very high* to outweigh the continuous stream of vulnerabilities in it. I understand that people using AF_ALG might not be familiar with that continuous stream of vulnerabilities, but it would

Is it actually that much compared to other features/subsystems, like eBPF or user namespaces? But we don't rush to deprecate those - instead trying to harden them and come up with better design.

Quoted 3 lines

be worth spending some time researching what has been going on.

- Eric

Ignat

#17 lore raw
Quoted 6 lines · Ignat Korchagin

I don't think fully discounting hardware offloading is beneficial here. HW accelerators will be produced and without a common interface vendors would start implementing their own "bespoke" drivers with bespoke userspace interfaces (we already had such proposals), which in turn may introduce more attack surface. Yes, AF_ALG needs substantial improvement, but at least it can be a standardisation point.

That isn't the best way to accelerate symmetric crypto anymore though, if it ever was. This has been known for a long time.

Quoted 9 lines
Quoted 4 lines

In any case, any hypothetical security benefit provided by AF_ALG would have to be *very high* to outweigh the continuous stream of vulnerabilities in it. I understand that people using AF_ALG might not be familiar with that continuous stream of vulnerabilities, but it would

Is it actually that much compared to other features/subsystems, like eBPF or user namespaces? But we don't rush to deprecate those - instead trying to harden them and come up with better design.

There are plenty of other kernel features with a large attack surface, of course. But they tend to be much more useful than AF_ALG. It's all about weighing benefits vs. risks.

When we get the point where a large number of Linux users *had* to disable AF_ALG as an emergency vulnerability response, and at the same time their systems weren't even using AF_ALG so nothing even broke and they could have just done that to begin with, I think we get a very clear idea of which side is heavier for AF_ALG in the real world.

The main relevance of AF_ALG to the Linux community is that it allows their systems to be exploited.

- Eric

#18 lore raw
Quoted 18 lines · Eric Biggers
Quoted 6 lines · Ignat Korchagin

I don't think fully discounting hardware offloading is beneficial here. HW accelerators will be produced and without a common interface vendors would start implementing their own "bespoke" drivers with bespoke userspace interfaces (we already had such proposals), which in turn may introduce more attack surface. Yes, AF_ALG needs substantial improvement, but at least it can be a standardisation point.

That isn't the best way to accelerate symmetric crypto anymore though, if it ever was. This has been known for a long time.

Quoted 6 lines
Quoted 4 lines

In any case, any hypothetical security benefit provided by AF_ALG would have to be *very high* to outweigh the continuous stream of vulnerabilities in it. I understand that people using AF_ALG might not be familiar with that continuous stream of vulnerabilities, but it would

Quoted 7 lines
Quoted 3 lines

Is it actually that much compared to other features/subsystems, like eBPF or user namespaces? But we don't rush to deprecate those - instead trying to harden them and come up with better design.

There are plenty of other kernel features with a large attack surface, of course. But they tend to be much more useful than AF_ALG. It's all about weighing benefits vs. risks.

If divide number of CVEs in such systems on imaginary units of usefulness, I think the ratio is similar.

Quoted 4 lines

When we get the point where a large number of Linux users *had* to disable AF_ALG as an emergency vulnerability response, and at the same time their systems weren't even using AF_ALG so nothing even broke and they could have just done that to begin with, I think we get a very

Well, there were: cryptsetup, RHEL fips check, so there are some...

Quoted 1 line

clear idea of which side is heavier for AF_ALG in the real world.

Same thing could be said for unprivileged user namespaces - distros even put a custom sysctl to restrict it and no-one noticed.

Quoted 2 lines

The main relevance of AF_ALG to the Linux community is that it allows their systems to be exploited.

To be clear I'm not arguing for the current AF_ALG implementation. I agree, the splice zero-copy is... suboptimal (to be soft) and is actually not-so-zero copy. But I think it was just added before we had more modern approaches like io_uring (have their own can of worms, but hey - people adopt it fast).

But I advocate for the usefulness of the concept itself - kernel/OS providing crypto services to userspace. As mentioned in other threads, other operating systems have it and Linux lags behind. There are use
cases: common interface for HW accelerators, embedded systems, which don't have the space to bring a userspace lib etc. Even non-technical:
there are environments that just don't want to rely on third-party userspace libraries like OpenSSL purely for licensing reasons. And I agree, that it is hard to do it right, but we can piggy-back on other subsystems (such as io_uring mentioned or other ideas).

Quoted 2 lines

- Eric

Ignat

#19 lore raw
Quoted 38 lines · Ignat Korchagin
Quoted 25 lines · Eric Biggers
Quoted 1 line · Ignat Korchagin

I don't think fully discounting hardware offloading is beneficial

here. HW

Quoted 1 line

accelerators will be produced and without a common interface

vendors would

Quoted 2 lines

start implementing their own "bespoke" drivers with bespoke userspace interfaces (we already had such proposals), which in turn may

introduce more

Quoted 1 line

attack surface. Yes, AF_ALG needs substantial improvement, but at

least it

Quoted 1 line

can be a standardisation point.

That isn't the best way to accelerate symmetric crypto anymore though, if it ever was. This has been known for a long time.

Quoted 3 lines
Quoted 3 lines

In any case, any hypothetical security benefit provided by AF_ALG would have to be *very high* to outweigh the continuous stream of vulnerabilities in it. I understand that people using AF_ALG

might not

Quoted 1 line
Quoted 1 line

be familiar with that continuous stream of vulnerabilities, but

it would

Quoted 3 lines

Is it actually that much compared to other features/subsystems,

Quoted 8 lines

like eBPF or

Quoted 1 line

user namespaces? But we don't rush to deprecate those - instead

trying to

Quoted 1 line

harden them and come up with better design.

There are plenty of other kernel features with a large attack surface, of course. But they tend to be much more useful than AF_ALG. It's all about weighing benefits vs. risks.

If divide number of CVEs in such systems on imaginary units of usefulness, I think the ratio is similar.

Quoted 6 lines
Quoted 4 lines

When we get the point where a large number of Linux users *had* to disable AF_ALG as an emergency vulnerability response, and at the same time their systems weren't even using AF_ALG so nothing even broke and they could have just done that to begin with, I think we get a very

Well, there were: cryptsetup, RHEL fips check, so there are some...

cryptsetup does not have a hard dependency on AF_ALG. It is a potential consumer via AF_ALG.

AF_ALG provides a broad, hard-to-control interface cryptsetup (and similar tools) are not blockers

AF_ALG removal does not necessarily break cryptsetup usage. Removal does improve FIPS boundary clarity.

Quoted 25 lines
Quoted 2 lines

clear idea of which side is heavier for AF_ALG in the real world.

Same thing could be said for unprivileged user namespaces - distros even put a custom sysctl to restrict it and no-one noticed.

Quoted 2 lines

The main relevance of AF_ALG to the Linux community is that it allows their systems to be exploited.

To be clear I'm not arguing for the current AF_ALG implementation. I agree, the splice zero-copy is... suboptimal (to be soft) and is actually not-so-zero copy. But I think it was just added before we had more modern approaches like io_uring (have their own can of worms, but hey - people adopt it fast).

But I advocate for the usefulness of the concept itself - kernel/OS providing crypto services to userspace. As mentioned in other threads, other operating systems have it and Linux lags behind. There are use
cases: common interface for HW accelerators, embedded systems, which don't have the space to bring a userspace lib etc. Even non-technical:
there are environments that just don't want to rely on third-party userspace libraries like OpenSSL purely for licensing reasons. And I agree, that it is hard to do it right, but we can piggy-back on other subsystems (such as io_uring mentioned or other ideas).

Quoted 5 lines
Quoted 2 lines

- Eric

Ignat

Jeff

#20 lore raw
In reply to Eric Biggers

Hey,

Replying to this older patch.

On Wed, 2026-04-29 at 18:15 -0700, Eric Biggers wrote:
<snip>

Quoted 5 lines

This isn't intended to change anything overnight.  After all, most Linux distros won't be able to disable the kconfig options quite yet, mainly because of iwd.  But this should create a bit more impetus for these userspace programs to be fixed, and the documentation update should also help prevent more users from appearing.

There are 2 other users that I know of: bluez, and the ell library (used by iwd and bluez).

From what I could tell, bluetoothd uses AF_ALG for cryptography:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/shared/crypto.c
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/tools/mesh-gatt/crypto.c

It uses "ecb(aes)" and "cmac(aes)" as algorithms.

Finally, it also uses them both again:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/mesh/crypto.c
through ell:
https://git.kernel.org/pub/scm/libs/ell/ell.git/tree/ell/cipher.c

Because that's a question that also came up, bluetoothd also uses the CAP_NET_ADMIN capability.

I'll let Luiz and Marcel take it over from here.

Cheers

#21 lore raw
Quoted 26 lines · Bastien Nocera

Hey,

Replying to this older patch.

On Wed, 2026-04-29 at 18:15 -0700, Eric Biggers wrote:
<snip>

Quoted 5 lines

This isn't intended to change anything overnight.  After all, most Linux distros won't be able to disable the kconfig options quite yet, mainly because of iwd.  But this should create a bit more impetus for these userspace programs to be fixed, and the documentation update should also help prevent more users from appearing.

There are 2 other users that I know of: bluez, and the ell library (used by iwd and bluez).

From what I could tell, bluetoothd uses AF_ALG for cryptography:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/shared/crypto.c
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/tools/mesh-gatt/crypto.c

It uses "ecb(aes)" and "cmac(aes)" as algorithms.

Finally, it also uses them both again:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/mesh/crypto.c
through ell:
https://git.kernel.org/pub/scm/libs/ell/ell.git/tree/ell/cipher.c

Quoted 5 lines

Because that's a question that also came up, bluetoothd also uses the CAP_NET_ADMIN capability.

I'll let Luiz and Marcel take it over from here.

We're aware of that and are taking it into account in the allowlist:
https://lore.kernel.org/linux-crypto/[email protected]/
If you have any feedback on the allowlist, please respond to that patch.

- Eric

#22 lore raw
Quoted 2 lines · Eric Biggers

We're aware of that and are taking it into account in the allowlist:

Note that if we can just unconditionally make it depend on CAP_NET_ADMIN, that would be good - independently of any allowlist.

Because if iwd and abluetoothd are the main two users, and both of those already require CAP_NET_ADMIN anyway...

Linus

#23 lore raw
Quoted 9 lines · Linus Torvalds
Quoted 2 lines · Eric Biggers

We're aware of that and are taking it into account in the allowlist:

Note that if we can just unconditionally make it depend on CAP_NET_ADMIN, that would be good - independently of any allowlist.

Because if iwd and abluetoothd are the main two users, and both of those already require CAP_NET_ADMIN anyway...

There's also cryptsetup, including unprivileged benchmarking and also (in theory) formatting support, and pre-7.0 versions of iproute2 which used it for computing SHA-1 hashes of BPF programs.

If we broke unprivileged 'cryptsetup benchmark', some people would definitely notice. However, since it's just a manually-run benchmark anyway, users could just run it with sudo.

I don't know about the iproute2 case.

It depends how aggressive we want to be. My current proposal
(https://lore.kernel.org/linux-crypto/[email protected]/)
has the entries in the allowlist marked as either privileged or unprivileged. There are just a few unprivileged ones, for cryptsetup and iproute2 as mentioned. But we could try doing away with the unprivileged ones entirely and see who complains.

- Eric