summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2008-11-06 14:39:16 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2008-12-25 11:01:32 +1100
commitbacd8cf0d688bec61b6ae44c11c4a37a952cae02 (patch)
tree5362619ad5ddde797e269c7d42453e18cc7587d5
parent60493f7e02d403632a107d02584deef2a1834fd4 (diff)
downloadlinux-crypto-bacd8cf0d688bec61b6ae44c11c4a37a952cae02.tar.gz
linux-crypto-bacd8cf0d688bec61b6ae44c11c4a37a952cae02.zip
crypto: api - Call type show function before legacy for proc
This patch makes /proc/crypto call the type-specific show function if one is present before calling the legacy show functions for cipher/digest/compress. This allows us to reuse the type values for those legacy types. In particular, hash and digest will share one type value while shash is phased in as the default hash type. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--crypto/proc.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/crypto/proc.c b/crypto/proc.c
index 37a13d05..5dc07e44 100644
--- a/crypto/proc.c
+++ b/crypto/proc.c
@@ -94,6 +94,17 @@ static int c_show(struct seq_file *m, void *p)
seq_printf(m, "selftest : %s\n",
(alg->cra_flags & CRYPTO_ALG_TESTED) ?
"passed" : "unknown");
+
+ if (alg->cra_flags & CRYPTO_ALG_LARVAL) {
+ seq_printf(m, "type : larval\n");
+ seq_printf(m, "flags : 0x%x\n", alg->cra_flags);
+ goto out;
+ }
+
+ if (alg->cra_type && alg->cra_type->show) {
+ alg->cra_type->show(m, alg);
+ goto out;
+ }
switch (alg->cra_flags & (CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_LARVAL)) {
case CRYPTO_ALG_TYPE_CIPHER:
@@ -115,16 +126,11 @@ static int c_show(struct seq_file *m, void *p)
seq_printf(m, "type : compression\n");
break;
default:
- if (alg->cra_flags & CRYPTO_ALG_LARVAL) {
- seq_printf(m, "type : larval\n");
- seq_printf(m, "flags : 0x%x\n", alg->cra_flags);
- } else if (alg->cra_type && alg->cra_type->show)
- alg->cra_type->show(m, alg);
- else
- seq_printf(m, "type : unknown\n");
+ seq_printf(m, "type : unknown\n");
break;
}
+out:
seq_putc(m, '\n');
return 0;
}