Skip to content

Commit 67cd080

Browse files
committed
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>
1 parent dec8b78 commit 67cd080

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

‎crypto/proc.c‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,17 @@ static int c_show(struct seq_file *m, void *p)
9494
seq_printf(m, "selftest : %s\n",
9595
(alg->cra_flags & CRYPTO_ALG_TESTED) ?
9696
"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+
}
97108

98109
switch (alg->cra_flags & (CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_LARVAL)) {
99110
case CRYPTO_ALG_TYPE_CIPHER:
@@ -115,16 +126,11 @@ static int c_show(struct seq_file *m, void *p)
115126
seq_printf(m, "type : compression\n");
116127
break;
117128
default:
118-
if (alg->cra_flags & CRYPTO_ALG_LARVAL) {
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");
129+
seq_printf(m, "type : unknown\n");
125130
break;
126131
}
127132

133+
out:
128134
seq_putc(m, '\n');
129135
return 0;
130136
}

0 commit comments

Comments
 (0)