[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210102212501.GA1931@gondor.apana.org.au>
Date: Sun, 3 Jan 2021 08:25:01 +1100
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Thara Gopinath <thara.gopinath@...aro.org>
Cc: davem@...emloft.net, bjorn.andersson@...aro.org,
ebiggers@...gle.com, ardb@...nel.org, sivaprak@...eaurora.org,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/6] drivers: crypto: qce: sha: Restore/save
sha1_state/sha256_state with qce_sha_reqctx in export/import
On Fri, Dec 18, 2020 at 10:30:22PM -0500, Thara Gopinath wrote:
> Export and import interfaces save and restore partial transformation
> states. The partial states were being stored and restored in struct
> sha1_state for sha1/hmac(sha1) transformations and sha256_state for
> sha256/hmac(sha256) transformations.This led to a bunch of corner cases
> where improper state was being stored and restored. A few of the corner
> cases that turned up during testing are:
>
> - wrong byte_count restored if export/import is called twice without h/w
> transaction in between
> - wrong buflen restored back if the pending buffer
> length is exactly the block size.
> - wrong state restored if buffer length is 0.
>
> To fix these issues, save and restore the entire qce_sha_rctx structure
> instead of parts of it in sha1_state and sha256_state structures.
> This in turn simplifies the export and import apis.
>
> Signed-off-by: Thara Gopinath <thara.gopinath@...aro.org>
> ---
> drivers/crypto/qce/sha.c | 93 ++++------------------------------------
> 1 file changed, 8 insertions(+), 85 deletions(-)
How is this safe when the reqctx structure contains pointers?
Cheers,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists