Thread (20 messages) flat view 20 messages, 6 authors, 2017-01-13

Re: [PATCH v2 8/8] crypto/testmgr: Allocate only the required output size for hash tests

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2017-01-12 16:44:37
Also in: linux-crypto, lkml

On Tue, Jan 10, 2017 at 03:24:46PM -0800, Andy Lutomirski wrote:
There are some hashes (e.g. sha224) that have some internal trickery
to make sure that only the correct number of output bytes are
generated.  If something goes wrong, they could potentially overrun
the output buffer.

Make the test more robust by allocating only enough space for the
correct output size so that memory debugging will catch the error if
the output is overrun.

Tested by intentionally breaking sha224 to output all 256
internally-generated bits while running on KASAN.

Cc: Ard Biesheuvel <redacted>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Patch applied.  Thanks.
-- 
Email: Herbert Xu [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help