Re: [BUG] crypto: export() overran state buffer on test vector

From: Corentin Labbe
Date: Tue Feb 11 2020 - 14:21:24 EST


On Sat, Feb 08, 2020 at 04:57:13PM +0800, Herbert Xu wrote:
> On Fri, Feb 07, 2020 at 11:46:59AM +0100, Corentin Labbe wrote:
> >
> > My goal is to do like n2-crypto/rk3288crypto/etc..., fallback for init/update/final/finup and only do stuff with digest().
> > So I have just exactly copied what they do.
>
> n2 at least is totally broken wrt import/export. The other ones
> would work provided that the fallback have the same statesize as
> the generic sha implementations.
>

This behavour happen only on arm64, so it is why probably nobody (rockchip/n2) found it.

> Are you not using the standard state sizes?

I use the standard size (statesize = sizeof(struct shaxxx_state))

As a quick workaround, By simply adding (+ 8), all test pass.

>
> This should probably be switched over to lib/crypto or at least
> shash.
>

Do you mean that I should abandon ahash as a fallback ?