Eric Biggers
2f22115709
lib/crypto: x86/blake2s: Fix 32-bit arg treated as 64-bit
...
In the C code, the 'inc' argument to the assembly functions
blake2s_compress_ssse3() and blake2s_compress_avx512() is declared with
type u32, matching blake2s_compress(). The assembly code then reads it
from the 64-bit %rcx. However, the ABI doesn't guarantee zero-extension
to 64 bits, nor do gcc or clang guarantee it. Therefore, fix these
functions to read this argument from the 32-bit %ecx.
In theory, this bug could have caused the wrong 'inc' value to be used,
causing incorrect BLAKE2s hashes. In practice, probably not: I've fixed
essentially this same bug in many other assembly files too, but there's
never been a real report of it having caused a problem. In x86_64, all
writes to 32-bit registers are zero-extended to 64 bits. That results
in zero-extension in nearly all situations. I've only been able to
demonstrate a lack of zero-extension with a somewhat contrived example
involving truncation, e.g. when the C code has a u64 variable holding
0x1234567800000040 and passes it as a u32 expecting it to be truncated
to 0x40 (64). But that's not what the real code does, of course.
Fixes: ed0356eda1 ("crypto: blake2s - x86_64 SIMD implementation")
Cc: stable@vger.kernel.org
Reviewed-by: Ard Biesheuvel <ardb@kernel.org >
Link: https://lore.kernel.org/r/20251102234209.62133-2-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org >
2025-11-05 20:30:51 -08:00
..
2025-02-09 18:08:11 +08:00
2025-08-15 19:06:08 -07:00
2025-11-05 20:30:51 -08:00
2024-11-03 12:36:54 -08:00
2024-12-12 18:26:32 +01:00
2025-09-16 08:27:09 -06:00
2025-01-24 22:47:28 -08:00
2025-08-16 17:24:31 +08:00
2025-07-19 19:08:28 -07:00
2025-05-15 12:59:18 +02:00
2025-09-16 16:43:27 -06:00
2022-11-18 02:15:15 +01:00
2025-04-30 21:53:35 +02:00
2025-09-08 14:58:52 -07:00
2025-09-04 11:23:51 +02:00
2024-10-02 17:23:23 -04:00
2025-03-16 22:30:49 -07:00
2024-07-03 19:30:23 -07:00
2025-04-11 17:32:38 -07:00
2025-03-26 21:35:28 -07:00
2024-08-15 09:26:02 -07:00
2025-10-02 18:44:54 -07:00
2023-09-19 13:21:33 -07:00
2025-04-11 17:32:37 -07:00
2024-06-24 22:25:06 -07:00
2024-03-12 13:09:23 -07:00
2025-02-28 11:42:34 +01:00
2025-01-22 15:07:01 -05:00
2021-10-01 16:52:48 -04:00
2022-08-02 17:14:47 -06:00
2024-09-01 20:43:33 -07:00
2024-07-12 16:39:53 -07:00
2023-10-14 20:25:22 -07:00
2024-02-01 13:06:40 +01:00
2022-04-26 17:58:51 -04:00
2024-07-12 08:55:02 +09:00
2025-09-13 17:32:53 -07:00
2025-03-10 11:54:46 +01:00
2024-07-06 11:39:51 -07:00
2024-10-17 21:30:32 +02:00
2022-09-01 16:55:35 +02:00
2024-10-30 15:29:59 +01:00
2024-09-01 20:43:29 -07:00
2025-09-08 14:58:50 -07:00
2022-09-11 21:55:06 -07:00
2024-04-09 22:06:00 -07:00
2025-07-09 22:42:06 -07:00
2021-10-01 16:52:48 -04:00
2025-02-26 19:51:37 -08:00
2025-02-24 16:37:23 -05:00
2021-08-19 09:02:55 +09:00
2021-06-22 13:56:43 +02:00
2024-10-15 17:30:33 +02:00
2023-01-31 20:37:18 +01:00
2024-07-26 14:33:09 -07:00
2023-06-09 17:44:17 -07:00
2024-10-02 17:23:23 -04:00
2024-07-28 15:49:18 -07:00
2024-10-02 17:23:23 -04:00
2024-09-01 20:43:27 -07:00
2023-06-09 17:44:17 -07:00
2025-09-22 20:10:58 -07:00
2023-06-09 17:44:15 -07:00
2025-05-05 16:18:09 -05:00
2024-02-22 15:38:52 -08:00
2023-02-02 22:50:01 -08:00
2024-06-24 22:25:11 -07:00
2023-02-02 22:50:01 -08:00
2025-10-05 10:48:33 -07:00
2025-09-13 17:32:52 -07:00
2024-09-01 20:43:29 -07:00
2025-03-25 06:26:55 -07:00
2022-09-11 21:55:10 -07:00
2023-11-25 09:43:18 +01:00
2023-08-18 10:18:55 -07:00
2025-05-11 17:54:06 -07:00
2021-01-03 20:05:18 -05:00
2025-09-13 17:32:46 -07:00
2025-01-12 20:21:00 -08:00
2025-09-22 15:52:44 -04:00
2024-06-18 10:40:52 -07:00
2025-07-08 19:11:57 -04:00
2024-02-22 15:38:52 -08:00
2024-03-13 00:03:21 -07:00
2025-09-28 11:36:13 -07:00
2024-09-09 09:41:47 -04:00
2024-09-09 16:47:41 -07:00
2025-07-01 10:24:11 -06:00
2024-10-02 17:23:23 -04:00
2025-03-25 10:18:31 -03:00
2025-01-12 20:21:15 -08:00
2025-03-17 12:17:01 -07:00
2025-03-17 12:17:01 -07:00
2024-04-22 17:11:20 -03:00
2025-03-01 21:00:22 +01:00
2024-10-29 07:14:29 +00:00
2025-09-09 10:27:01 -06:00
2024-08-20 17:13:40 +02:00
2021-08-19 09:02:55 +09:00
2025-10-03 07:50:56 -04:00
2025-10-02 18:44:54 -07:00
2025-09-21 14:21:58 -07:00
2025-08-28 16:58:46 -07:00
2023-12-05 11:14:40 +01:00
2024-12-17 13:46:53 -07:00
2025-08-28 16:58:46 -07:00
2025-06-01 11:37:01 -07:00
2024-05-22 11:53:02 -07:00
2025-07-23 11:56:02 +02:00
2025-01-14 19:45:35 +01:00
2025-05-11 17:54:06 -07:00
2021-05-19 15:05:11 +02:00
2021-08-13 18:37:38 +02:00
2025-01-25 20:22:23 -08:00
2025-01-24 22:47:23 -08:00
2025-05-27 19:40:34 -07:00
2024-12-02 12:16:57 +01:00
2025-01-16 11:48:11 +01:00
2022-03-11 10:42:56 +01:00
2024-10-14 16:33:24 -05:00
2024-09-01 20:43:29 -07:00
2023-10-16 12:44:06 -04:00
2025-10-02 08:57:03 -07:00
2025-10-02 18:18:33 -07:00
2025-03-16 23:24:14 -07:00
2025-03-19 19:17:58 +01:00
2024-02-22 19:01:55 -08:00
2023-08-18 10:19:00 -07:00
2023-08-18 10:18:55 -07:00
2024-06-10 11:14:52 +01:00
2024-11-07 14:14:58 -08:00
2025-05-11 17:54:13 -07:00
2022-10-03 17:34:32 -07:00
2024-12-11 20:13:00 -08:00
2024-12-11 20:13:00 -08:00
2021-04-16 16:10:37 -07:00
2024-12-11 09:07:40 -07:00
2024-09-01 20:43:34 -07:00
2024-11-06 20:11:14 -08:00
2022-11-30 13:16:40 -08:00
2025-03-16 22:30:47 -07:00
2022-05-22 11:32:30 -07:00
2023-08-21 13:07:22 -07:00
2023-06-12 11:31:50 -07:00
2024-11-19 10:43:44 -08:00
2025-05-08 16:13:27 -07:00
2025-03-17 12:17:00 -07:00
2025-05-11 17:54:04 -07:00
2025-01-29 15:21:31 +01:00
2025-09-13 17:32:43 -07:00
2021-07-08 11:48:20 -07:00
2025-09-13 16:54:45 -07:00
2025-08-07 06:30:17 -06:00
2025-06-11 22:42:35 -07:00
2024-02-15 12:17:28 -05:00
2022-09-23 16:46:19 +02:00
2025-04-01 15:20:46 -07:00
2024-10-02 17:23:23 -04:00
2025-07-10 17:52:13 +02:00
2025-04-01 15:20:46 -07:00
2025-08-02 12:01:38 -07:00
2025-04-07 15:07:56 +01:00
2025-04-15 13:50:17 -07:00
2024-11-11 00:26:43 -08:00
2024-08-19 11:31:18 -07:00
2025-09-13 17:32:50 -07:00
2021-06-18 11:43:09 +02:00
2025-02-18 11:51:21 -05:00
2024-05-09 09:25:08 -07:00
2025-01-06 16:10:19 +01:00
2024-06-04 17:40:02 +02:00
2025-09-13 17:32:46 -07:00
2024-09-01 20:43:40 -07:00
2024-05-19 14:36:20 -07:00
2024-05-19 14:36:20 -07:00
2024-06-24 22:25:11 -07:00
2024-06-24 22:25:11 -07:00
2022-10-12 18:51:50 -07:00
2025-09-13 16:55:13 -07:00
2025-03-25 10:18:31 -03:00
2025-10-07 13:48:56 -07:00
2025-05-11 17:54:09 -07:00
2022-02-25 09:36:06 +01:00
2025-10-02 18:18:33 -07:00
2024-06-24 22:25:11 -07:00
2024-06-24 22:25:11 -07:00
2025-01-12 20:20:57 -08:00
2024-06-24 22:25:11 -07:00
2025-07-09 22:57:55 -07:00
2025-09-09 12:27:18 +02:00
2024-10-03 18:20:27 +02:00
2025-06-19 17:02:04 -07:00
2024-06-03 18:51:18 -07:00
2024-06-24 22:25:11 -07:00
2024-06-24 22:25:11 -07:00
2025-04-14 14:13:41 +02:00
2025-04-15 13:50:17 -07:00
2024-06-24 22:25:06 -07:00
2025-07-13 16:38:32 -07:00
2025-05-11 17:48:19 -07:00
2024-06-24 22:25:11 -07:00
2021-02-17 14:08:01 +01:00
2023-12-29 12:22:29 -08:00
2024-06-24 22:25:04 -07:00
2024-06-24 22:25:04 -07:00
2024-06-24 22:25:04 -07:00
2025-08-25 06:11:06 -07:00
2025-03-07 19:58:05 -08:00
2025-04-11 17:32:38 -07:00
2024-07-30 13:04:36 -10:00
2024-07-08 23:44:01 +02:00
2022-10-11 17:42:58 -06:00
2025-08-04 10:54:36 -07:00
2024-12-09 13:48:29 -08:00
2025-09-13 16:54:46 -07:00
2025-08-02 12:01:37 -07:00