[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200213050552.b5fkkravjirsey5y@gondor.apana.org.au>
Date: Thu, 13 Feb 2020 13:05:52 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Corentin Labbe <clabbe.montjoie@...il.com>
Cc: Eric Biggers <ebiggers@...nel.org>, davem@...emloft.net,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [BUG] crypto: export() overran state buffer on test vector
On Wed, Feb 12, 2020 at 07:57:49PM +0100, Corentin Labbe wrote:
>
> I just found the problem, it happen with ARM CE which has a bigger state_size (sha256_ce_state) of 4bytes.
>
> Since my driver didnt use statesize at all, I detect this on cra_init() like this:
> if (algt->alg.hash.halg.statesize < crypto_ahash_statesize(op->fallback_tfm))
> algt->alg.hash.halg.statesize = crypto_ahash_statesize(op->fallback_tfm);
Thanks for finding this.
I think this can be fixed by simply adding export/imort functions
that exported the sha state without the extra finalize field which
is never used for the exported state (it's only used as an internal
function parameter).
We should also add some tests to ensure that shash SHA algorithms
all use the same geometry for export/import.
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