[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 29/37] crypto: Add aesdec_ISB_ISR_AK_IMC
From: |
Richard Henderson |
Subject: |
[PATCH v3 29/37] crypto: Add aesdec_ISB_ISR_AK_IMC |
Date: |
Tue, 20 Jun 2023 13:07:50 +0200 |
Add a primitive for InvSubBytes + InvShiftRows +
AddRoundKey + InvMixColumns.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
host/include/generic/host/crypto/aes-round.h | 3 +++
include/crypto/aes-round.h | 21 ++++++++++++++++++++
crypto/aes.c | 14 +++++++++++++
3 files changed, 38 insertions(+)
diff --git a/host/include/generic/host/crypto/aes-round.h
b/host/include/generic/host/crypto/aes-round.h
index db8cfe17eb..1b9720f917 100644
--- a/host/include/generic/host/crypto/aes-round.h
+++ b/host/include/generic/host/crypto/aes-round.h
@@ -23,6 +23,9 @@ void aesdec_IMC_accel(AESState *, const AESState *, bool)
void aesdec_ISB_ISR_AK_accel(AESState *, const AESState *,
const AESState *, bool)
QEMU_ERROR("unsupported accel");
+void aesdec_ISB_ISR_AK_IMC_accel(AESState *, const AESState *,
+ const AESState *, bool)
+ QEMU_ERROR("unsupported accel");
void aesdec_ISB_ISR_IMC_AK_accel(AESState *, const AESState *,
const AESState *, bool)
QEMU_ERROR("unsupported accel");
diff --git a/include/crypto/aes-round.h b/include/crypto/aes-round.h
index 68cec14950..ffd8ec6fa8 100644
--- a/include/crypto/aes-round.h
+++ b/include/crypto/aes-round.h
@@ -119,6 +119,27 @@ static inline void aesdec_ISB_ISR_AK(AESState *r, const
AESState *st,
}
}
+/*
+ * Perform InvSubBytes + InvShiftRows + AddRoundKey + InvMixColumns.
+ */
+
+void aesdec_ISB_ISR_AK_IMC_gen(AESState *ret, const AESState *st,
+ const AESState *rk);
+void aesdec_ISB_ISR_AK_IMC_genrev(AESState *ret, const AESState *st,
+ const AESState *rk);
+
+static inline void aesdec_ISB_ISR_AK_IMC(AESState *r, const AESState *st,
+ const AESState *rk, bool be)
+{
+ if (HAVE_AES_ACCEL) {
+ aesdec_ISB_ISR_AK_IMC_accel(r, st, rk, be);
+ } else if (HOST_BIG_ENDIAN == be) {
+ aesdec_ISB_ISR_AK_IMC_gen(r, st, rk);
+ } else {
+ aesdec_ISB_ISR_AK_IMC_genrev(r, st, rk);
+ }
+}
+
/*
* Perform InvSubBytes + InvShiftRows + InvMixColumns + AddRoundKey.
*/
diff --git a/crypto/aes.c b/crypto/aes.c
index 53696e8953..2676faa962 100644
--- a/crypto/aes.c
+++ b/crypto/aes.c
@@ -1576,6 +1576,20 @@ void aesdec_ISB_ISR_IMC_AK_genrev(AESState *r, const
AESState *st,
aesdec_ISB_ISR_IMC_AK_swap(r, st, rk, true);
}
+void aesdec_ISB_ISR_AK_IMC_gen(AESState *ret, const AESState *st,
+ const AESState *rk)
+{
+ aesdec_ISB_ISR_AK_gen(ret, st, rk);
+ aesdec_IMC_gen(ret, ret);
+}
+
+void aesdec_ISB_ISR_AK_IMC_genrev(AESState *ret, const AESState *st,
+ const AESState *rk)
+{
+ aesdec_ISB_ISR_AK_genrev(ret, st, rk);
+ aesdec_IMC_genrev(ret, ret);
+}
+
/**
* Expand the cipher key into the encryption key schedule.
*/
--
2.34.1
- Re: [PATCH v3 22/37] crypto: Add aesenc_SB_SR_MC_AK, (continued)
- [PATCH v3 24/37] target/ppc: Use aesenc_SB_SR_MC_AK, Richard Henderson, 2023/06/20
- [PATCH v3 23/37] target/i386: Use aesenc_SB_SR_MC_AK, Richard Henderson, 2023/06/20
- [PATCH v3 25/37] target/riscv: Use aesenc_SB_SR_MC_AK, Richard Henderson, 2023/06/20
- [PATCH v3 28/37] target/riscv: Use aesdec_ISB_ISR_IMC_AK, Richard Henderson, 2023/06/20
- [PATCH v3 32/37] crypto: Implement aesdec_IMC with AES_imc_rot, Richard Henderson, 2023/06/20
- [PATCH v3 27/37] target/i386: Use aesdec_ISB_ISR_IMC_AK, Richard Henderson, 2023/06/20
- [PATCH v3 26/37] crypto: Add aesdec_ISB_ISR_IMC_AK, Richard Henderson, 2023/06/20
- [PATCH v3 29/37] crypto: Add aesdec_ISB_ISR_AK_IMC,
Richard Henderson <=
- [PATCH v3 31/37] crypto: Remove AES_shifts, AES_ishifts, Richard Henderson, 2023/06/20
- [PATCH v3 33/37] crypto: Remove AES_imc, Richard Henderson, 2023/06/20
- [PATCH v3 30/37] target/ppc: Use aesdec_ISB_ISR_AK_IMC, Richard Henderson, 2023/06/20
- [PATCH v3 34/37] crypto: Unexport AES_*_rot, AES_TeN, AES_TdN, Richard Henderson, 2023/06/20
- [PATCH v3 36/37] host/include/aarch64: Implement aes-round.h, Richard Henderson, 2023/06/20
- [PATCH v3 35/37] host/include/i386: Implement aes-round.h, Richard Henderson, 2023/06/20