]>
Commit | Line | Data |
---|---|---|
1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | |
2 | /* | |
3 | * Cryptographic API. | |
4 | * | |
5 | * Copyright (c) 2023 Herbert Xu <[email protected]> | |
6 | */ | |
7 | #ifndef _LOCAL_CRYPTO_HASH_H | |
8 | #define _LOCAL_CRYPTO_HASH_H | |
9 | ||
10 | #include <crypto/internal/hash.h> | |
11 | #include <linux/cryptouser.h> | |
12 | ||
13 | #include "internal.h" | |
14 | ||
15 | static inline int crypto_hash_report_stat(struct sk_buff *skb, | |
16 | struct crypto_alg *alg, | |
17 | const char *type) | |
18 | { | |
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; | |
22 | ||
23 | memset(&rhash, 0, sizeof(rhash)); | |
24 | ||
25 | strscpy(rhash.type, type, sizeof(rhash.type)); | |
26 | ||
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); | |
30 | ||
31 | return nla_put(skb, CRYPTOCFGA_STAT_HASH, sizeof(rhash), &rhash); | |
32 | } | |
33 | ||
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); | |
37 | ||
38 | int hash_prepare_alg(struct hash_alg_common *alg); | |
39 | ||
40 | #endif /* _LOCAL_CRYPTO_HASH_H */ |