aboutsummaryrefslogtreecommitdiff
path: root/include/crypto
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-06-02 01:49:21 -0700
committerRichard Henderson <richard.henderson@linaro.org>2023-07-08 07:30:17 +0100
commit04e1f30eedfe581c0c3b6bc6b6f5f76c65dc2c71 (patch)
tree1bd22fc5421d62f3f1a09348a3621546598c9435 /include/crypto
parent192fa84986a6e060f353ed491fe635ccd960876e (diff)
downloadqemu-04e1f30eedfe581c0c3b6bc6b6f5f76c65dc2c71.zip
qemu-04e1f30eedfe581c0c3b6bc6b6f5f76c65dc2c71.tar.gz
qemu-04e1f30eedfe581c0c3b6bc6b6f5f76c65dc2c71.tar.bz2
crypto: Add aesenc_MC
Add a primitive for MixColumns. 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 dcf098b..7d2be40 100644
--- a/include/crypto/aes-round.h
+++ b/include/crypto/aes-round.h
@@ -21,6 +21,24 @@ typedef union {
#include "host/crypto/aes-round.h"
/*
+ * Perform MixColumns.
+ */
+
+void aesenc_MC_gen(AESState *ret, const AESState *st);
+void aesenc_MC_genrev(AESState *ret, const AESState *st);
+
+static inline void aesenc_MC(AESState *r, const AESState *st, bool be)
+{
+ if (HAVE_AES_ACCEL) {
+ aesenc_MC_accel(r, st, be);
+ } else if (HOST_BIG_ENDIAN == be) {
+ aesenc_MC_gen(r, st);
+ } else {
+ aesenc_MC_genrev(r, st);
+ }
+}
+
+/*
* Perform SubBytes + ShiftRows + AddRoundKey.
*/