public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jarod Wilson <jarod@redhat.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: [PATCH] crypto: don't raise alarm for no ctr(aes*) tests in fips mode
Date: Wed, 29 Apr 2009 08:46:47 -0400	[thread overview]
Message-ID: <200904290846.48267.jarod@redhat.com> (raw)
In-Reply-To: <20090429105035.GC7227@hmsreliant.think-freely.org>

On Wednesday 29 April 2009 06:50:35 Neil Horman wrote:
> On Tue, Apr 28, 2009 at 09:18:22PM -0400, Jarod Wilson wrote:
> > Per the NIST AESAVS document, Appendix A[1], it isn't possible to
> > have automated self-tests for counter-mode AES, but people are
> > misled to believe something is wrong by the message that says there
> > is no test for ctr(aes). Simply suppress all 'no test for ctr(aes*'
> > messages if fips_enabled is set to avoid confusion.
> > 
> > Dependent on earlier patch 'crypto: catch base cipher self-test
> > failures in fips mode', which adds the test_done label.
> > 
> > [1] http://csrc.nist.gov/groups/STM/cavp/documents/aes/AESAVS.pdf
> > 
> > Signed-off-by: Jarod Wilson <jarod@redhat.com>
> > 
> > ---
> >  crypto/testmgr.c |   11 +++++++++++
> >  1 files changed, 11 insertions(+), 0 deletions(-)
> > 
> > diff --git a/crypto/testmgr.c b/crypto/testmgr.c
> > index 5a50416..39ffa69 100644
> > --- a/crypto/testmgr.c
> > +++ b/crypto/testmgr.c
> > @@ -2134,6 +2134,17 @@ int alg_test(const char *driver, const char *alg, u32 type, u32 mask)
> >  				      type, mask);
> >  	goto test_done;
> >  notest:
> > +	/*
> > +	 * Per NIST AESAVS[1], it isn't possible to have automated self-tests
> > +	 * for counter mode aes vectors, they have to be covered by ecb mode
> > +	 * and code inspection. The ecb mode tests are trigger above in the
> > +	 * CRYPTO_ALG_TYPE_CIPHER section. Suppress warnings about missing
> > +	 * ctr tests if we're in fips mode to avoid confusion.
> > +	 *
> > +	 * [1] http://csrc.nist.gov/groups/STM/cavp/documents/aes/AESAVS.pdf
> > +	 */
> > +	if (fips_enabled && !strncmp(alg, "ctr(aes", 7))
> > +		goto test_done;
> >  	printk(KERN_INFO "alg: No test for %s (%s)\n", alg, driver);
> >  test_done:
> >  	if (fips_enabled && rc)
> > 
> From the way I read the document, anything operating in a counter mode will have
> an unpredictable output (given the counter operation isn't specified).  While
> the above works, I'm not sure that it fully covers the various ccm modes
> available (ccm_base and rfc4309).

I believe Appendix A only applies for straight up counter-mode aes,
ccm_base and rfc4309 actually have well-defined counter operations.
We've already got self-tests for ccm(aes) and a pending patch for
rfc4309(ccm(aes), and since they don't start w/'ctr(aes', they
wouldn't be caught by that (admittedly hacky) check even if we
didn't have test vectors for them.

> Perhaps instead it would be better to add a
> TFM mask flag indicating that the selected transform included a unpredictable
> component or counter input (marking the alg as being unsuitable for automatic
> testing without knoweldge of the inner workings of that counter.  Then you could
> just test for that flag?

Yeah, I thought about a flag too, but it seemed potentially a lot of
overhead for what might well be restricted to ctr(aes*). It might've
been relevant for ctr(des3_ede) or ctr(des), but they're not on the
fips approved algo/mode list, so I took the easy way out. I'm game to
go the flag route if need be though.

-- 
Jarod Wilson
jarod@redhat.com

  reply	other threads:[~2009-04-29 12:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-29  1:18 [PATCH] crypto: don't raise alarm for no ctr(aes*) tests in fips mode Jarod Wilson
2009-04-29 10:50 ` Neil Horman
2009-04-29 12:46   ` Jarod Wilson [this message]
2009-04-30 21:13     ` [PATCH v2] crypto: don't raise alarm for no ctr(aes) tests Jarod Wilson
2009-05-01 11:54       ` Neil Horman
2009-05-04 11:10 ` [PATCH] crypto: don't raise alarm for no ctr(aes*) tests in fips mode Herbert Xu
2009-05-04 18:56   ` Jarod Wilson
2009-05-05  1:08     ` Herbert Xu
2009-05-05  3:45       ` Jarod Wilson
2009-05-05  5:29         ` Herbert Xu
2009-05-05 13:04           ` Jarod Wilson
2009-05-04 20:24   ` [PATCH] crypto: add ctr(aes) test vectors Jarod Wilson
2009-05-05 13:18     ` Herbert Xu
2009-05-05 13:55       ` Jarod Wilson
2009-05-05 14:42         ` [PATCH v2] " Jarod Wilson
2009-05-06  9:30           ` Herbert Xu
2009-05-06 12:51             ` Jarod Wilson

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=200904290846.48267.jarod@redhat.com \
    --to=jarod@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    /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