Re: [PATCH] crypto: hash - Add default handlers for digest, export, import

From: Herbert Xu
Date: Thu May 04 2023 - 05:35:53 EST


On Thu, May 04, 2023 at 05:32:55PM +0800, David Yang wrote:
> The document of struct ahash_alg explicitly states that @finup,
> combination of @update and @final, is optional, while said nothing about
> @digest, which is combination of @init and @finup (@update and @final).
>
> This gives a illusion that @digest might be optional. However
> crypto_ahash_init_tfm() strangely does expect a non-NULL @digest,
> otherwise it'll result in NULL pointer dereference.
>
> Add default handlers for digest, export, import according to the behavior
> in the document, and mark them optional.
>
> Signed-off-by: David Yang <mmyangfl@xxxxxxxxx>
> ---
> crypto/ahash.c | 28 +++++++++++++++++++++++++---
> include/crypto/hash.h | 12 ++++++------
> 2 files changed, 31 insertions(+), 9 deletions(-)

Nack. There is a default for finup because finup was added later.
Every driver should implement all of the methods.

Cheers,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt