From ed0733eaa579c49dbfeaec14d4071a69a49fdde4 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Thu, 16 Feb 2023 18:35:09 +0800 Subject: crypto: algapi - Move stat reporting into algapi The stats code resurrected the unions from the early days of kernel crypto. This patch starts the process of moving them out to the individual type structures as we do for everything else. In particular, add a report_stat function to cra_type and call that from the stats code if available. This allows us to move the actual code over one-by-one. Signed-off-by: Herbert Xu --- crypto/crypto_user_stat.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'crypto/crypto_user_stat.c') diff --git a/crypto/crypto_user_stat.c b/crypto/crypto_user_stat.c index 154884bf9275..2369814029fa 100644 --- a/crypto/crypto_user_stat.c +++ b/crypto/crypto_user_stat.c @@ -204,6 +204,12 @@ static int crypto_reportstat_one(struct crypto_alg *alg, goto out; } + if (alg->cra_type && alg->cra_type->report_stat) { + if (alg->cra_type->report_stat(skb, alg)) + goto nla_put_failure; + goto out; + } + switch (alg->cra_flags & (CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_LARVAL)) { case CRYPTO_ALG_TYPE_AEAD: if (crypto_report_aead(skb, alg)) -- cgit v1.2.3