crypto: pcrypt - Remove pcrypt
Subsystems (9)
PATCH 1/1 crypto: pcrypt - Remove pcrypt
pcrypt was originally intended to improve IPsec performance. However, it's no longer useful for that. Reports from the rare cases that anyone has actually tried to use it over the years indicate that it actually reduces IPsec performance, e.g.:
* https://github.com/libreswan/libreswan/wiki/Internals:-Cryptographic-Acceleration#obsoleted-ipsec-accelerations
* https://users.strongswan.narkive.com/liqTaTq8/strongswan-problem-with-pcrypt
* https://unix.stackexchange.com/questions/594336/ipsec-multithreading-via-pcrypt-worse-than-single-thread
It's also undocumented and quite difficult to actually use. Its design is also broken, in that any unprivileged program can enable pcrypt systemwide at any time (by instantiating it using AF_ALG).
Meanwhile, pcrypt has been a regular source of bugs, including at least four that have received CVEs.
Let's just remove it. No one seems to care about it anymore other than people looking for vulnerabilities.
---
This patch is targeting cryptodev/master
Documentation/core-api/padata.rst | 6 +- MAINTAINERS | 7 - arch/loongarch/configs/loongson32_defconfig | 1 - arch/loongarch/configs/loongson64_defconfig | 1 - arch/s390/configs/debug_defconfig | 1 - arch/s390/configs/defconfig | 1 - crypto/Kconfig | 10 - crypto/Makefile | 1 - crypto/pcrypt.c | 394 -------------------- include/crypto/pcrypt.h | 39 -- tools/crypto/tcrypt/tcrypt_speed_compare.py | 7 +- 11 files changed, 5 insertions(+), 463 deletions(-) delete mode 100644 crypto/pcrypt.c delete mode 100644 include/crypto/pcrypt.h
Documentation/core-api/padata.rst +3 -3
@@ -55,9 +55,9 @@ processors are allowed to be used as the serialization callback processor. cpumask specifies the new cpumask to use. There may be sysfs files for an instance's cpumasks. For example, pcrypt's -live in /sys/kernel/pcrypt/<instance-name>. Within an instance's directory -there are two files, parallel_cpumask and serial_cpumask, and either cpumask -may be changed by echoing a bitmask into the file, for example:: +used to live in /sys/kernel/pcrypt/<instance-name>. Within an instance's +directory there are two files, parallel_cpumask and serial_cpumask, and either +cpumask may be changed by echoing a bitmask into the file, for example:: echo f > /sys/kernel/pcrypt/pencrypt/parallel_cpumask
MAINTAINERS +0 -7
@@ -21084,13 +21084,6 @@ L: [email protected] S: Maintained F: drivers/net/ethernet/amd/pcnet32.c -PCRYPT PARALLEL CRYPTO ENGINE -M: Steffen Klassert <[email protected]> -L: [email protected] -S: Maintained -F: crypto/pcrypt.c -F: include/crypto/pcrypt.h - PDS DSC VIRTIO DATA PATH ACCELERATOR R: Brett Creeley <[email protected]> F: drivers/vdpa/pds/
arch/loongarch/configs/loongson32_defconfig +0 -1
@@ -1063,7 +1063,6 @@ CONFIG_SECURITY_YAMA=y CONFIG_DEFAULT_SECURITY_DAC=y CONFIG_CRYPTO_USER=m CONFIG_CRYPTO_SELFTESTS=y -CONFIG_CRYPTO_PCRYPT=m CONFIG_CRYPTO_CRYPTD=m CONFIG_CRYPTO_ANUBIS=m CONFIG_CRYPTO_BLOWFISH=m
arch/loongarch/configs/loongson64_defconfig +0 -1
@@ -1096,7 +1096,6 @@ CONFIG_SECURITY_YAMA=y CONFIG_DEFAULT_SECURITY_DAC=y CONFIG_CRYPTO_USER=m CONFIG_CRYPTO_SELFTESTS=y -CONFIG_CRYPTO_PCRYPT=m CONFIG_CRYPTO_CRYPTD=m CONFIG_CRYPTO_ANUBIS=m CONFIG_CRYPTO_BLOWFISH=m
arch/s390/configs/debug_defconfig +0 -1
@@ -765,7 +765,6 @@ CONFIG_CRYPTO_USER=m CONFIG_CRYPTO_SELFTESTS=y CONFIG_CRYPTO_SELFTESTS_FULL=y CONFIG_CRYPTO_NULL=y -CONFIG_CRYPTO_PCRYPT=m CONFIG_CRYPTO_CRYPTD=m CONFIG_CRYPTO_BENCHMARK=m CONFIG_CRYPTO_DH=m
arch/s390/configs/defconfig +0 -1
@@ -749,7 +749,6 @@ CONFIG_CRYPTO_FIPS=y CONFIG_CRYPTO_USER=m CONFIG_CRYPTO_SELFTESTS=y CONFIG_CRYPTO_NULL=y -CONFIG_CRYPTO_PCRYPT=m CONFIG_CRYPTO_CRYPTD=m CONFIG_CRYPTO_BENCHMARK=m CONFIG_CRYPTO_DH=m
crypto/Kconfig +0 -10
@@ -201,16 +201,6 @@ config CRYPTO_NULL help These are 'Null' algorithms, used by IPsec, which do nothing. -config CRYPTO_PCRYPT - tristate "Parallel crypto engine" - depends on SMP - select PADATA - select CRYPTO_MANAGER - select CRYPTO_AEAD - help - This converts an arbitrary crypto algorithm into a parallel - algorithm that executes in kernel threads. - config CRYPTO_CRYPTD tristate "Software async crypto daemon" select CRYPTO_AEAD
crypto/Makefile +0 -1
@@ -120,7 +120,6 @@ CFLAGS_aegis128-neon-inner.o += $(aegis128-cflags-y) aegis128-$(CONFIG_CRYPTO_AEGIS128_SIMD) += aegis128-neon.o aegis128-neon-inner.o endif -obj-$(CONFIG_CRYPTO_PCRYPT) += pcrypt.o obj-$(CONFIG_CRYPTO_CRYPTD) += cryptd.o obj-$(CONFIG_CRYPTO_DES) += des_generic.o obj-$(CONFIG_CRYPTO_BLOWFISH) += blowfish_generic.o
crypto/pcrypt.c deleted +0 -394
394 lines not on this page · raw message
include/crypto/pcrypt.h deleted +0 -39
@@ -1,39 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* pcrypt - Parallel crypto engine. -* -* Copyright (C) 2009 secunet Security Networks AG -* Copyright (C) 2009 Steffen Klassert <[email protected]> -*/ - -#ifndef _CRYPTO_PCRYPT_H -#define _CRYPTO_PCRYPT_H - -#include <linux/container_of.h> -#include <linux/crypto.h> -#include <linux/padata.h> - -struct pcrypt_request { -struct padata_priv padata; -void *data; - void *__ctx[] CRYPTO_MINALIGN_ATTR; -}; - -static inline void *pcrypt_request_ctx (struct pcrypt_request *req) -{ -return req->__ctx; -} - -static inline -struct padata_priv *pcrypt_request_padata (struct pcrypt_request *req) -{ -return &req->padata; -} - -static inline -struct pcrypt_request *pcrypt_padata_request (struct padata_priv *padata) -{ - return container_of(padata, struct pcrypt_request, padata); -} - -#endif
tools/crypto/tcrypt/tcrypt_speed_compare.py +2 -5
@@ -28,19 +28,16 @@ num_mb=8 mode=211 # base speed test -lsmod | grep pcrypt && modprobe -r pcrypt dmesg -C -modprobe tcrypt alg="pcrypt(rfc4106(gcm(aes)))" type=3 +modprobe tcrypt alg="rfc4106(gcm(aes))" type=3 modprobe tcrypt mode=${mode} sec=${sec} num_mb=${num_mb} dmesg > ${seq_num}_base_dmesg.log # new speed test -lsmod | grep pcrypt && modprobe -r pcrypt dmesg -C -modprobe tcrypt alg="pcrypt(rfc4106(gcm(aes)))" type=3 +modprobe tcrypt alg="rfc4106(gcm(aes))" type=3 modprobe tcrypt mode=${mode} sec=${sec} num_mb=${num_mb} dmesg > ${seq_num}_new_dmesg.log -lsmod | grep pcrypt && modprobe -r pcrypt tools/crypto/tcrypt/tcrypt_speed_compare.py \ ${seq_num}_base_dmesg.log \
base-commit: e264401ce4776a288524e5b87593d4d864147115
Signature · 1 line
2.55.0
Herbert Xu
maintainerQuoted 13 lines · Eric Biggers
pcrypt was originally intended to improve IPsec performance. However, it's no longer useful for that. Reports from the rare cases that anyone has actually tried to use it over the years indicate that it actually reduces IPsec performance, e.g.:
* https://github.com/libreswan/libreswan/wiki/Internals:-Cryptographic-Acceleration#obsoleted-ipsec-accelerations
* https://users.strongswan.narkive.com/liqTaTq8/strongswan-problem-with-pcrypt
* https://unix.stackexchange.com/questions/594336/ipsec-multithreading-via-pcrypt-worse-than-single-threadIt's also undocumented and quite difficult to actually use. Its design is also broken, in that any unprivileged program can enable pcrypt systemwide at any time (by instantiating it using
AF_ALG).
Quoted 8 lines
Meanwhile, pcrypt has been a regular source of bugs, including at least four that have received CVEs.
Let's just remove it. No one seems to care about it anymore other than people looking for vulnerabilities.
Cc Steffen Klassert <[email protected]>Signed-off-by Eric Biggers <[email protected]>
Looks good to me.
More than half of kernel/padata.c is only used by pcrypt and can also be removed if pcrypt is removed.
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
Quoted 6 lines · Herbert Xu
Looks good to me.
More than half of
kernel/padata.cis only used by pcrypt and can also be removed if pcrypt is removed.Thanks,
Yes, that would be a separate patch.
- Eric
Quoted 37 lines · Eric Biggers
pcrypt was originally intended to improve IPsec performance. However, it's no longer useful for that. Reports from the rare cases that anyone has actually tried to use it over the years indicate that it actually reduces IPsec performance, e.g.:
* https://github.com/libreswan/libreswan/wiki/Internals:-Cryptographic-Acceleration#obsoleted-ipsec-accelerations
* https://users.strongswan.narkive.com/liqTaTq8/strongswan-problem-with-pcrypt
* https://unix.stackexchange.com/questions/594336/ipsec-multithreading-via-pcrypt-worse-than-single-threadIt's also undocumented and quite difficult to actually use. Its design is also broken, in that any unprivileged program can enable pcrypt systemwide at any time (by instantiating it using
AF_ALG).Meanwhile, pcrypt has been a regular source of bugs, including at least four that have received CVEs.
Let's just remove it. No one seems to care about it anymore other than people looking for vulnerabilities.
Cc Steffen Klassert <[email protected]>Signed-off-by Eric Biggers <[email protected]>---
This patch is targeting cryptodev/master
Documentation/core-api/padata.rst | 6 +- MAINTAINERS | 7 - arch/loongarch/configs/loongson32_defconfig | 1 - arch/loongarch/configs/loongson64_defconfig | 1 - arch/s390/configs/debug_defconfig | 1 - arch/s390/configs/defconfig | 1 - crypto/Kconfig | 10 - crypto/Makefile | 1 - crypto/pcrypt.c | 394 -------------------- include/crypto/pcrypt.h | 39 -- tools/crypto/tcrypt/tcrypt_speed_compare.py | 7 +- 11 files changed, 5 insertions(+), 463 deletions(-)
Quoted 2 lines
delete mode 100644
crypto/pcrypt.c
delete mode 100644include/crypto/pcrypt.h
Thanks for the patch, I think it's a good idea!
Quoted 6 lines
Documentation/core-api/padata.rst +0
-0@@ -55,9 +55,9 @@ processors are allowed to be used as the serialization callback processor. cpumask specifies the new cpumask to use.
Documentation/core-api/padata.rst processors are allowed to be used as the serialization callback processor. · line 62
Quoted 10 lines
Documentation/core-api/padata.rst +3
-3There may be sysfs files for an instance's cpumasks. For example, pcrypt's -live in /sys/kernel/pcrypt/<instance-name>. Within an instance's directory -there are two files, parallel_cpumask and serial_cpumask, and either cpumask -may be changed by echoing a bitmask into the file, for example:: +used to live in /sys/kernel/pcrypt/<instance-name>. Within an instance's +directory there are two files, parallel_cpumask and serial_cpumask, and either +cpumask may be changed by echoing a bitmask into the file, for example:: echo f > /sys/kernel/pcrypt/pencrypt/parallel_cpumask
I'd rather not keep examples for a non-existing sysfs entry around. Could you maybe change it to use e.g. /sys/devices/virtual/workqueue/cpumask instead?
Thomas