diff options
| author | Vladimir Kukharenko <vladimir@genproof.com> | 2026-10-14 20:34:22 +0000 |
|---|---|---|
| committer | Eric Biggers <ebiggers@kernel.org> | 2026-10-15 23:17:16 -0700 |
| commit | ff2d72f2bf4734e93bfc1b70e1e5626c2710bdcd (patch) | |
| tree | 27d50cba1ae64d20770f987252532d66474f7882 /tools/perf/scripts/python/netdev-times.py | |
| parent | f92159895b96078fbe54f059cd8e93fe3deb34f0 (diff) | |
| download | linux-ff2d72f2bf4734e93bfc1b70e1e5626c2710bdcd.tar.gz linux-ff2d72f2bf4734e93bfc1b70e1e5626c2710bdcd.zip | |
lib/crypto: mips/chacha: Handle lengths of 2 GiB or more
The MIPS ChaCha assembly, which is chacha_crypt_arch() itself, tests
the remaining length with signed branches, so for 2 GiB + 64 bytes or
more it takes the final partial block path too early and processes less
than requested. It is only used on 32-bit kernels, where size_t is 32
bits, so declaring the length as size_t does not avoid this. No
in-tree caller passes such lengths.
The partial block code also keeps the remaining length as a negative
value, so instead of changing the assembly, rename it to
chacha_crypt_mips() and add a C chacha_crypt_arch() that passes it at
most 1 GiB per call.
Tested in QEMU user mode: with a length of 0xfffff045 the assembly
processed about 4 KiB and advanced the block counter by 64; with the
same 1 GiB loop in C, a 1.25 GiB + 4101 byte buffer matches a C
reference. An LLM review of this code found the bug.
Assisted-by: LLM
Signed-off-by: Vladimir Kukharenko <vladimir@genproof.com>
Link: https://patch.msgid.link/20261014-libcrypto-chacha-32bit-2gib-v1-2-e0719ca0be89@genproof.com
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/netdev-times.py')
0 files changed, 0 insertions, 0 deletions
