[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMj1kXF1hoyW6fdidJ2Dt4R_qBv_QLNaowKf4LM5Oe3_zaJuTA@mail.gmail.com>
Date: Mon, 6 Dec 2021 23:14:27 +0100
From: Ard Biesheuvel <ardb@...nel.org>
To: "Bae, Chang Seok" <chang.seok.bae@...el.com>
Cc: Eric Biggers <ebiggers@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...e.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"mingo@...nel.org" <mingo@...nel.org>,
"Lutomirski, Andy" <luto@...nel.org>,
"x86@...nel.org" <x86@...nel.org>,
"herbert@...dor.apana.org.au" <herbert@...dor.apana.org.au>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"Williams, Dan J" <dan.j.williams@...el.com>,
"Gairuboyina, Charishma1" <charishma1.gairuboyina@...el.com>,
"Dwarakanath, Kumar N" <kumar.n.dwarakanath@...el.com>,
"Krishnakumar, Lalithambika" <lalithambika.krishnakumar@...el.com>,
"Shankar, Ravi V" <ravi.v.shankar@...el.com>
Subject: Re: [PATCH v3 11/15] crypto: x86/aes-kl - Support AES algorithm using
Key Locker instructions
On Tue, 30 Nov 2021 at 07:57, Bae, Chang Seok <chang.seok.bae@...el.com> wrote:
>
> On Nov 29, 2021, at 19:48, Eric Biggers <ebiggers@...nel.org> wrote:
> > On Wed, Nov 24, 2021 at 12:06:56PM -0800, Chang S. Bae wrote:
...
> >> diff --git a/arch/x86/crypto/aeskl-intel_asm.S b/arch/x86/crypto/aeskl-intel_asm.S
> >> new file mode 100644
> >> index 000000000000..d56ec8dd6644
> >> --- /dev/null
> >> +++ b/arch/x86/crypto/aeskl-intel_asm.S
> >
> > This file gets very long after all the modes are added (> 1100 lines). Is there
> > really no feasible way to share code between this and aesni-intel_asm.S, similar
> > to how the arm64 AES implementations work? Surely most of the logic is the
> > same, and it's just the actual AES instructions that differ?
>
> No, these two instruction sets are separate. So I think no room to share the
> ASM code.
>
On arm64, we have
aes-ce.S, which uses AES instructions to implement the AES core transforms
aes-neon.S, which uses plain NEON instructions to implement the AES
core transforms
aes-modes.S, which can be combined with either of the above, and
implements the various chaining modes (ECB, CBC, CTR, XTS, and a
helper for CMAC, CBCMAC and XMAC)
If you have two different primitives for performing AES transforms
(the original round by round one, and the KL one that does 10 or 14
rounds at a time), you should still be able to reuse most of the code
that implements the non-trivial handling of the chaining modes.
> >> +config CRYPTO_AES_KL
> >> + tristate "AES cipher algorithms (AES-KL)"
> >> + depends on (LD_VERSION >= 23600) || (LLD_VERSION >= 120000)
> >> + depends on DM_CRYPT
> >
> > 'depends on DM_CRYPT' doesn't really make sense here, since there is no actual
> > dependency on dm-crypt in the code.
>
> I think the intention here is to build a policy that the library is available
> only when there is a clear use case.
>
> But maybe putting such restriction is too much here.
>
> Thanks
> Chang
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/crypto/aes_generic.c
>
>
Powered by blists - more mailing lists