blob: 2cd324f09baec19abfe6143ec8055b6d2801c686 [file] [log] [blame]
Richard Hendersonca1e9c32023-06-01 11:28:17 -07001/* SPDX-License-Identifier: GPL-2.0-or-later */
2
3#include "../multiarch/test-aes-main.c.inc"
4
5bool test_SB_SR(uint8_t *o, const uint8_t *i)
6{
7 /* aese also adds round key, so supply zero. */
8 asm("ld1 { v0.16b }, [%1]\n\t"
9 "movi v1.16b, #0\n\t"
10 "aese v0.16b, v1.16b\n\t"
11 "st1 { v0.16b }, [%0]"
12 : : "r"(o), "r"(i) : "v0", "v1", "memory");
13 return true;
14}
15
16bool test_MC(uint8_t *o, const uint8_t *i)
17{
18 asm("ld1 { v0.16b }, [%1]\n\t"
19 "aesmc v0.16b, v0.16b\n\t"
20 "st1 { v0.16b }, [%0]"
21 : : "r"(o), "r"(i) : "v0", "memory");
22 return true;
23}
24
25bool test_SB_SR_MC_AK(uint8_t *o, const uint8_t *i, const uint8_t *k)
26{
27 return false;
28}
29
30bool test_ISB_ISR(uint8_t *o, const uint8_t *i)
31{
32 /* aesd also adds round key, so supply zero. */
33 asm("ld1 { v0.16b }, [%1]\n\t"
34 "movi v1.16b, #0\n\t"
35 "aesd v0.16b, v1.16b\n\t"
36 "st1 { v0.16b }, [%0]"
37 : : "r"(o), "r"(i) : "v0", "v1", "memory");
38 return true;
39}
40
41bool test_IMC(uint8_t *o, const uint8_t *i)
42{
43 asm("ld1 { v0.16b }, [%1]\n\t"
44 "aesimc v0.16b, v0.16b\n\t"
45 "st1 { v0.16b }, [%0]"
46 : : "r"(o), "r"(i) : "v0", "memory");
47 return true;
48}
49
50bool test_ISB_ISR_AK_IMC(uint8_t *o, const uint8_t *i, const uint8_t *k)
51{
52 return false;
53}
54
55bool test_ISB_ISR_IMC_AK(uint8_t *o, const uint8_t *i, const uint8_t *k)
56{
57 return false;
58}