]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
crypto: testmgr - generate inauthentic AEAD test vectors
authorEric Biggers <ebiggers@google.com>
Sun, 1 Dec 2019 21:53:30 +0000 (13:53 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 11 Dec 2019 08:37:01 +0000 (16:37 +0800)
commit49763fc6b1af422e742e58fd04e078ab011edd96
treeaf3c9af3fa69ea1fc6256f58343602a279fa5432
parent2ea915054cf2dc1ccc145d7c75d3dad8dde15be3
crypto: testmgr - generate inauthentic AEAD test vectors

The whole point of using an AEAD over length-preserving encryption is
that the data is authenticated.  However currently the fuzz tests don't
test any inauthentic inputs to verify that the data is actually being
authenticated.  And only two algorithms ("rfc4543(gcm(aes))" and
"ccm(aes)") even have any inauthentic test vectors at all.

Therefore, update the AEAD fuzz tests to sometimes generate inauthentic
test vectors, either by generating a (ciphertext, AAD) pair without
using the key, or by mutating an authentic pair that was generated.

To avoid flakiness, only assume this works reliably if the auth tag is
at least 8 bytes.  Also account for the rfc4106, rfc4309, and rfc7539esp
algorithms intentionally ignoring the last 8 AAD bytes, and for some
algorithms doing extra checks that result in EINVAL rather than EBADMSG.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/testmgr.c
crypto/testmgr.h