2019-05-27 08:55:01 +02:00
|
|
|
|
2008-05-14 20:41:47 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-22 01:10:55 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-05-14 20:41:47 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2023-02-16 18:35:15 +08:00
|
|
|
|
2008-05-14 20:41:47 +08:00
|
|
|
|
|
|
|
|
|
2025-03-13 13:14:58 +08:00
|
|
|
|
2008-05-14 20:41:47 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2008-05-14 20:41:47 +08:00
|
|
|
|
|
|
|
|
|
2023-02-16 18:35:15 +08:00
|
|
|
|
2025-02-10 11:04:48 +01:00
|
|
|
|
2011-09-27 07:41:07 +02:00
|
|
|
|
2008-05-14 20:41:47 +08:00
|
|
|
|
2023-02-16 18:35:15 +08:00
|
|
|
|
2008-05-14 20:41:47 +08:00
|
|
|
|
2023-09-14 16:28:23 +08:00
|
|
|
|
|
|
|
|
|
2025-02-16 11:07:17 +08:00
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-27 14:48:29 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-09-01 17:03:54 +02:00
|
|
|
|
2024-12-27 14:48:29 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-17 15:44:35 +02:00
|
|
|
|
|
|
|
|
|
2024-12-27 14:48:29 -08:00
|
|
|
|
|
|
|
|
|
2025-02-16 11:07:22 +08:00
|
|
|
|
2024-12-27 14:48:29 -08:00
|
|
|
|
2025-02-16 11:07:22 +08:00
|
|
|
|
2024-12-27 14:48:29 -08:00
|
|
|
|
2025-02-16 11:07:22 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-27 14:48:29 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-17 15:44:35 +02:00
|
|
|
|
2024-12-27 14:48:29 -08:00
|
|
|
|
2025-06-17 15:44:35 +02:00
|
|
|
|
2024-12-27 14:48:29 -08:00
|
|
|
|
2025-02-16 11:07:22 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-27 14:48:29 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-17 15:44:35 +02:00
|
|
|
|
2024-12-27 14:48:29 -08:00
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-22 01:10:58 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
|
|
|
|
|
2023-10-22 01:10:58 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-13 13:14:58 +08:00
|
|
|
|
|
|
|
|
|
2023-10-22 01:10:58 -07:00
|
|
|
|
|
|
|
|
|
2025-03-13 13:14:58 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-16 11:07:22 +08:00
|
|
|
|
2025-03-13 13:14:58 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-22 01:10:58 -07:00
|
|
|
|
2025-03-13 13:14:58 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-22 01:10:58 -07:00
|
|
|
|
2025-09-01 17:03:54 +02:00
|
|
|
|
2025-03-13 13:14:58 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-22 01:10:58 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
2023-10-22 01:10:58 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
2023-10-22 01:10:58 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
2023-10-22 01:10:58 -07:00
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
2023-10-22 01:10:58 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-06 18:47:42 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
2019-01-06 18:47:42 -08:00
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
|
|
|
|
|
2019-01-06 18:47:42 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
2008-05-14 20:41:47 +08:00
|
|
|
|
|
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-05-14 20:41:47 +08:00
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2025-04-23 17:22:28 +08:00
|
|
|
|
|
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-06 18:47:42 -08:00
|
|
|
|
crypto: hash - prevent using keyed hashes without setting key
Currently, almost none of the keyed hash algorithms check whether a key
has been set before proceeding. Some algorithms are okay with this and
will effectively just use a key of all 0's or some other bogus default.
However, others will severely break, as demonstrated using
"hmac(sha3-512-generic)", the unkeyed use of which causes a kernel crash
via a (potentially exploitable) stack buffer overflow.
A while ago, this problem was solved for AF_ALG by pairing each hash
transform with a 'has_key' bool. However, there are still other places
in the kernel where userspace can specify an arbitrary hash algorithm by
name, and the kernel uses it as unkeyed hash without checking whether it
is really unkeyed. Examples of this include:
- KEYCTL_DH_COMPUTE, via the KDF extension
- dm-verity
- dm-crypt, via the ESSIV support
- dm-integrity, via the "internal hash" mode with no key given
- drbd (Distributed Replicated Block Device)
This bug is especially bad for KEYCTL_DH_COMPUTE as that requires no
privileges to call.
Fix the bug for all users by adding a flag CRYPTO_TFM_NEED_KEY to the
->crt_flags of each hash transform that indicates whether the transform
still needs to be keyed or not. Then, make the hash init, import, and
digest functions return -ENOKEY if the key is still needed.
The new flag also replaces the 'has_key' bool which algif_hash was
previously using, thereby simplifying the algif_hash implementation.
Reported-by: syzbot <syzkaller@googlegroups.com>
Cc: stable@vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2018-01-03 11:16:27 -08:00
|
|
|
|
|
|
|
|
|
2008-05-14 20:41:47 +08:00
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
2008-05-14 20:41:47 +08:00
|
|
|
|
2025-02-16 11:07:17 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2025-02-16 11:07:17 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
2025-02-16 11:07:17 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
2025-02-16 11:07:22 +08:00
|
|
|
|
2025-06-04 17:54:41 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-13 16:51:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
2025-02-16 11:07:17 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-16 11:07:17 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-16 11:07:17 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-16 11:07:22 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-16 11:07:22 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
2025-02-16 11:07:22 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
2025-04-12 13:37:00 +08:00
|
|
|
|
|
|
|
|
|
2025-02-16 11:07:17 +08:00
|
|
|
|
|
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-12 13:37:00 +08:00
|
|
|
|
|
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
|
|
|
|
|
2025-04-12 18:57:19 +08:00
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
2025-02-16 11:07:12 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2014-03-14 02:37:05 +01:00
|
|
|
|
|
|
|
|
|
2025-03-21 16:43:28 +08:00
|
|
|
|
2014-03-14 02:37:05 +01:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-16 11:07:17 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-16 11:07:17 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-03-14 02:37:05 +01:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-21 13:54:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-03-14 02:37:05 +01:00
|
|
|
|
|
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
2025-04-12 13:37:00 +08:00
|
|
|
|
|
|
|
|
|
2025-04-12 18:57:19 +08:00
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
2018-11-29 14:42:21 +00:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
2018-09-19 10:10:54 +00:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-29 14:42:21 +00:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-09-19 10:10:54 +00:00
|
|
|
|
2025-04-12 13:37:00 +08:00
|
|
|
|
|
|
|
|
|
2025-04-12 18:57:19 +08:00
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2025-02-16 11:07:17 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
crypto: hash - prevent using keyed hashes without setting key
Currently, almost none of the keyed hash algorithms check whether a key
has been set before proceeding. Some algorithms are okay with this and
will effectively just use a key of all 0's or some other bogus default.
However, others will severely break, as demonstrated using
"hmac(sha3-512-generic)", the unkeyed use of which causes a kernel crash
via a (potentially exploitable) stack buffer overflow.
A while ago, this problem was solved for AF_ALG by pairing each hash
transform with a 'has_key' bool. However, there are still other places
in the kernel where userspace can specify an arbitrary hash algorithm by
name, and the kernel uses it as unkeyed hash without checking whether it
is really unkeyed. Examples of this include:
- KEYCTL_DH_COMPUTE, via the KDF extension
- dm-verity
- dm-crypt, via the ESSIV support
- dm-integrity, via the "internal hash" mode with no key given
- drbd (Distributed Replicated Block Device)
This bug is especially bad for KEYCTL_DH_COMPUTE as that requires no
privileges to call.
Fix the bug for all users by adding a flag CRYPTO_TFM_NEED_KEY to the
->crt_flags of each hash transform that indicates whether the transform
still needs to be keyed or not. Then, make the hash init, import, and
digest functions return -ENOKEY if the key is still needed.
The new flag also replaces the 'has_key' bool which algif_hash was
previously using, thereby simplifying the algif_hash implementation.
Reported-by: syzbot <syzkaller@googlegroups.com>
Cc: stable@vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2018-01-03 11:16:27 -08:00
|
|
|
|
2023-02-16 18:35:15 +08:00
|
|
|
|
2025-04-12 13:37:00 +08:00
|
|
|
|
|
|
|
|
|
2025-04-12 18:57:19 +08:00
|
|
|
|
|
|
|
|
|
2024-03-13 09:49:37 +08:00
|
|
|
|
crypto: remove CONFIG_CRYPTO_STATS
Remove support for the "Crypto usage statistics" feature
(CONFIG_CRYPTO_STATS). This feature does not appear to have ever been
used, and it is harmful because it significantly reduces performance and
is a large maintenance burden.
Covering each of these points in detail:
1. Feature is not being used
Since these generic crypto statistics are only readable using netlink,
it's fairly straightforward to look for programs that use them. I'm
unable to find any evidence that any such programs exist. For example,
Debian Code Search returns no hits except the kernel header and kernel
code itself and translations of the kernel header:
https://codesearch.debian.net/search?q=CRYPTOCFGA_STAT&literal=1&perpkg=1
The patch series that added this feature in 2018
(https://lore.kernel.org/linux-crypto/1537351855-16618-1-git-send-email-clabbe@baylibre.com/)
said "The goal is to have an ifconfig for crypto device." This doesn't
appear to have happened.
It's not clear that there is real demand for crypto statistics. Just
because the kernel provides other types of statistics such as I/O and
networking statistics and some people find those useful does not mean
that crypto statistics are useful too.
Further evidence that programs are not using CONFIG_CRYPTO_STATS is that
it was able to be disabled in RHEL and Fedora as a bug fix
(https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/2947).
Even further evidence comes from the fact that there are and have been
bugs in how the stats work, but they were never reported. For example,
before Linux v6.7 hash stats were double-counted in most cases.
There has also never been any documentation for this feature, so it
might be hard to use even if someone wanted to.
2. CONFIG_CRYPTO_STATS significantly reduces performance
Enabling CONFIG_CRYPTO_STATS significantly reduces the performance of
the crypto API, even if no program ever retrieves the statistics. This
primarily affects systems with a large number of CPUs. For example,
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2039576 reported
that Lustre client encryption performance improved from 21.7GB/s to
48.2GB/s by disabling CONFIG_CRYPTO_STATS.
It can be argued that this means that CONFIG_CRYPTO_STATS should be
optimized with per-cpu counters similar to many of the networking
counters. But no one has done this in 5+ years. This is consistent
with the fact that the feature appears to be unused, so there seems to
be little interest in improving it as opposed to just disabling it.
It can be argued that because CONFIG_CRYPTO_STATS is off by default,
performance doesn't matter. But Linux distros tend to error on the side
of enabling options. The option is enabled in Ubuntu and Arch Linux,
and until recently was enabled in RHEL and Fedora (see above). So, even
just having the option available is harmful to users.
3. CONFIG_CRYPTO_STATS is a large maintenance burden
There are over 1000 lines of code associated with CONFIG_CRYPTO_STATS,
spread among 32 files. It significantly complicates much of the
implementation of the crypto API. After the initial submission, many
fixes and refactorings have consumed effort of multiple people to keep
this feature "working". We should be spending this effort elsewhere.
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2024-03-12 20:48:21 -07:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-02-08 13:58:44 +08:00
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
2017-04-10 17:27:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-21 16:43:28 +08:00
|
|
|
|
2023-02-10 20:20:20 +08:00
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
|
|
|
|
|
2025-03-21 16:43:28 +08:00
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
2025-06-16 12:09:17 +08:00
|
|
|
|
|
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2017-04-10 17:27:57 +08:00
|
|
|
|
2025-06-16 12:09:17 +08:00
|
|
|
|
2017-10-18 08:00:36 +01:00
|
|
|
|
2017-04-10 17:27:57 +08:00
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
|
|
|
|
|
2025-03-21 16:43:28 +08:00
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-02-08 13:58:44 +08:00
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
crypto: hash - Simplify the ahash_finup implementation
The ahash_def_finup() can make use of the request save/restore functions,
thus make it so. This simplifies the code a little and unifies the code
paths.
Note that the same remark about free()ing the req->priv applies here, the
req->priv can only be free()'d after the original request was restored.
Finally, squash a bug in the invocation of completion in the ASYNC path.
In both ahash_def_finup_done{1,2}, the function areq->base.complete(X, err);
was called with X=areq->base.data . This is incorrect , as X=&areq->base
is the correct value. By analysis of the data structures, we see the areq is
of type 'struct ahash_request' , areq->base is of type 'struct crypto_async_request'
and areq->base.completion is of type crypto_completion_t, which is defined in
include/linux/crypto.h as:
typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err);
This is one lead that the X should be &areq->base . Next up, we can inspect
other code which calls the completion callback to give us kind-of statistical
idea of how this callback is used. We can try:
$ git grep base\.complete\( drivers/crypto/
Finally, by inspecting ahash_request_set_callback() implementation defined
in include/crypto/hash.h , we observe that the .data entry of 'struct
crypto_async_request' is intended for arbitrary data, not for completion
argument.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2014-03-14 02:37:06 +01:00
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
2025-02-16 11:07:17 +08:00
|
|
|
|
2017-10-18 08:00:36 +01:00
|
|
|
|
2017-04-10 17:27:57 +08:00
|
|
|
|
|
|
|
|
|
2025-03-21 16:43:28 +08:00
|
|
|
|
2009-07-15 12:40:40 +08:00
|
|
|
|
|
|
|
|
|
2025-05-04 21:33:21 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:35 +08:00
|
|
|
|
2025-05-04 21:33:21 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-04 21:33:21 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-21 13:36:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:35 +08:00
|
|
|
|
2025-05-04 21:33:21 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2025-11-21 13:36:03 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2025-11-21 13:36:03 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
2025-11-21 13:36:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2025-05-15 13:54:35 +08:00
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-18 18:25:34 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-12 18:57:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2025-04-23 17:22:28 +08:00
|
|
|
|
2020-08-18 18:25:34 +10:00
|
|
|
|
|
|
|
|
|
2009-07-14 12:28:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-12 18:57:19 +08:00
|
|
|
|
|
|
|
|
|
2009-07-14 12:28:26 +08:00
|
|
|
|
2023-04-20 18:05:16 +08:00
|
|
|
|
2025-04-07 18:21:11 +08:00
|
|
|
|
2023-04-20 18:05:16 +08:00
|
|
|
|
2023-10-22 01:10:59 -07:00
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
2009-07-14 12:28:26 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2025-04-12 18:57:19 +08:00
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-12 18:57:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-23 17:22:28 +08:00
|
|
|
|
2025-04-12 18:57:19 +08:00
|
|
|
|
|
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
2009-07-14 12:28:26 +08:00
|
|
|
|
2025-04-12 18:57:19 +08:00
|
|
|
|
2020-08-18 18:25:34 +10:00
|
|
|
|
2025-05-04 21:33:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-12 18:57:19 +08:00
|
|
|
|
2025-05-04 21:33:18 +08:00
|
|
|
|
2025-04-12 18:57:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-04 21:33:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-12 18:57:19 +08:00
|
|
|
|
|
|
|
|
|
2025-05-04 21:33:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-12 18:57:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-14 12:28:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-22 01:10:59 -07:00
|
|
|
|
2016-06-29 18:03:47 +08:00
|
|
|
|
2009-07-14 12:28:26 +08:00
|
|
|
|
2016-06-29 18:03:47 +08:00
|
|
|
|
2009-07-14 12:28:26 +08:00
|
|
|
|
|
|
|
|
|
2020-01-02 20:04:35 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-02-16 18:35:28 +08:00
|
|
|
|
|
|
|
|
|
2011-09-27 07:41:07 +02:00
|
|
|
|
2026-05-08 12:57:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-27 07:41:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-03 14:56:03 -07:00
|
|
|
|
2011-09-27 07:41:07 +02:00
|
|
|
|
|
|
|
|
|
2025-12-22 11:44:55 +01:00
|
|
|
|
|
|
|
|
|
2008-05-14 20:41:47 +08:00
|
|
|
|
|
|
|
|
|
2025-02-10 11:04:48 +01:00
|
|
|
|
|
|
|
|
|
2008-05-14 20:41:47 +08:00
|
|
|
|
2009-07-14 12:28:26 +08:00
|
|
|
|
|
|
|
|
|
2008-05-14 20:41:47 +08:00
|
|
|
|
|
|
|
|
|
2020-01-02 19:59:07 -08:00
|
|
|
|
2009-07-14 12:28:26 +08:00
|
|
|
|
|
|
|
|
|
2020-01-02 20:04:35 -08:00
|
|
|
|
2008-05-14 20:41:47 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-05-02 10:02:33 +02:00
|
|
|
|
2011-09-27 07:41:07 +02:00
|
|
|
|
2023-02-16 18:35:15 +08:00
|
|
|
|
2009-07-14 12:28:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-12 13:16:43 +08:00
|
|
|
|
2008-05-14 20:41:47 +08:00
|
|
|
|
|
|
|
|
|
2020-01-02 19:58:50 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-14 12:28:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-23 13:52:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:51 +08:00
|
|
|
|
2024-01-26 23:49:27 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:51 +08:00
|
|
|
|
2024-01-26 23:49:27 -08:00
|
|
|
|
2025-05-15 13:54:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-14 14:06:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-02-16 18:35:15 +08:00
|
|
|
|
2009-07-14 14:06:06 +08:00
|
|
|
|
2023-02-16 18:35:15 +08:00
|
|
|
|
2009-07-14 14:06:06 +08:00
|
|
|
|
|
|
|
|
|
2025-04-07 18:21:11 +08:00
|
|
|
|
2025-02-16 11:07:24 +08:00
|
|
|
|
|
|
|
|
|
2025-05-04 21:33:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-04 17:54:41 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-02-16 18:35:15 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-14 14:06:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
2025-06-04 17:54:41 +08:00
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
2023-10-22 01:11:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-14 14:06:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-12-15 15:51:19 -08:00
|
|
|
|
2009-07-14 14:06:06 +08:00
|
|
|
|
2019-12-15 15:51:19 -08:00
|
|
|
|
2009-07-14 14:06:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-10 14:53:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-12-19 15:51:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-10 14:53:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-14 14:06:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-01-02 20:04:40 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-14 14:06:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-12 18:57:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-23 17:22:28 +08:00
|
|
|
|
2025-04-12 18:57:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-15 13:54:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-05-14 20:41:47 +08:00
|
|
|
|
|
|
|
|
|