From: Stephan Mueller <smueller@chronox.de>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
linux-next@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] DRBG: remove check for uninitialized DRBG handle
Date: Fri, 05 Sep 2014 13:25:29 +0200 [thread overview]
Message-ID: <8982542.15qJOCEf3S@tauon> (raw)
In-Reply-To: <20140905075549.GA13225@gondor.apana.org.au>
Am Freitag, 5. September 2014, 15:55:49 schrieb Herbert Xu:
Hi Herbert,
>On Thu, Sep 04, 2014 at 01:50:32AM +0200, Stephan Mueller wrote:
>> Am Donnerstag, 4. September 2014, 07:21:29 schrieb Herbert Xu:
>>
>> Hi Herbert,
>>
>> > On Wed, Sep 03, 2014 at 03:33:16AM +0200, Stephan Mueller wrote:
>> > > Am Montag, 1. September 2014, 07:11:20 schrieb Stephan Mueller:
>> > >
>> > > Hi Herbert,
>> > >
>> > > may I ask for consideration of this patch as this covers an oops
>> > > FIPS
>> > > mode?
>> > >
>> > > In addition, may I ask for guidance on how to fix the 32 bit code
>> > > path in Linus' tree as asked on 28.8? To quote: "Thus, the fix
>> > > in
>> > > b9347aff91ce4789619168539f08202d8d6a1177 works. However, this
>> > > patch is based on 05c81ccd9087d238c10b234eadb55632742e5518. So,
>> > > if we want to fix Linus' tree with minimal impact, either these
>> > > two patches are pushed to Linus or I have to port
>> > > b9347aff91ce4789619168539f08202d8d6a1177 to the current Linus
>> > > tree."
>> >
>> > I will take care of this.
>>
>> Thank you.
>
>Here is the patch I will add for 3.17:
>
>commit fb38ab4cd05e11184fd2c3ef916fa106ecc505fc
>Author: Herbert Xu <herbert@gondor.apana.org.au>
>Date: Fri Sep 5 15:52:28 2014 +0800
>
> crypto: drbg - backport "fix maximum value checks on 32 bit
>systems"
>
> This is a backport of commit
>b9347aff91ce4789619168539f08202d8d6a1177. This backport is needed as
>without it the code will crash on 32-bit systems.
The kernel / module will not crash, It will simply refuse to work by
always returning an error. I have tested the 3.17-rc1 code on 32 bit
which returned always the error unless I apply this patch.
>
> The maximum values for additional input string or generated blocks
>is larger than 1<<32. To ensure a sensible value on 32 bit systems,
>return SIZE_MAX on 32 bit systems. This value is lower than the
>maximum allowed values defined in SP800-90A. The standard allow lower
>maximum values, but not larger values.
>
> SIZE_MAX - 1 is used for drbg_max_addtl to allow
> drbg_healthcheck_sanity to check the enforcement of the variable
> without wrapping.
>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
>
>diff --git a/include/crypto/drbg.h b/include/crypto/drbg.h
>index 831d786..882675e 100644
>--- a/include/crypto/drbg.h
>+++ b/include/crypto/drbg.h
>@@ -162,12 +162,25 @@ static inline size_t
>drbg_max_request_bytes(struct drbg_state *drbg)
>
> static inline size_t drbg_max_addtl(struct drbg_state *drbg)
> {
>+#if (__BITS_PER_LONG == 32)
>+ /*
>+ * SP800-90A allows smaller maximum numbers to be returned -- we
>+ * return SIZE_MAX - 1 to allow the verification of the
enforcement
>+ * of this value in drbg_healthcheck_sanity.
>+ */
>+ return (SIZE_MAX - 1);
>+#else
> return (1UL<<(drbg->core->max_addtllen));
>+#endif
> }
>
> static inline size_t drbg_max_requests(struct drbg_state *drbg)
> {
>+#if (__BITS_PER_LONG == 32)
>+ return SIZE_MAX;
>+#else
> return (1UL<<(drbg->core->max_req));
>+#endif
> }
>
> /*
>
>Cheers,
Thank you very much!
Acked-by: Stephan Mueller <smueller@chronox.de>
Ciao
Stephan
next prev parent reply other threads:[~2014-09-05 11:25 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-26 6:14 linux-next: build warnings after merge of the crypto tree Stephen Rothwell
2014-08-26 6:38 ` Herbert Xu
2014-08-26 7:00 ` Stephan Mueller
2014-08-26 7:31 ` [PATCH] DRBG: fix bit shifting on 32 bit systems Stephan Mueller
2014-08-26 7:32 ` Herbert Xu
2014-08-26 7:37 ` Stephan Mueller
2014-08-26 8:06 ` [PATCH] DRBG: fix maximum value checks " Stephan Mueller
2014-08-26 8:08 ` Herbert Xu
2014-08-26 8:29 ` [PATCH v2] " Stephan Mueller
2014-08-26 8:43 ` Herbert Xu
2014-08-26 8:52 ` Stephan Mueller
2014-08-26 8:58 ` Herbert Xu
2014-08-26 9:36 ` Stephan Mueller
2014-08-27 13:35 ` Herbert Xu
2014-08-27 13:40 ` Stephan Mueller
2014-08-28 7:13 ` Stephan Mueller
2014-08-28 7:17 ` DRBG: remove test for uninitialized DRBG handle Stephan Mueller
2014-09-01 5:11 ` [PATCH v2] DRBG: remove check " Stephan Mueller
2014-09-03 1:33 ` Stephan Mueller
2014-09-03 23:21 ` Herbert Xu
2014-09-03 23:50 ` Stephan Mueller
2014-09-05 7:55 ` Herbert Xu
2014-09-05 11:25 ` Stephan Mueller [this message]
2014-09-05 8:13 ` Herbert Xu
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=8982542.15qJOCEf3S@tauon \
--to=smueller@chronox.de \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
/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).