aboutsummaryrefslogtreecommitdiff
path: root/include/crypto
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-06-02 02:01:23 -0700
committerRichard Henderson <richard.henderson@linaro.org>2023-07-08 07:30:17 +0100
commit5b41deb3108c48143d6697cd2dcde3f0b9a57c80 (patch)
treed408d36c44a2a234abbbcae66532711f2318bd54 /include/crypto
parent04e1f30eedfe581c0c3b6bc6b6f5f76c65dc2c71 (diff)
crypto: Add aesdec_IMC
Add a primitive for InvMixColumns. Acked-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include/crypto')
-rw-r--r--include/crypto/aes-round.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/crypto/aes-round.h b/include/crypto/aes-round.h
index 7d2be40a67..7be2cc0d8e 100644
--- a/include/crypto/aes-round.h
+++ b/include/crypto/aes-round.h
@@ -60,6 +60,24 @@ static inline void aesenc_SB_SR_AK(AESState *r, const AESState *st,
}
/*
+ * Perform InvMixColumns.
+ */
+
+void aesdec_IMC_gen(AESState *ret, const AESState *st);
+void aesdec_IMC_genrev(AESState *ret, const AESState *st);
+
+static inline void aesdec_IMC(AESState *r, const AESState *st, bool be)
+{
+ if (HAVE_AES_ACCEL) {
+ aesdec_IMC_accel(r, st, be);
+ } else if (HOST_BIG_ENDIAN == be) {
+ aesdec_IMC_gen(r, st);
+ } else {
+ aesdec_IMC_genrev(r, st);
+ }
+}
+
+/*
* Perform InvSubBytes + InvShiftRows + AddRoundKey.
*/