aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2008-11-06 01:39:16 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2008-12-24 19:01:32 -0500
commit67cd080c5070b4f17520c1385f7684206f4987b3 (patch)
tree5bf9df62223651922ff8ff646bfe9a275425bc27
parentdec8b78606ebd5f309c38f2fb10196ce996dd18d (diff)
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 37a13d05636d..5dc07e442fca 100644
--- a/crypto/proc.c
+++ b/crypto/proc.c
@@ -94,6 +94,17 @@ static int c_show(struct seq_file *m, void *p)
94 seq_printf(m, "selftest : %s\n", 94 seq_printf(m, "selftest : %s\n",
95 (alg->cra_flags & CRYPTO_ALG_TESTED) ? 95 (alg->cra_flags & CRYPTO_ALG_TESTED) ?
96 "passed" : "unknown"); 96 "passed" : "unknown");
97
98 if (alg->cra_flags & CRYPTO_ALG_LARVAL) {
99 seq_printf(m, "type : larval\n");
100 seq_printf(m, "flags : 0x%x\n", alg->cra_flags);
101 goto out;
102 }
103
104 if (alg->cra_type && alg->cra_type->show) {
105 alg->cra_type->show(m, alg);
106 goto out;
107 }
97 108
98 switch (alg->cra_flags & (CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_LARVAL)) { 109 switch (alg->cra_flags & (CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_LARVAL)) {
99 case CRYPTO_ALG_TYPE_CIPHER: 110 case CRYPTO_ALG_TYPE_CIPHER:
@@ -115,16 +126,11 @@ static int c_show(struct seq_file *m, void *p)
115 seq_printf(m, "type : compression\n"); 126 seq_printf(m, "type : compression\n");
116 break; 127 break;
117 default: 128 default:
118 if (alg->cra_flags & CRYPTO_ALG_LARVAL) { 129 seq_printf(m, "type : unknown\n");
119 seq_printf(m, "type : larval\n");
120 seq_printf(m, "flags : 0x%x\n", alg->cra_flags);
121 } else if (alg->cra_type && alg->cra_type->show)
122 alg->cra_type->show(m, alg);
123 else
124 seq_printf(m, "type : unknown\n");
125 break; 130 break;
126 } 131 }
127 132
133out:
128 seq_putc(m, '\n'); 134 seq_putc(m, '\n');
129 return 0; 135 return 0;
130} 136}