DM-Crypt Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Milan Broz <mbroz@redhat.com>
To: Roscoe <eocsor@gmail.com>
Cc: dm-crypt@saout.de
Subject: Re: [dm-crypt] Entropy available for luksFormat during GNU/Linux installs
Date: Wed, 03 Feb 2010 09:56:05 +0100	[thread overview]
Message-ID: <4B693A25.7040605@redhat.com> (raw)
In-Reply-To: <cf657bae1002021645m1b2e656j8f16eb20dc6489ee@mail.gmail.com>

On 02/03/2010 01:45 AM, Roscoe wrote:
> On Mon, Jan 25, 2010 at 10:25 PM, Milan Broz <mbroz@redhat.com> wrote:

>> Any known problem why not to use gcrypt RNG?
>> (It should internally wrap possible waiting for enugh entropy,
>> FIPS mode etc. No need to duplicate code in cryptsetup.)
> 
> What does using the gcrypt RNG get us? As it's a PRNG that's using
> /dev/[u]random (in our case) as a source of entropy. I presume it's
> security hinges on the source.

Yes. But cryptsetup is already based on gcrypt crypto functions.
For RNG:
http://www.gnupg.org/documentation/manuals/gcrypt/Random_002dNumber-Subsystem-Architecture.html

> Thus we're introducing another layer and consequently more complexity
> and more room for mistakes to be made, but to what benefit?

Actually, I think the opposite:-) gcrypt is widely used in several
crypto projects, I know there were reviews etc.
(Note it is crypto library used and developed for GnuPG).
Any crypto implementation, like RNG handling inside cryptsetup
will never be so closely verified.
(And possible mistake here is catastrophic to security - imagine
it will loop because some signal received instead of waiting
for entropy and read all 0 instead of master key.)

> Regarding the original premise of the thread, a feature that could
> relax those worried about Linux's RNG implementation, is the option to
> have the master key derived from whatever source of random bits that
> cryptsetup uses, XORed with user specified randomness.
> The user specified random bits would be prompting the user to pound
> the keyboard, then it being feed through PBKDF2 to generate a stream
> of sufficient length (we won't hit dkLen).

And exactly this waiting is solved by gcrypt RNG and I do need
to reimplement it in cryptsetup.

Also if the system is in FIPS mode (and there are possible installations
which want this) long term key used for disk encryption must be
generated from RNG (resp. FIPS certified RNG only).
(IOW I want to avoid any post-RNG operation like XOR you mention,
this can bring more problems than it solves IMHO)

Gcrypt is FIPS capable and hides all that self-test machinery needed
for FIPS.

Of course I mean using GCRY_VERY_STRONG_RANDOM which is
intended for long-term key generator.
But for keyslot AF split we need also randomly generated buffer
but now the system can use more relaxed generator.
I cannot simply read /dev/random always and wait for entropy - for these
operations /dev/urandom should be used.
Gcrypt provides nice wrapper for that - gcry_random_bytes* functions.

From my point of view it is more consistent that all crypto related
functions, including secure RNG, are in one library. So cryptsetup
itself handles LUKS operations but no low-level crypto implementations
(hash, ciphers, RNG, etc)
(We have already all that complexity with gcrypt initialisation included.)

In fact, it is not complicated to implement both. But I think that
responsibility for properly initialising RNG can be moved to trusted
crypto library and not try to do it inside the code.
(Maybe quite shifting of responsibility:-)

Milan

  parent reply	other threads:[~2010-02-03  8:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-24  6:17 [dm-crypt] Entropy available for luksFormat during GNU/Linux installs Roscoe
2010-01-24 10:50 ` Milan Broz
2010-01-24 13:11   ` Arno Wagner
2010-01-24 14:02     ` Heinz Diehl
2010-01-24 14:31       ` Rick Moritz
2010-01-24 16:56         ` Heinz Diehl
2010-01-24 23:11           ` Arno Wagner
2010-01-24 23:03       ` Arno Wagner
2010-01-25 11:25         ` Milan Broz
2010-02-03  0:45           ` Roscoe
2010-02-03  6:21             ` Arno Wagner
2010-02-03  7:57               ` Arno Wagner
2010-02-03 12:31                 ` Roscoe
2010-02-03  8:56             ` Milan Broz [this message]
     [not found]               ` <cf657bae1002030430l3b0f4768x19e917466b5664bb@mail.gmail.com>
     [not found]                 ` <4B697D55.5020304@redhat.com>
     [not found]                   ` <cf657bae1002031231s6dd17c8bq118e5c5276c31b84@mail.gmail.com>
2010-03-23  8:43                     ` Roscoe
  -- strict thread matches above, loose matches on Subject: below --
2010-01-24 18:12 Si St

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=4B693A25.7040605@redhat.com \
    --to=mbroz@redhat.com \
    --cc=dm-crypt@saout.de \
    --cc=eocsor@gmail.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