]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: testmgr - don't try to decrypt uninitialized buffers
authorEric Biggers <ebiggers@google.com>
Sun, 1 Dec 2019 21:53:26 +0000 (13:53 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 11 Dec 2019 08:37:00 +0000 (16:37 +0800)
commit02b24160ddc602acdb9c767083e88bb4b244d81f
treebe075acd0785171e3d214f8703b44518db873ea9
parent4412ca548e778326ae2e747c8fee6e0c0c316ee3
crypto: testmgr - don't try to decrypt uninitialized buffers

Currently if the comparison fuzz tests encounter an encryption error
when generating an skcipher or AEAD test vector, they will still test
the decryption side (passing it the uninitialized ciphertext buffer)
and expect it to fail with the same error.

This is sort of broken because it's not well-defined usage of the API to
pass an uninitialized buffer, and furthermore in the AEAD case it's
acceptable for the decryption error to be EBADMSG (meaning "inauthentic
input") even if the encryption error was something else like EINVAL.

Fix this for skcipher by explicitly initializing the ciphertext buffer
on error, and for AEAD by skipping the decryption test on error.

Reported-by: Pascal Van Leeuwen <pvanleeuwen@verimatrix.com>
Fixes: 1ffbbe2d42ce ("crypto: testmgr - fuzz skciphers against their generic implementation")
Fixes: 848a0652f865 ("crypto: testmgr - fuzz AEADs against their generic implementation")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/testmgr.c