linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pascal Van Leeuwen <pvanleeuwen@verimatrix.com>
To: Corentin Labbe <clabbe.montjoie@gmail.com>
Cc: "herbert@gondor.apana.org.au" <herbert@gondor.apana.org.au>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: Need help with failling gcm_base(ctr,ghash-generic) selftest
Date: Fri, 2 Aug 2019 08:55:16 +0000	[thread overview]
Message-ID: <MN2PR20MB2973F923FECCE73A0F74DBA1CAD90@MN2PR20MB2973.namprd20.prod.outlook.com> (raw)
In-Reply-To: <20190802051830.GA13677@Red>


> -----Original Message-----
> From: Corentin Labbe <clabbe.montjoie@gmail.com>
> Sent: Friday, August 2, 2019 7:19 AM
> To: Pascal Van Leeuwen <pvanleeuwen@verimatrix.com>
> Cc: herbert@gondor.apana.org.au; linux-crypto@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: Re: Need help with failling gcm_base(ctr,ghash-generic) selftest
> 
> On Fri, Aug 02, 2019 at 12:24:04AM +0000, Pascal Van Leeuwen wrote:
> > > -----Original Message-----
> > > From: linux-crypto-owner@vger.kernel.org <linux-crypto-owner@vger.kernel.org> On
> Behalf Of
> > > Corentin Labbe
> > > Sent: Thursday, August 1, 2019 9:43 PM
> > > To: herbert@gondor.apana.org.au; linux-crypto@vger.kernel.org
> > > Cc: linux-kernel@vger.kernel.org
> > > Subject: Need help with failling gcm_base(ctr,ghash-generic) selftest
> > >
> > > Hello
> > >
> > > I am writing the Allwinner sun8i-ce driver and when running tcrypt I got
> > > [   30.201739] alg: aead: gcm_base(ctr-aes-sun8i-ce,ghash-generic) decryption failed
> on test
> > > vector 3; expected_error=0, actual_error=-74, cfg=\"random: may_sleep use_digest
> > > src_divs=[100.0%@+2614] dst_divs=[5.90%@alignmask+3015, 60.56%@+3996, 17.92%@+865,
> > > 15.62%@+10]\"
> > > or
> > >
> > The decryption reports only an -EBADMSG here, which means the decryption itself went
> > fine, but the authentication tag mismatched.
> >
> >
> > > [  148.613537] alg: aead: gcm_base(ctr-aes-sun8i-ce,ghash-generic) encryption test
> failed
> > > (wrong result) on test vector 2, cfg=\"random: may_sleep use_final
> src_divs=[100.0%@+0]
> > > iv_offset=20\"
> > >
> > Can't say for sure, but considering the decrypt error, this is most likely just a
> > mismatch on the appended authentication tag.
> >
> > > Since ctr-aes-sun8i-ce is passing the ctr(aes) selftest, I dont understand what could
> be
> > > wrong.
> > >
> > That is possible, as this appears to be a problem with the authentication part,
> > not the encryption part. So possibly a problem with the way you setup the
> > authentication key (which is actually derived from the encryption key, but I don't
> > know if your hardware does this autonomously, mine doesn't) and/or operation?
> >
> 
> But since my driver is just a skcipher, I dont understand why I should care about any aead
> part, right ?
>
Ah, my bad ... your aes-ctr skcipher is being wrapped by the generic gcm_base
template here, I missed that detail ... wish I could help you further, but
I can't think of anything obvious that could cause this (decrypt fails on auth
as I remarked earlier but only with a specific scatter buffer layout??).

Regards,
Pascal van Leeuwen
Silicon IP Architect, Multi-Protocol Engines @ Verimatrix
www.insidesecure.com

      reply	other threads:[~2019-08-02  8:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-01 19:42 Need help with failling gcm_base(ctr,ghash-generic) selftest Corentin Labbe
2019-08-02  0:24 ` Pascal Van Leeuwen
2019-08-02  5:18   ` Corentin Labbe
2019-08-02  8:55     ` Pascal Van Leeuwen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MN2PR20MB2973F923FECCE73A0F74DBA1CAD90@MN2PR20MB2973.namprd20.prod.outlook.com \
    --to=pvanleeuwen@verimatrix.com \
    --cc=clabbe.montjoie@gmail.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).