crypto: chacha20poly1305 - Skip encryption/decryption for 0-len
authorJason A. Donenfeld <Jason@zx2c4.com>
Sun, 6 Dec 2015 01:51:38 +0000 (02:51 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 9 Dec 2015 12:16:04 +0000 (20:16 +0800)
commit161151d79ff4f7ed35d4ebb0eb7727a517c34ef2
tree8987b80f9b613c8a30280f73873dad1239247a83
parent3d5b1ecdea6fb94f8c61554fcb2ba776a2d3d0e6
crypto: chacha20poly1305 - Skip encryption/decryption for 0-len

If the length of the plaintext is zero, there's no need to waste cycles
on encryption and decryption. Using the chacha20poly1305 construction
for zero-length plaintexts is a common way of using a shared encryption
key for AAD authentication.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/chacha20poly1305.c