summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorTom Musta <tommusta@gmail.com>2014-03-13 09:13:26 -0500
committerAlexander Graf <agraf@suse.de>2014-06-16 13:24:33 +0200
commit1c1a6d20e0bceef5b5ce68930bf255021c326cce (patch)
treebfbf66969ee8e82684c072376ab8765603869c73 /util
parent40c84b54dd47f3ad2a170c036a97aa1b777c645d (diff)
downloadqemu-1c1a6d20e0bceef5b5ce68930bf255021c326cce.tar.gz
util: Add AES ShiftRows and InvShiftRows Tables
This patch adds tables that implement the Advanced Encryption Standard (AES) ShiftRows and InvShiftRows transformations. These are commonly used in instruction models. Signed-off-by: Tom Musta <tommusta@gmail.com> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'util')
-rw-r--r--util/aes.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/util/aes.c b/util/aes.c
index eeb644b6ca..c26cf55f59 100644
--- a/util/aes.c
+++ b/util/aes.c
@@ -108,6 +108,14 @@ const uint8_t AES_isbox[256] = {
0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D,
};
+const uint8_t AES_shifts[16] = {
+ 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, 1, 6, 11
+};
+
+const uint8_t AES_ishifts[16] = {
+ 0, 13, 10, 7, 4, 1, 14, 11, 8, 5, 2, 15, 12, 9, 6, 3
+};
+
/*
AES_Te0[x] = S [x].[02, 01, 01, 03];
AES_Te1[x] = S [x].[03, 02, 01, 01];