aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/algboss.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-05-06 02:15:47 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2009-06-02 00:04:45 -0400
commitf8b0d4d09dc9d0a73fcdcf6c2724650529ec417d (patch)
tree922fed01215af467ce07778268466b3c50b09120 /crypto/algboss.c
parent29ecd4ab3d3aa8bb231361937165dfbbbc534e9a (diff)
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>
Diffstat (limited to 'crypto/algboss.c')
-rw-r--r--crypto/algboss.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/crypto/algboss.c b/crypto/algboss.c
index 6906f92aeac0..9908dd830c26 100644
--- a/crypto/algboss.c
+++ b/crypto/algboss.c
@@ -280,29 +280,13 @@ static struct notifier_block cryptomgr_notifier = {
280 280
281static int __init cryptomgr_init(void) 281static int __init cryptomgr_init(void)
282{ 282{
283 int err; 283 return crypto_register_notifier(&cryptomgr_notifier);
284
285 err = testmgr_init();
286 if (err)
287 return err;
288
289 err = crypto_register_notifier(&cryptomgr_notifier);
290 if (err)
291 goto free_testmgr;
292
293 return 0;
294
295free_testmgr:
296 testmgr_exit();
297 return err;
298} 284}
299 285
300static void __exit cryptomgr_exit(void) 286static void __exit cryptomgr_exit(void)
301{ 287{
302 int err = crypto_unregister_notifier(&cryptomgr_notifier); 288 int err = crypto_unregister_notifier(&cryptomgr_notifier);
303 BUG_ON(err); 289 BUG_ON(err);
304
305 testmgr_exit();
306} 290}
307 291
308subsys_initcall(cryptomgr_init); 292subsys_initcall(cryptomgr_init);