crypto: chacha20poly1305 - add back missing test vectors and test chunking
authorJason A. Donenfeld <Jason@zx2c4.com>
Thu, 16 Jan 2020 20:26:34 +0000 (21:26 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Apr 2020 08:59:33 +0000 (10:59 +0200)
commit33f9d39f52af801a68ab0d83a15451ff12e9f8a0
tree0881be6468353fe0727a9210e03e095ab21c2e66
parent59d90c5e223d1039c4f3dcf934827d4dea7b8f9c
crypto: chacha20poly1305 - add back missing test vectors and test chunking

commit 72c7943792c9e7788ddd182337bcf8f650cf56f5 upstream.

When this was originally ported, the 12-byte nonce vectors were left out
to keep things simple. I agree that we don't need nor want a library
interface for 12-byte nonces. But these test vectors were specially
crafted to look at issues in the underlying primitives and related
interactions.  Therefore, we actually want to keep around all of the
test vectors, and simply have a helper function to test them with.

Secondly, the sglist-based chunking code in the library interface is
rather complicated, so this adds a developer-only test for ensuring that
all the book keeping is correct, across a wide array of possibilities.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
lib/crypto/chacha20poly1305-selftest.c