qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Ard Biesheuvel <ardb@kernel.org>, qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Zewen Ye" <lustrew@foxmail.com>,
	"Weiwei Li" <liweiwei@iscas.ac.cn>,
	"Junqiang Wang" <wangjunqiang@iscas.ac.cn>
Subject: Re: [PATCH v2] target/riscv: Use existing lookup tables for MixColumns
Date: Mon, 31 Jul 2023 08:16:02 -0700	[thread overview]
Message-ID: <db4d8cd1-a214-5991-0169-a66147816f72@linaro.org> (raw)
In-Reply-To: <20230731084043.1791984-1-ardb@kernel.org>

On 7/31/23 01:40, Ard Biesheuvel wrote:
> The AES MixColumns and InvMixColumns operations are relatively
> expensive 4x4 matrix multiplications in GF(2^8), which is why C
> implementations usually rely on precomputed lookup tables rather than
> performing the calculations on demand.
> 
> Given that we already carry those tables in QEMU, we can just grab the
> right value in the implementation of the RISC-V AES32 instructions. Note
> that the tables in question are permuted according to the respective
> Sbox, so we can omit the Sbox lookup as well in this case.
> 
> Cc: Richard Henderson<richard.henderson@linaro.org>
> Cc: Philippe Mathieu-Daudé<philmd@linaro.org>
> Cc: Zewen Ye<lustrew@foxmail.com>
> Cc: Weiwei Li<liweiwei@iscas.ac.cn>
> Cc: Junqiang Wang<wangjunqiang@iscas.ac.cn>
> Signed-off-by: Ard Biesheuvel<ardb@kernel.org>
> ---
> v2:
> - ignore host endianness and use be32_to_cpu() unconditionally

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


  reply	other threads:[~2023-07-31 15:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-31  8:40 [PATCH v2] target/riscv: Use existing lookup tables for MixColumns Ard Biesheuvel
2023-07-31 15:16 ` Richard Henderson [this message]
2023-08-02 13:41 ` Alistair Francis

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=db4d8cd1-a214-5991-0169-a66147816f72@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=ardb@kernel.org \
    --cc=liweiwei@iscas.ac.cn \
    --cc=lustrew@foxmail.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wangjunqiang@iscas.ac.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).