From: Eric Biggers <ebiggers@kernel.org>
To: Martin Willi <martin@strongswan.org>
Cc: linux-crypto@vger.kernel.org,
Paul Crowley <paulcrowley@google.com>,
Milan Broz <gmazyland@gmail.com>,
"Jason A . Donenfeld" <Jason@zx2c4.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/6] crypto: x86/chacha20 - add XChaCha20 support
Date: Tue, 4 Dec 2018 22:10:55 -0800 [thread overview]
Message-ID: <20181205061054.GA26750@sol.localdomain> (raw)
In-Reply-To: <99ed681fa4d3233b18ae9328a14f9e23971073cb.camel@strongswan.org>
Hi Martin,
On Sat, Dec 01, 2018 at 05:40:40PM +0100, Martin Willi wrote:
>
> > An SSSE3 implementation of single-block HChaCha20 is also added so
> > that XChaCha20 can use it rather than the generic
> > implementation. This required refactoring the ChaCha permutation
> > into its own function.
>
> > [...]
>
> > +ENTRY(chacha20_block_xor_ssse3)
> > + # %rdi: Input state matrix, s
> > + # %rsi: up to 1 data block output, o
> > + # %rdx: up to 1 data block input, i
> > + # %rcx: input/output length in bytes
> > +
> > + # x0..3 = s0..3
> > + movdqa 0x00(%rdi),%xmm0
> > + movdqa 0x10(%rdi),%xmm1
> > + movdqa 0x20(%rdi),%xmm2
> > + movdqa 0x30(%rdi),%xmm3
> > + movdqa %xmm0,%xmm8
> > + movdqa %xmm1,%xmm9
> > + movdqa %xmm2,%xmm10
> > + movdqa %xmm3,%xmm11
> > +
> > + mov %rcx,%rax
> > + call chacha20_permute
> > +
> > # o0 = i0 ^ (x0 + s0)
> > paddd %xmm8,%xmm0
> > cmp $0x10,%rax
> > @@ -189,6 +198,23 @@ ENTRY(chacha20_block_xor_ssse3)
> >
> > ENDPROC(chacha20_block_xor_ssse3)
> >
> > +ENTRY(hchacha20_block_ssse3)
> > + # %rdi: Input state matrix, s
> > + # %rsi: output (8 32-bit words)
> > +
> > + movdqa 0x00(%rdi),%xmm0
> > + movdqa 0x10(%rdi),%xmm1
> > + movdqa 0x20(%rdi),%xmm2
> > + movdqa 0x30(%rdi),%xmm3
> > +
> > + call chacha20_permute
>
> AFAIK, the general convention is to create proper stack frames using
> FRAME_BEGIN/END for non leaf-functions. Should chacha20_permute()
> callers do so?
>
Yes, I'll do that. (Ard suggested similarly in the arm64 version too.)
- Eric
next prev parent reply other threads:[~2018-12-05 6:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-29 23:02 [PATCH v2 0/6] crypto: x86_64 optimized XChaCha and NHPoly1305 (for Adiantum) Eric Biggers
2018-11-29 23:02 ` [PATCH v2 1/6] crypto: x86/nhpoly1305 - add SSE2 accelerated NHPoly1305 Eric Biggers
2018-11-29 23:02 ` [PATCH v2 2/6] crypto: x86/nhpoly1305 - add AVX2 " Eric Biggers
2018-11-29 23:02 ` [PATCH v2 3/6] crypto: x86/chacha20 - limit the preemption-disabled section Eric Biggers
2018-12-02 10:47 ` Martin Willi
2018-12-03 14:13 ` Ard Biesheuvel
2018-12-03 14:13 ` Ard Biesheuvel
2018-12-05 6:15 ` Eric Biggers
2018-12-05 6:15 ` Eric Biggers
2018-11-29 23:02 ` [PATCH v2 4/6] crypto: x86/chacha20 - add XChaCha20 support Eric Biggers
2018-12-01 16:40 ` Martin Willi
2018-12-05 6:10 ` Eric Biggers [this message]
2018-11-29 23:02 ` [PATCH v2 5/6] crypto: x86/chacha20 - refactor to allow varying number of rounds Eric Biggers
2018-12-01 16:43 ` Martin Willi
2018-11-29 23:02 ` [PATCH v2 6/6] crypto: x86/chacha - add XChaCha12 support Eric Biggers
2018-12-01 16:47 ` Martin Willi
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=20181205061054.GA26750@sol.localdomain \
--to=ebiggers@kernel.org \
--cc=Jason@zx2c4.com \
--cc=gmazyland@gmail.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin@strongswan.org \
--cc=paulcrowley@google.com \
/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