linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Willi <martin@strongswan.org>
To: Eric Biggers <ebiggers@kernel.org>, linux-crypto@vger.kernel.org
Cc: 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: Sat, 01 Dec 2018 17:40:40 +0100	[thread overview]
Message-ID: <99ed681fa4d3233b18ae9328a14f9e23971073cb.camel@strongswan.org> (raw)
In-Reply-To: <20181129230217.158038-5-ebiggers@kernel.org>


> 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?

For the other parts:

Reviewed-by: Martin Willi <martin@strongswan.org>



  reply	other threads:[~2018-12-01 16:40 UTC|newest]

Thread overview: 14+ 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-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 [this message]
2018-12-05  6:10     ` Eric Biggers
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=99ed681fa4d3233b18ae9328a14f9e23971073cb.camel@strongswan.org \
    --to=martin@strongswan.org \
    --cc=Jason@zx2c4.com \
    --cc=ebiggers@kernel.org \
    --cc=gmazyland@gmail.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).