summaryrefslogtreecommitdiff
path: root/crypto/algapi.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2023-02-16 18:35:15 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2023-03-14 17:06:41 +0800
commit174b44b483b40a89b615febeca4f7a8b0836767a (patch)
treed7188d9f59e8ffa46e177aee913adc40dc059c77 /crypto/algapi.c
parent7be5c24605fe9839e0c4e087bf60c8ff78171dc9 (diff)
downloadlinux-crypto-174b44b483b40a89b615febeca4f7a8b0836767a.tar.gz
linux-crypto-174b44b483b40a89b615febeca4f7a8b0836767a.zip
crypto: hash - Count error stats differently
Move all stat code specific to hash into the hash code. While we're at it, change the stats so that bytes and counts are always incremented even in case of error. This allows the reference counting to be removed as we can now increment the counters prior to the operation. After the operation we simply increase the error count if necessary. This is safe as errors can only occur synchronously (or rather, the existing code already ignored asynchronous errors which are only visible to the callback function). Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/algapi.c')
-rw-r--r--crypto/algapi.c24
1 files changed, 0 insertions, 24 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c
index 33dc82ff..deabd2d4 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -1075,30 +1075,6 @@ void crypto_stats_decompress(unsigned int slen, int ret, struct crypto_alg *alg)
}
EXPORT_SYMBOL_GPL(crypto_stats_decompress);
-void crypto_stats_ahash_update(unsigned int nbytes, int ret,
- struct crypto_alg *alg)
-{
- if (ret && ret != -EINPROGRESS && ret != -EBUSY)
- atomic64_inc(&alg->stats.hash.err_cnt);
- else
- atomic64_add(nbytes, &alg->stats.hash.hash_tlen);
- crypto_alg_put(alg);
-}
-EXPORT_SYMBOL_GPL(crypto_stats_ahash_update);
-
-void crypto_stats_ahash_final(unsigned int nbytes, int ret,
- struct crypto_alg *alg)
-{
- if (ret && ret != -EINPROGRESS && ret != -EBUSY) {
- atomic64_inc(&alg->stats.hash.err_cnt);
- } else {
- atomic64_inc(&alg->stats.hash.hash_cnt);
- atomic64_add(nbytes, &alg->stats.hash.hash_tlen);
- }
- crypto_alg_put(alg);
-}
-EXPORT_SYMBOL_GPL(crypto_stats_ahash_final);
-
void crypto_stats_kpp_set_secret(struct crypto_alg *alg, int ret)
{
if (ret)