Commit 8f45af9
Eric Biggers
lib/crypto: aesgcm: 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.
Link: https://lore.kernel.org/r/20260331024430.51755-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>1 parent 1aa82df commit 8f45af9
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 | | |
| |||
53 | 34 | | |
54 | 35 | | |
55 | 36 | | |
56 | | - | |
| 37 | + | |
57 | 38 | | |
58 | 39 | | |
59 | 40 | | |
| |||
98 | 79 | | |
99 | 80 | | |
100 | 81 | | |
101 | | - | |
| 82 | + | |
102 | 83 | | |
103 | 84 | | |
104 | 85 | | |
| |||
120 | 101 | | |
121 | 102 | | |
122 | 103 | | |
123 | | - | |
| 104 | + | |
124 | 105 | | |
125 | 106 | | |
126 | 107 | | |
| |||
0 commit comments