All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephan Mueller <smueller@chronox.de>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Rafael Aquini <aquini@redhat.com>,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: Re: DRBG parallel requests
Date: Thu, 16 Apr 2015 17:36:09 +0200	[thread overview]
Message-ID: <2516428.A8Iv54MNdy@tauon> (raw)
In-Reply-To: <20150416153038.GB17690@gondor.apana.org.au>

Am Donnerstag, 16. April 2015, 23:30:38 schrieb Herbert Xu:

Hi Herbert,

>On Thu, Apr 16, 2015 at 05:13:50PM +0200, Stephan Mueller wrote:
>> Surely, the shadow approach scales better than a global lock. But its
>> drawback is the (almost) identical state.
>
>The drawback is that your DRBG is no longer anything like that
>specified by the standard.  You've completely changed the
>cryptography by reusing the internal state.

Well, I used the same line of thought as found in other implementations of the 
DRBG (I do not want to name names though :-) ). As I thought another call to 
get_random_bytes is too expensive, the high-res timer came to mind.

But during my discussions with Rafael, I already did not like that solution.
>
>> Rafael: do you have any better idea here other than remove the shadow copy
>> approach and use a global lock?
>
>I don't think you can get around the global lock due to the sequential
>nature of the DRBG that is built into its design.
>
>> >The only users of RNG in the crypto API do so in process context
>> >so we can make it a rule that all users RNG must be in process
>> >context.
>> 
>> Herbert, which type of lock am I allowed to use? Is a spin lock sufficient
>> or shall I use a mutex. I am not fully sure whether the used shash or
>> cipher type can sleep.
>
>As I said we can make it a rule that any user of our RNG must be in
>process context (all existing users are) so you can use a mutex.
>
>Also, if we change the entropy source to a blocking one as discussed
>in the other thread then you'd definitely want to have a mutex intead
>of a spin lock.

Ok, a mutex will appear shortly.
>
>Cheers,


Ciao
Stephan

      reply	other threads:[~2015-04-16 15:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-16 14:44 DRBG parallel requests Herbert Xu
2015-04-16 15:13 ` Stephan Mueller
2015-04-16 15:30   ` Herbert Xu
2015-04-16 15:36     ` Stephan Mueller [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=2516428.A8Iv54MNdy@tauon \
    --to=smueller@chronox.de \
    --cc=aquini@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@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.