OSDN Git Service

crypto: x86/chacha20 - Support partial lengths in 1-block SSSE3 variant
authorMartin Willi <martin@strongswan.org>
Sun, 11 Nov 2018 09:36:25 +0000 (10:36 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 16 Nov 2018 06:11:04 +0000 (14:11 +0800)
commite4e72063d3c0ee9ba10faeb5645dcdaae2d733e9
treea012d1564a5c5491b3488e699e71b6159d21bf0c
parent05ba88468b7d85c50d0945446248e0fcda7536bb
crypto: x86/chacha20 - Support partial lengths in 1-block SSSE3 variant

Add a length argument to the single block function for SSSE3, so the
block function may XOR only a partial length of the full block. Given
that the setup code is rather cheap, the function does not process more
than one block; this allows us to keep the block function selection in
the C glue code.

The required branching does not negatively affect performance for full
block sizes. The partial XORing uses simple "rep movsb" to copy the
data before and after doing XOR in SSE. This is rather efficient on
modern processors; movsw can be slightly faster, but the additional
complexity is probably not worth it.

Signed-off-by: Martin Willi <martin@strongswan.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/x86/crypto/chacha20-ssse3-x86_64.S
arch/x86/crypto/chacha20_glue.c