1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include "../multiarch/test-aes-main.c.inc"
5 bool test_SB_SR(uint8_t *o
, const uint8_t *i
)
7 uint64_t *o8
= (uint64_t *)o
;
8 const uint64_t *i8
= (const uint64_t *)i
;
10 /* aes64es rd, rs1, rs2 = 0011001 rs2 rs1 000 rd 0110011 */
11 asm(".insn r 0x33, 0x0, 0x19, %0, %2, %3\n\t"
12 ".insn r 0x33, 0x0, 0x19, %1, %3, %2"
13 : "=&r"(o8
[0]), "=&r"(o8
[1]) : "r"(i8
[0]), "r"(i8
[1]));
17 bool test_MC(uint8_t *o
, const uint8_t *i
)
22 bool test_SB_SR_MC_AK(uint8_t *o
, const uint8_t *i
, const uint8_t *k
)
24 uint64_t *o8
= (uint64_t *)o
;
25 const uint64_t *i8
= (const uint64_t *)i
;
26 const uint64_t *k8
= (const uint64_t *)k
;
28 /* aesesm rd, rs1, rs2 = 0011011 rs2 rs1 000 rd 0110011 */
29 asm(".insn r 0x33, 0x0, 0x1b, %0, %2, %3\n\t"
30 ".insn r 0x33, 0x0, 0x1b, %1, %3, %2\n\t"
33 : "=&r"(o8
[0]), "=&r"(o8
[1])
34 : "r"(i8
[0]), "r"(i8
[1]), "r"(k8
[0]), "r"(k8
[1]));
38 bool test_ISB_ISR(uint8_t *o
, const uint8_t *i
)
40 uint64_t *o8
= (uint64_t *)o
;
41 const uint64_t *i8
= (const uint64_t *)i
;
43 /* aes64ds rd, rs1, rs2 = 0011101 rs2 rs1 000 rd 0110011 */
44 asm(".insn r 0x33, 0x0, 0x1d, %0, %2, %3\n\t"
45 ".insn r 0x33, 0x0, 0x1d, %1, %3, %2"
46 : "=&r"(o8
[0]), "=&r"(o8
[1]) : "r"(i8
[0]), "r"(i8
[1]));
50 bool test_IMC(uint8_t *o
, const uint8_t *i
)
52 uint64_t *o8
= (uint64_t *)o
;
53 const uint64_t *i8
= (const uint64_t *)i
;
55 /* aes64im rd, rs1 = 0011000 00000 rs1 001 rd 0010011 */
56 asm(".insn r 0x13, 0x1, 0x18, %0, %0, x0\n\t"
57 ".insn r 0x13, 0x1, 0x18, %1, %1, x0"
58 : "=r"(o8
[0]), "=r"(o8
[1]) : "0"(i8
[0]), "1"(i8
[1]));
62 bool test_ISB_ISR_AK_IMC(uint8_t *o
, const uint8_t *i
, const uint8_t *k
)
67 bool test_ISB_ISR_IMC_AK(uint8_t *o
, const uint8_t *i
, const uint8_t *k
)
69 uint64_t *o8
= (uint64_t *)o
;
70 const uint64_t *i8
= (const uint64_t *)i
;
71 const uint64_t *k8
= (const uint64_t *)k
;
73 /* aes64dsm rd, rs1, rs2 = 0011111 rs2 rs1 000 rd 0110011 */
74 asm(".insn r 0x33, 0x0, 0x1f, %0, %2, %3\n\t"
75 ".insn r 0x33, 0x0, 0x1f, %1, %3, %2\n\t"
78 : "=&r"(o8
[0]), "=&r"(o8
[1])
79 : "r"(i8
[0]), "r"(i8
[1]), "r"(k8
[0]), "r"(k8
[1]));