From: Tom Musta <tommusta@gmail.com>
To: qemu-devel@nongnu.org
Cc: Tom Musta <tommusta@gmail.com>, qemu-ppc@nongnu.org
Subject: [Qemu-devel] [PATCH 2/6] util: Add AES ShiftRows and InvShiftRows Tables
Date: Mon, 10 Mar 2014 14:04:58 -0500 [thread overview]
Message-ID: <1394478302-8474-3-git-send-email-tommusta@gmail.com> (raw)
In-Reply-To: <1394478302-8474-1-git-send-email-tommusta@gmail.com>
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>
diff --git a/include/qemu/aes.h b/include/qemu/aes.h
index a4044f5..c45bc57 100644
--- a/include/qemu/aes.h
+++ b/include/qemu/aes.h
@@ -26,6 +26,10 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
extern const uint8_t AES_sbox[256];
extern const uint8_t AES_isbox[256];
+/* AES ShiftRows and InvShiftRows */
+extern const uint8_t AES_shifts[16];
+extern const uint8_t AES_ishifts[16];
+
/*
AES_Te0[x] = S [x].[02, 01, 01, 03];
AES_Te1[x] = S [x].[03, 02, 01, 01];
diff --git a/util/aes.c b/util/aes.c
index eeb644b..c26cf55 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];
--
1.7.1
next prev parent reply other threads:[~2014-03-10 19:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-10 19:04 [Qemu-devel] [PATCH 0/6] Refactor AES Instructions Tom Musta
2014-03-10 19:04 ` [Qemu-devel] [PATCH 1/6] util: Add S-Box and InvS-Box Arrays to Common AES Utils Tom Musta
2014-03-10 19:04 ` Tom Musta [this message]
2014-03-10 19:04 ` [Qemu-devel] [PATCH 3/6] util: Add InvMixColumns Tom Musta
2014-03-10 19:05 ` [Qemu-devel] [PATCH 4/6] target-i386: Use Common ShiftRows and InvShiftRows Tables Tom Musta
2014-03-10 19:05 ` [Qemu-devel] [PATCH 5/6] target-arm: Use Common Tables in AES Instructions Tom Musta
2014-03-12 22:37 ` Richard Henderson
2014-03-10 19:05 ` [Qemu-devel] [PATCH 6/6] target-ppc: Refactor " Tom Musta
2014-03-12 22:40 ` [Qemu-devel] [PATCH 0/6] " Richard Henderson
2014-03-13 13:14 ` Tom Musta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1394478302-8474-3-git-send-email-tommusta@gmail.com \
--to=tommusta@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.