crypto: chacha20-generic - add HChaCha20 library function
authorEric Biggers <ebiggers@google.com>
Sat, 17 Nov 2018 01:26:18 +0000 (17:26 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 20 Nov 2018 06:26:55 +0000 (14:26 +0800)
commitdd333449d0fb667c5250c42488a7e90470e16c77
tree4377def3ee5095c9d866430d20cffcabbe7f90fd
parent3d234b3313cd12157946522fe35f5a4574f31169
crypto: chacha20-generic - add HChaCha20 library function

Refactor the unkeyed permutation part of chacha20_block() into its own
function, then add hchacha20_block() which is the ChaCha equivalent of
HSalsa20 and is an intermediate step towards XChaCha20 (see
https://cr.yp.to/snuffle/xsalsa-20081128.pdf).  HChaCha20 skips the
final addition of the initial state, and outputs only certain words of
the state.  It should not be used for streaming directly.

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Martin Willi <martin@strongswan.org>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
include/crypto/chacha20.h
lib/chacha20.c