aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorFrank Seidel <frank@f-seidel.de>2009-03-29 03:18:39 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2009-06-02 00:04:09 -0400
commit376bacb0a26bca722981d1610ffb76f951572bb1 (patch)
tree396c711518b70363b7325be933ac2fa6ed56a54e /crypto
parentd315a0e09f1c8b833cacd5e72f3edea419978138 (diff)
crypto: tcrypt - Reduce stack size
Applying kernel janitors todos (printk calls need KERN_* constants on linebeginnings, reduce stack footprint where possible) to tcrypts test_hash_speed (where stacks memory footprint was very high (on i386 1184 bytes to 160 now). Signed-off-by: Frank Seidel <frank@f-seidel.de> Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/tcrypt.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index c3c9124209a1..50d1e35bbff4 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -396,16 +396,16 @@ static void test_hash_speed(const char *algo, unsigned int sec,
396 struct scatterlist sg[TVMEMSIZE]; 396 struct scatterlist sg[TVMEMSIZE];
397 struct crypto_hash *tfm; 397 struct crypto_hash *tfm;
398 struct hash_desc desc; 398 struct hash_desc desc;
399 char output[1024]; 399 static char output[1024];
400 int i; 400 int i;
401 int ret; 401 int ret;
402 402
403 printk("\ntesting speed of %s\n", algo); 403 printk(KERN_INFO "\ntesting speed of %s\n", algo);
404 404
405 tfm = crypto_alloc_hash(algo, 0, CRYPTO_ALG_ASYNC); 405 tfm = crypto_alloc_hash(algo, 0, CRYPTO_ALG_ASYNC);
406 406
407 if (IS_ERR(tfm)) { 407 if (IS_ERR(tfm)) {
408 printk("failed to load transform for %s: %ld\n", algo, 408 printk(KERN_ERR "failed to load transform for %s: %ld\n", algo,
409 PTR_ERR(tfm)); 409 PTR_ERR(tfm));
410 return; 410 return;
411 } 411 }
@@ -414,7 +414,7 @@ static void test_hash_speed(const char *algo, unsigned int sec,
414 desc.flags = 0; 414 desc.flags = 0;
415 415
416 if (crypto_hash_digestsize(tfm) > sizeof(output)) { 416 if (crypto_hash_digestsize(tfm) > sizeof(output)) {
417 printk("digestsize(%u) > outputbuffer(%zu)\n", 417 printk(KERN_ERR "digestsize(%u) > outputbuffer(%zu)\n",
418 crypto_hash_digestsize(tfm), sizeof(output)); 418 crypto_hash_digestsize(tfm), sizeof(output));
419 goto out; 419 goto out;
420 } 420 }
@@ -427,12 +427,14 @@ static void test_hash_speed(const char *algo, unsigned int sec,
427 427
428 for (i = 0; speed[i].blen != 0; i++) { 428 for (i = 0; speed[i].blen != 0; i++) {
429 if (speed[i].blen > TVMEMSIZE * PAGE_SIZE) { 429 if (speed[i].blen > TVMEMSIZE * PAGE_SIZE) {
430 printk("template (%u) too big for tvmem (%lu)\n", 430 printk(KERN_ERR
431 "template (%u) too big for tvmem (%lu)\n",
431 speed[i].blen, TVMEMSIZE * PAGE_SIZE); 432 speed[i].blen, TVMEMSIZE * PAGE_SIZE);
432 goto out; 433 goto out;
433 } 434 }
434 435
435 printk("test%3u (%5u byte blocks,%5u bytes per update,%4u updates): ", 436 printk(KERN_INFO "test%3u "
437 "(%5u byte blocks,%5u bytes per update,%4u updates): ",
436 i, speed[i].blen, speed[i].plen, speed[i].blen / speed[i].plen); 438 i, speed[i].blen, speed[i].plen, speed[i].blen / speed[i].plen);
437 439
438 if (sec) 440 if (sec)
@@ -443,7 +445,7 @@ static void test_hash_speed(const char *algo, unsigned int sec,
443 speed[i].plen, output); 445 speed[i].plen, output);
444 446
445 if (ret) { 447 if (ret) {
446 printk("hashing failed ret=%d\n", ret); 448 printk(KERN_ERR "hashing failed ret=%d\n", ret);
447 break; 449 break;
448 } 450 }
449 } 451 }