1 /* SPDX-License-Identifier: GPL-2.0-or-later */
5 * Copyright (c) 2023 Herbert Xu <herbert@gondor.apana.org.au>
7 #ifndef _LOCAL_CRYPTO_HASH_H
8 #define _LOCAL_CRYPTO_HASH_H
10 #include <crypto/internal/hash.h>
11 #include <linux/cryptouser.h>
15 static inline int crypto_hash_report_stat(struct sk_buff *skb,
16 struct crypto_alg *alg,
19 struct hash_alg_common *halg = __crypto_hash_alg_common(alg);
20 struct crypto_istat_hash *istat = hash_get_stat(halg);
21 struct crypto_stat_hash rhash;
23 memset(&rhash, 0, sizeof(rhash));
25 strscpy(rhash.type, type, sizeof(rhash.type));
27 rhash.stat_hash_cnt = atomic64_read(&istat->hash_cnt);
28 rhash.stat_hash_tlen = atomic64_read(&istat->hash_tlen);
29 rhash.stat_err_cnt = atomic64_read(&istat->err_cnt);
31 return nla_put(skb, CRYPTOCFGA_STAT_HASH, sizeof(rhash), &rhash);
34 int crypto_init_shash_ops_async(struct crypto_tfm *tfm);
35 struct crypto_ahash *crypto_clone_shash_ops_async(struct crypto_ahash *nhash,
36 struct crypto_ahash *hash);
38 int hash_prepare_alg(struct hash_alg_common *alg);
40 #endif /* _LOCAL_CRYPTO_HASH_H */