All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephan Mueller <smueller@chronox.de>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
	aquini@redhat.com, jeremy.wayne.powell@gmail.com
Subject: Re: [PATCH v2 1/6] SP800-90A Deterministic Random Bit Generator
Date: Thu, 20 Mar 2014 14:30:33 +0100	[thread overview]
Message-ID: <13817639.cfCaQvh16D@myon.chronox.de> (raw)
In-Reply-To: <532AA307.504@ladisch.de>

Am Donnerstag, 20. März 2014, 09:12:55 schrieb Clemens Ladisch:

Hi Clemens,

> Stephan Mueller wrote:
> > This is a clean-room implementation of the DRBG defined in SP800-90A.
> 
> Why?  I guess it's for certification?

As per SP800-131A, the ANSI X9.31 DRNG is sunset by the end of 2014 and not 
allowed to be used in FIPS 140-2 compliant environments. The kernel crypto API 
implements an ANSI X9.31 DRNG in crypto/ansi_cprng.c as the only DRNG that 
complies with FIPS 140-2 at this time.

Without a replacement for this ANSI X9.31 DRNG, the kernel will not have an 
FIPS 140-2 approved DRNG any more starting from 2015.
> 
> > +static bool drbg_fips_continuous_test(struct drbg_state *drbg,
> > +				     unsigned char *buf)
> > ...
> > +	ret = memcmp(drbg->prev, buf, drbg_blocklen(drbg));
> > +	...
> > +	/* invert the memcmp result, because the test shall pass when the
> > +	 * two compared values do not match */
> > +	if (ret)
> > +		return true;
> > +	else
> > +		return false;
> 
> This looks strange.  The return value of memcmp() is not really
> a boolean, and the code appears not to match the comment because the
> numeric value of ret is not actually inverted.  How about this:

Correct, the comment does not match the code as I had invered the logic of 
drbg_fips_continuous_test as per Rafael's comment. Yet, I did not update the 
comment.
> 
> 	ret = memcmp(...);
> 	...
> 	/* the test shall pass when the compared values are not equal */
> 	return ret != 0;

I will add that change.
> 
> 
> Regards,
> Clemens


Thanks
Stephan
-- 
| Cui bono? |

  reply	other threads:[~2014-03-20 13:30 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-08 23:43 [PATCH 0/6] SP800-90A Deterministic Random Bit Generator Stephan Mueller
2014-03-08 23:46 ` [PATCH 1/6] " Stephan Mueller
2014-03-08 23:46   ` [PATCH 2/6] header file for DRBG Stephan Mueller
2014-03-08 23:47     ` [PATCH 3/6] DRBG kernel configuration options Stephan Mueller
2014-03-08 23:48       ` [PATCH 4/6] compile the DRBG code Stephan Mueller
2014-03-08 23:49         ` [PATCH 5/6] DRBG testmgr test vectors Stephan Mueller
2014-03-08 23:50           ` [PATCH 6/6] Add DRBG test code to testmgr Stephan Mueller
2014-03-10 13:56     ` [PATCH 2/6] header file for DRBG Rafael Aquini
2014-03-10 13:36   ` [PATCH 1/6] SP800-90A Deterministic Random Bit Generator Rafael Aquini
2014-03-17  7:34   ` [PATCH v2 " Stephan Mueller
2014-03-17  7:35     ` [PATCH v2 2/6] header file for DRBG Stephan Mueller
2014-03-17  7:35       ` [PATCH v2 3/6] DRBG kernel configuration options Stephan Mueller
2014-03-17  7:37         ` [PATCH v2 4/6] compile the DRBG code Stephan Mueller
2014-03-17  7:38           ` [PATCH v2 5/6] DRBG testmgr test vectors Stephan Mueller
2014-03-17  7:39             ` [PATCH v2 6/6] Add DRBG test code to testmgr Stephan Mueller
2014-04-11 18:07       ` [PATCH v4 2/6] header file for DRBG Stephan Mueller
2014-03-19  7:51     ` [PATCH v2 1/6] SP800-90A Deterministic Random Bit Generator Stephan Mueller
2014-03-20  8:12     ` Clemens Ladisch
2014-03-20 13:30       ` Stephan Mueller [this message]
2014-03-27 19:53     ` [PATCH v3 " Stephan Mueller
2014-03-27 19:56     ` Stephan Mueller
2014-04-11 18:07       ` [PATCH v4 " Stephan Mueller
2014-04-11 18:20         ` Joe Perches
2014-04-11 19:24           ` Stephan Mueller
2014-04-15  5:35         ` [PATCH v5 " Stephan Mueller
2014-04-15  5:51           ` Joe Perches
2014-04-15  6:08             ` Stephan Mueller
2014-04-26 20:13           ` [PATCH v6 " Stephan Mueller
2014-05-20 21:32             ` Rafael Aquini

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=13817639.cfCaQvh16D@myon.chronox.de \
    --to=smueller@chronox.de \
    --cc=aquini@redhat.com \
    --cc=clemens@ladisch.de \
    --cc=jeremy.wayne.powell@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.