[PATCH] digest: add digest_algo helper

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Sep 21 03:24:46 PDT 2023


Code handling different digest types may want easy access to the digest
algorithm currently in use. Add a simple inline helper for this.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 include/digest.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/digest.h b/include/digest.h
index b984d57d778e..2816ddffaed2 100644
--- a/include/digest.h
+++ b/include/digest.h
@@ -161,6 +161,11 @@ static inline const char *digest_name(struct digest *d)
 	return d->algo->base.name;
 }
 
+static inline enum hash_algo digest_algo(struct digest *d)
+{
+	return d->algo->base.algo;
+}
+
 static inline void* digest_ctx(struct digest *d)
 {
 	return d->ctx;
-- 
2.39.2




More information about the barebox mailing list