Commit 376bacb0 authored by Frank Seidel's avatar Frank Seidel Committed by Herbert Xu

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: default avatarFrank Seidel <frank@f-seidel.de>
Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent d315a0e0
...@@ -396,16 +396,16 @@ static void test_hash_speed(const char *algo, unsigned int sec, ...@@ -396,16 +396,16 @@ static void test_hash_speed(const char *algo, unsigned int sec,
struct scatterlist sg[TVMEMSIZE]; struct scatterlist sg[TVMEMSIZE];
struct crypto_hash *tfm; struct crypto_hash *tfm;
struct hash_desc desc; struct hash_desc desc;
char output[1024]; static char output[1024];
int i; int i;
int ret; int ret;
printk("\ntesting speed of %s\n", algo); printk(KERN_INFO "\ntesting speed of %s\n", algo);
tfm = crypto_alloc_hash(algo, 0, CRYPTO_ALG_ASYNC); tfm = crypto_alloc_hash(algo, 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(tfm)) { if (IS_ERR(tfm)) {
printk("failed to load transform for %s: %ld\n", algo, printk(KERN_ERR "failed to load transform for %s: %ld\n", algo,
PTR_ERR(tfm)); PTR_ERR(tfm));
return; return;
} }
...@@ -414,7 +414,7 @@ static void test_hash_speed(const char *algo, unsigned int sec, ...@@ -414,7 +414,7 @@ static void test_hash_speed(const char *algo, unsigned int sec,
desc.flags = 0; desc.flags = 0;
if (crypto_hash_digestsize(tfm) > sizeof(output)) { if (crypto_hash_digestsize(tfm) > sizeof(output)) {
printk("digestsize(%u) > outputbuffer(%zu)\n", printk(KERN_ERR "digestsize(%u) > outputbuffer(%zu)\n",
crypto_hash_digestsize(tfm), sizeof(output)); crypto_hash_digestsize(tfm), sizeof(output));
goto out; goto out;
} }
...@@ -427,12 +427,14 @@ static void test_hash_speed(const char *algo, unsigned int sec, ...@@ -427,12 +427,14 @@ static void test_hash_speed(const char *algo, unsigned int sec,
for (i = 0; speed[i].blen != 0; i++) { for (i = 0; speed[i].blen != 0; i++) {
if (speed[i].blen > TVMEMSIZE * PAGE_SIZE) { if (speed[i].blen > TVMEMSIZE * PAGE_SIZE) {
printk("template (%u) too big for tvmem (%lu)\n", printk(KERN_ERR
"template (%u) too big for tvmem (%lu)\n",
speed[i].blen, TVMEMSIZE * PAGE_SIZE); speed[i].blen, TVMEMSIZE * PAGE_SIZE);
goto out; goto out;
} }
printk("test%3u (%5u byte blocks,%5u bytes per update,%4u updates): ", printk(KERN_INFO "test%3u "
"(%5u byte blocks,%5u bytes per update,%4u updates): ",
i, speed[i].blen, speed[i].plen, speed[i].blen / speed[i].plen); i, speed[i].blen, speed[i].plen, speed[i].blen / speed[i].plen);
if (sec) if (sec)
...@@ -443,7 +445,7 @@ static void test_hash_speed(const char *algo, unsigned int sec, ...@@ -443,7 +445,7 @@ static void test_hash_speed(const char *algo, unsigned int sec,
speed[i].plen, output); speed[i].plen, output);
if (ret) { if (ret) {
printk("hashing failed ret=%d\n", ret); printk(KERN_ERR "hashing failed ret=%d\n", ret);
break; break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment