diff mbox series

[v12,4/6] crypto: api - Add crypto_ahash_tested() helper function

Message ID 20250617134440.48000-5-freude@linux.ibm.com
State New
Headers show
Series New s390 specific protected key hmac | expand

Commit Message

Harald Freudenberger June 17, 2025, 1:44 p.m. UTC
Add a little inline helper function
    crypto_ahash_tested()
to the internal/hash.h header file to retrieve the tested
status (that is the CRYPTO_ALG_TESTED bit in the cra_flags).

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Suggested-by: Herbert Xu <herbert@gondor.apana.org.au>
---
 include/crypto/internal/hash.h | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Holger Dengler June 18, 2025, 9:23 a.m. UTC | #1
On 17/06/2025 15:44, Harald Freudenberger wrote:
> Add a little inline helper function
>     crypto_ahash_tested()
> to the internal/hash.h header file to retrieve the tested
> status (that is the CRYPTO_ALG_TESTED bit in the cra_flags).
> 
> Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
> Suggested-by: Herbert Xu <herbert@gondor.apana.org.au>

Please change the ordering. Suggested-by: first, Signed-off-by: second.

Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
diff mbox series

Patch

diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h
index ef573545c85d..8126254c9255 100644
--- a/include/crypto/internal/hash.h
+++ b/include/crypto/internal/hash.h
@@ -190,6 +190,13 @@  static inline void crypto_ahash_set_reqsize(struct crypto_ahash *tfm,
 	tfm->reqsize = reqsize;
 }
 
+static inline bool crypto_ahash_tested(struct crypto_ahash *tfm)
+{
+	struct crypto_tfm *tfm_base = crypto_ahash_tfm(tfm);
+
+	return tfm_base->__crt_alg->cra_flags & CRYPTO_ALG_TESTED;
+}
+
 static inline void crypto_ahash_set_reqsize_dma(struct crypto_ahash *ahash,
 						unsigned int reqsize)
 {