[PATCH] digest: add digest_algo helper

Sascha Hauer sha at pengutronix.de
Thu Sep 21 06:09:48 PDT 2023


On Thu, Sep 21, 2023 at 12:24:46PM +0200, Ahmad Fatoum wrote:
> 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(+)

Applied, thanks

Sascha

> 
> 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
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list