qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 02/35] target/arm: Move aesmc and aesimc tables to crypto/aes


From: Richard Henderson
Subject: Re: [PATCH 02/35] target/arm: Move aesmc and aesimc tables to crypto/aes.c
Date: Sat, 3 Jun 2023 08:21:38 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

On 6/3/23 05:45, Ard Biesheuvel wrote:
On Sat, 3 Jun 2023 at 04:34, Richard Henderson
<richard.henderson@linaro.org> wrote:

We do not currently have a table in crypto/ for
just MixColumns.  Move both tables for consistency.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
  include/crypto/aes.h           |   6 ++
  crypto/aes.c                   | 142 ++++++++++++++++++++++++++++++++
  target/arm/tcg/crypto_helper.c | 143 ++-------------------------------
  3 files changed, 153 insertions(+), 138 deletions(-)

diff --git a/include/crypto/aes.h b/include/crypto/aes.h
index 822d64588c..24b073d569 100644
--- a/include/crypto/aes.h
+++ b/include/crypto/aes.h
@@ -34,6 +34,12 @@ extern const uint8_t AES_isbox[256];
  extern const uint8_t AES_shifts[16];
  extern const uint8_t AES_ishifts[16];

+/* AES MixColumns, for use with rot32. */
+extern const uint32_t AES_mc_rot[256];
+
+/* AES InvMixColumns, for use with rot32. */
+extern const uint32_t AES_imc_rot[256];
+
  /* AES InvMixColumns */
  /* AES_imc[x][0] = [x].[0e, 09, 0d, 0b]; */
  /* AES_imc[x][1] = [x].[0b, 0e, 09, 0d]; */
diff --git a/crypto/aes.c b/crypto/aes.c
index af72ff7779..72c95c38fb 100644
--- a/crypto/aes.c
+++ b/crypto/aes.c
@@ -116,6 +116,148 @@ const uint8_t AES_ishifts[16] = {
      0, 13, 10, 7, 4, 1, 14, 11, 8, 5, 2, 15, 12, 9, 6, 3
  };

+/*
+ * MixColumns lookup table, for use with rot32.
+ * From Arm ARM pseudocode.

I remember writing the code to generate these tables, and my copy of
the ARM ARM doesn't appear to have them, so this comment seems
inaccurate to me.

Quite right. I remember having copied *some* table from the ARM, but it wasn't this one. I went back to A.a to double-check that it simply wasn't removed from a recent edition.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]