crypto: testmgr - Dynamically allocate xbuf and axbuf
authorHerbert Xu <herbert@gondor.apana.org.au>
Wed, 6 May 2009 06:15:47 +0000 (14:15 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 2 Jun 2009 04:04:45 +0000 (14:04 +1000)
commitf8b0d4d09dc9d0a73fcdcf6c2724650529ec417d
tree922fed01215af467ce07778268466b3c50b09120
parent29ecd4ab3d3aa8bb231361937165dfbbbc534e9a
crypto: testmgr - Dynamically allocate xbuf and axbuf

We currently allocate temporary memory that is used for testing
statically.  This renders the testing engine non-reentrant. As
algorithms may nest, i.e., one may construct another in order to
carry out a part of its operation, this is unacceptable.  For
example, it has been reported that an AEAD implementation allocates
a cipher in its setkey function, which causes it to fail during
testing as the temporary memory is overwritten.

This patch replaces the static memory with dynamically allocated
buffers.  We need a maximum of 16 pages so this slightly increases
the chances of an algorithm failing due to memory shortage.
However, as testing usually occurs at registration, this shouldn't
be a big problem.

Reported-by: Shasi Pulijala <spulijala@amcc.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/algboss.c
crypto/internal.h
crypto/testmgr.c