lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200221195549.GA29499@Red>
Date:   Fri, 21 Feb 2020 20:55:49 +0100
From:   LABBE Corentin <clabbe@...libre.com>
To:     Eric Biggers <ebiggers@...nel.org>
Cc:     catalin.marinas@....com, davem@...emloft.net,
        herbert@...dor.apana.org.au, will@...nel.org,
        linux-arm-kernel@...ts.infradead.org, linux-crypto@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-sunxi@...glegroups.com
Subject: Re: [PATCH] crypto: arm64: CE: implement export/import

On Wed, Feb 19, 2020 at 10:16:54AM -0800, Eric Biggers wrote:
> On Wed, Feb 19, 2020 at 04:00:37PM +0000, Corentin Labbe wrote:
> > When an ahash algorithm fallback to another ahash and that fallback is
> > shaXXX-CE, doing export/import lead to error like this:
> > alg: ahash: sha1-sun8i-ce export() overran state buffer on test vector 0, cfg=\"import/export\"
> > 
> > This is due to the descsize of shaxxx-ce larger than struct shaxxx_state off by an u32.
> > For fixing this, let's implement export/import which rip the finalize
> > variant instead of using generic export/import.
> > 
> > Signed-off-by: Corentin Labbe <clabbe@...libre.com>
> > ---
> >  arch/arm64/crypto/sha1-ce-glue.c | 20 ++++++++++++++++++++
> >  arch/arm64/crypto/sha2-ce-glue.c | 23 +++++++++++++++++++++++
> >  2 files changed, 43 insertions(+)
> > 
> > diff --git a/arch/arm64/crypto/sha1-ce-glue.c b/arch/arm64/crypto/sha1-ce-glue.c
> > index 63c875d3314b..dc44d48415cd 100644
> > --- a/arch/arm64/crypto/sha1-ce-glue.c
> > +++ b/arch/arm64/crypto/sha1-ce-glue.c
> > @@ -91,12 +91,32 @@ static int sha1_ce_final(struct shash_desc *desc, u8 *out)
> >  	return sha1_base_finish(desc, out);
> >  }
> >  
> > +static int sha1_ce_export(struct shash_desc *desc, void *out)
> > +{
> > +	struct sha1_ce_state *sctx = shash_desc_ctx(desc);
> > +
> > +	memcpy(out, sctx, sizeof(struct sha1_state));
> > +	return 0;
> > +}
> > +
> > +static int sha1_ce_import(struct shash_desc *desc, const void *in)
> > +{
> > +	struct sha1_ce_state *sctx = shash_desc_ctx(desc);
> > +
> > +	memcpy(sctx, in, sizeof(struct sha1_state));
> > +	sctx->finalize = 0;
> > +	return 0;
> > +}
> 
> Can you use '&sctx->sst' instead of 'sctx' so that we aren't relying on the
> 'struct sha1_state' being located at the beginning of the struct?
> 
> Likewise for SHA-2.

Yes, I will do that, it is better.
thanks

Regards

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ