mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
tests/multiarch: Add test-aes
Use a shared driver and backends for i386, aarch64, ppc64, riscv64. Acked-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
623d7e3551
commit
ca1e9c3ba1
9 changed files with 518 additions and 0 deletions
58
tests/tcg/aarch64/test-aes.c
Normal file
58
tests/tcg/aarch64/test-aes.c
Normal file
|
@ -0,0 +1,58 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "../multiarch/test-aes-main.c.inc"
|
||||
|
||||
bool test_SB_SR(uint8_t *o, const uint8_t *i)
|
||||
{
|
||||
/* aese also adds round key, so supply zero. */
|
||||
asm("ld1 { v0.16b }, [%1]\n\t"
|
||||
"movi v1.16b, #0\n\t"
|
||||
"aese v0.16b, v1.16b\n\t"
|
||||
"st1 { v0.16b }, [%0]"
|
||||
: : "r"(o), "r"(i) : "v0", "v1", "memory");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool test_MC(uint8_t *o, const uint8_t *i)
|
||||
{
|
||||
asm("ld1 { v0.16b }, [%1]\n\t"
|
||||
"aesmc v0.16b, v0.16b\n\t"
|
||||
"st1 { v0.16b }, [%0]"
|
||||
: : "r"(o), "r"(i) : "v0", "memory");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool test_SB_SR_MC_AK(uint8_t *o, const uint8_t *i, const uint8_t *k)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool test_ISB_ISR(uint8_t *o, const uint8_t *i)
|
||||
{
|
||||
/* aesd also adds round key, so supply zero. */
|
||||
asm("ld1 { v0.16b }, [%1]\n\t"
|
||||
"movi v1.16b, #0\n\t"
|
||||
"aesd v0.16b, v1.16b\n\t"
|
||||
"st1 { v0.16b }, [%0]"
|
||||
: : "r"(o), "r"(i) : "v0", "v1", "memory");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool test_IMC(uint8_t *o, const uint8_t *i)
|
||||
{
|
||||
asm("ld1 { v0.16b }, [%1]\n\t"
|
||||
"aesimc v0.16b, v0.16b\n\t"
|
||||
"st1 { v0.16b }, [%0]"
|
||||
: : "r"(o), "r"(i) : "v0", "memory");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool test_ISB_ISR_AK_IMC(uint8_t *o, const uint8_t *i, const uint8_t *k)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool test_ISB_ISR_IMC_AK(uint8_t *o, const uint8_t *i, const uint8_t *k)
|
||||
{
|
||||
return false;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue