1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include "../multiarch/test-aes-main.c.inc"
6 #define BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
8 static unsigned char bswap_le
[16] __attribute__((aligned(16))) = {
13 bool test_SB_SR(uint8_t *o
, const uint8_t *i
)
15 /* vcipherlast also adds round key, so supply zero. */
17 asm("lxvd2x 32,0,%1\n\t"
19 "vcipherlast 0,0,1\n\t"
21 : : "r"(o
), "r"(i
) : "memory", "v0", "v1");
23 asm("lxvd2x 32,0,%1\n\t"
27 "vcipherlast 0,0,1\n\t"
30 : : "r"(o
), "r"(i
), "r"(bswap_le
) : "memory", "v0", "v1", "v2");
35 bool test_MC(uint8_t *o
, const uint8_t *i
)
40 bool test_SB_SR_MC_AK(uint8_t *o
, const uint8_t *i
, const uint8_t *k
)
43 asm("lxvd2x 32,0,%1\n\t"
47 : : "r"(o
), "r"(i
), "r"(k
) : "memory", "v0", "v1");
49 asm("lxvd2x 32,0,%1\n\t"
57 : : "r"(o
), "r"(i
), "r"(k
), "r"(bswap_le
)
58 : "memory", "v0", "v1", "v2");
63 bool test_ISB_ISR(uint8_t *o
, const uint8_t *i
)
65 /* vcipherlast also adds round key, so supply zero. */
67 asm("lxvd2x 32,0,%1\n\t"
69 "vncipherlast 0,0,1\n\t"
71 : : "r"(o
), "r"(i
) : "memory", "v0", "v1");
73 asm("lxvd2x 32,0,%1\n\t"
77 "vncipherlast 0,0,1\n\t"
80 : : "r"(o
), "r"(i
), "r"(bswap_le
) : "memory", "v0", "v1", "v2");
85 bool test_IMC(uint8_t *o
, const uint8_t *i
)
90 bool test_ISB_ISR_AK_IMC(uint8_t *o
, const uint8_t *i
, const uint8_t *k
)
93 asm("lxvd2x 32,0,%1\n\t"
97 : : "r"(o
), "r"(i
), "r"(k
) : "memory", "v0", "v1");
99 asm("lxvd2x 32,0,%1\n\t"
107 : : "r"(o
), "r"(i
), "r"(k
), "r"(bswap_le
)
108 : "memory", "v0", "v1", "v2");
113 bool test_ISB_ISR_IMC_AK(uint8_t *o
, const uint8_t *i
, const uint8_t *k
)