Commit 1aa82df
Eric Biggers
lib/crypto: aescfb: Don't disable IRQs during AES block encryption
aes_encrypt() now uses AES instructions when available instead of always
using table-based code. AES instructions are constant-time and don't
benefit from disabling IRQs as a constant-time hardening measure.
In fact, on two architectures (arm and riscv) disabling IRQs is
counterproductive because it prevents the AES instructions from being
used. (See the may_use_simd() implementation on those architectures.)
Therefore, let's remove the IRQ disabling/enabling and leave the choice
of constant-time hardening measures to the AES library code.
Note that currently the arm table-based AES code (which runs on arm
kernels that don't have ARMv8 CE) disables IRQs, while the generic
table-based AES code does not. So this does technically regress in
constant-time hardening when that generic code is used. But as
discussed in commit a22fd0e ("lib/crypto: aes: Introduce improved
AES library") I think just leaving IRQs enabled is the right choice.
Disabling them is slow and can cause problems, and AES instructions
(which modern CPUs have) solve the problem in a much better way anyway.
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20260331024414.51545-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>1 parent d2a68ab commit 1aa82df
1 file changed
Lines changed: 3 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | 12 | | |
32 | 13 | | |
33 | 14 | | |
| |||
45 | 26 | | |
46 | 27 | | |
47 | 28 | | |
48 | | - | |
| 29 | + | |
49 | 30 | | |
50 | 31 | | |
51 | 32 | | |
| |||
72 | 53 | | |
73 | 54 | | |
74 | 55 | | |
75 | | - | |
| 56 | + | |
76 | 57 | | |
77 | 58 | | |
78 | 59 | | |
| |||
81 | 62 | | |
82 | 63 | | |
83 | 64 | | |
84 | | - | |
| 65 | + | |
85 | 66 | | |
86 | 67 | | |
87 | 68 | | |
| |||
0 commit comments