aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-06-02 01:52:09 -0700
committerRichard Henderson <richard.henderson@linaro.org>2023-07-09 13:46:53 +0100
commit8b103ed70e74baab2803a46ca1ccf52853eadf68 (patch)
treea3bfa214c68c6f33d6a18df95c004ce3215afdd0 /target
parent2a8b545ffdb08fb2d5f37cbcc84d19629c419b3b (diff)
downloadqemu-8b103ed70e74baab2803a46ca1ccf52853eadf68.zip
qemu-8b103ed70e74baab2803a46ca1ccf52853eadf68.tar.gz
qemu-8b103ed70e74baab2803a46ca1ccf52853eadf68.tar.bz2
target/arm: Use aesenc_MC
This implements the AESMC instruction. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target')
-rw-r--r--target/arm/tcg/crypto_helper.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/target/arm/tcg/crypto_helper.c b/target/arm/tcg/crypto_helper.c
index d2cb74e..1952aaa 100644
--- a/target/arm/tcg/crypto_helper.c
+++ b/target/arm/tcg/crypto_helper.c
@@ -124,7 +124,20 @@ void HELPER(crypto_aesmc)(void *vd, void *vm, uint32_t desc)
intptr_t i, opr_sz = simd_oprsz(desc);
for (i = 0; i < opr_sz; i += 16) {
- do_crypto_aesmc(vd + i, vm + i, AES_mc_rot);
+ AESState *ad = (AESState *)(vd + i);
+ AESState *st = (AESState *)(vm + i);
+ AESState t;
+
+ /* Our uint64_t are in the wrong order for big-endian. */
+ if (HOST_BIG_ENDIAN) {
+ t.d[0] = st->d[1];
+ t.d[1] = st->d[0];
+ aesenc_MC(&t, &t, false);
+ ad->d[0] = t.d[1];
+ ad->d[1] = t.d[0];
+ } else {
+ aesenc_MC(ad, st, false);
+ }
}
clear_tail(vd, opr_sz, simd_maxsz(desc));
}