Commit 9ea1700
target/riscv: Use existing lookup tables for MixColumns
The AES MixColumns and InvMixColumns operations are relatively
expensive 4x4 matrix multiplications in GF(2^8), which is why C
implementations usually rely on precomputed lookup tables rather than
performing the calculations on demand.
Given that we already carry those tables in QEMU, we can just grab the
right value in the implementation of the RISC-V AES32 instructions. Note
that the tables in question are permuted according to the respective
Sbox, so we can omit the Sbox lookup as well in this case.
Cc: Richard Henderson <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Zewen Ye <[email protected]>
Cc: Weiwei Li <[email protected]>
Cc: Junqiang Wang <[email protected]>
Signed-off-by: Ard Biesheuvel <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Alistair Francis <[email protected]>1 parent 4cc9f28 commit 9ea1700
File tree
3 files changed
+13
-32
lines changed- crypto
- include/crypto
- target/riscv
3 files changed
+13
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
| 275 | + | |
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| |||
607 | 607 | | |
608 | 608 | | |
609 | 609 | | |
610 | | - | |
| 610 | + | |
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
33 | 40 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | 28 | | |
52 | 29 | | |
53 | 30 | | |
54 | 31 | | |
55 | 32 | | |
56 | 33 | | |
57 | 34 | | |
58 | | - | |
59 | 35 | | |
60 | 36 | | |
61 | 37 | | |
62 | 38 | | |
63 | | - | |
64 | 39 | | |
65 | | - | |
| 40 | + | |
66 | 41 | | |
67 | | - | |
| 42 | + | |
68 | 43 | | |
69 | 44 | | |
70 | | - | |
71 | 45 | | |
72 | | - | |
| 46 | + | |
73 | 47 | | |
74 | | - | |
| 48 | + | |
75 | 49 | | |
76 | 50 | | |
77 | 51 | | |
| |||
0 commit comments