All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: "Safford, David (GE Global Research, US)" <david.safford@ge.com>,
	Ken Goldman <kgold@linux.ibm.com>,
	Mimi Zohar <zohar@linux.ibm.com>,
	"linux-integrity@vger.kernel.org"
	<linux-integrity@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"open list:ASYMMETRIC KEYS" <keyrings@vger.kernel.org>,
	"open list:CRYPTO API" <linux-crypto@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] KEYS: asym_tpm: Switch to get_random_bytes()
Date: Tue, 29 Oct 2019 10:42:58 +0200	[thread overview]
Message-ID: <20191029084258.GA5649@linux.intel.com> (raw)
In-Reply-To: <20191021113939.GA11649@linux.intel.com>

On Mon, Oct 21, 2019 at 02:39:39PM +0300, Jarkko Sakkinen wrote:
> On Thu, Oct 17, 2019 at 09:04:40PM +0300, Jarkko Sakkinen wrote:
> > On Wed, Oct 16, 2019 at 03:10:29PM -0400, James Bottomley wrote:
> > > On Wed, 2019-10-16 at 19:25 +0300, Jarkko Sakkinen wrote:
> > > > On Wed, Oct 16, 2019 at 08:34:12AM -0400, James Bottomley wrote:
> > > > > reversible ciphers are generally frowned upon in random number
> > > > > generation, that's why the krng uses chacha20.  In general I think
> > > > > we shouldn't try to code our own mixing and instead should get the
> > > > > krng to do it for us using whatever the algorithm du jour that the
> > > > > crypto guys have blessed is.  That's why I proposed adding the TPM
> > > > > output to the krng as entropy input and then taking the output of
> > > > > the krng.
> > > > 
> > > > It is already registered as hwrng. What else?
> > > 
> > > It only contributes entropy once at start of OS.
> > 
> > Ok.
> > 
> > > >  Was the issue that it is only used as seed when the rng is init'd
> > > > first? I haven't at this point gone to the internals of krng.
> > > 
> > > Basically it was similar to your xor patch except I got the kernel rng
> > > to do the mixing, so it would use the chacha20 cipher at the moment
> > > until they decide that's unsafe and change it to something else:
> > > 
> > > https://lore.kernel.org/linux-crypto/1570227068.17537.4.camel@HansenPartnership.com/
> > > 
> > > It uses add_hwgenerator_randomness() to do the mixing.  It also has an
> > > unmixed source so that read of the TPM hwrng device works as expected.
> > 
> > Thinking that could this potentially racy? I.e. between the calls
> > something else could eat the entropy added?
> 
> Also, what is wrong just taking one value from krng and mixing
> it with a value from TPM RNG where needed? That would be non-racy
> too.

I guess we can move forward with this?

/Jarkko

WARNING: multiple messages have this Message-ID (diff)
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: "Safford, David (GE Global Research, US)" <david.safford@ge.com>,
	Ken Goldman <kgold@linux.ibm.com>,
	Mimi Zohar <zohar@linux.ibm.com>,
	"linux-integrity@vger.kernel.org"
	<linux-integrity@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"open list:ASYMMETRIC KEYS" <keyrings@vger.kernel.org>,
	"open list:CRYPTO API" <linux-crypto@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] KEYS: asym_tpm: Switch to get_random_bytes()
Date: Tue, 29 Oct 2019 08:42:58 +0000	[thread overview]
Message-ID: <20191029084258.GA5649@linux.intel.com> (raw)
In-Reply-To: <20191021113939.GA11649@linux.intel.com>

On Mon, Oct 21, 2019 at 02:39:39PM +0300, Jarkko Sakkinen wrote:
> On Thu, Oct 17, 2019 at 09:04:40PM +0300, Jarkko Sakkinen wrote:
> > On Wed, Oct 16, 2019 at 03:10:29PM -0400, James Bottomley wrote:
> > > On Wed, 2019-10-16 at 19:25 +0300, Jarkko Sakkinen wrote:
> > > > On Wed, Oct 16, 2019 at 08:34:12AM -0400, James Bottomley wrote:
> > > > > reversible ciphers are generally frowned upon in random number
> > > > > generation, that's why the krng uses chacha20.  In general I think
> > > > > we shouldn't try to code our own mixing and instead should get the
> > > > > krng to do it for us using whatever the algorithm du jour that the
> > > > > crypto guys have blessed is.  That's why I proposed adding the TPM
> > > > > output to the krng as entropy input and then taking the output of
> > > > > the krng.
> > > > 
> > > > It is already registered as hwrng. What else?
> > > 
> > > It only contributes entropy once at start of OS.
> > 
> > Ok.
> > 
> > > >  Was the issue that it is only used as seed when the rng is init'd
> > > > first? I haven't at this point gone to the internals of krng.
> > > 
> > > Basically it was similar to your xor patch except I got the kernel rng
> > > to do the mixing, so it would use the chacha20 cipher at the moment
> > > until they decide that's unsafe and change it to something else:
> > > 
> > > https://lore.kernel.org/linux-crypto/1570227068.17537.4.camel@HansenPartnership.com/
> > > 
> > > It uses add_hwgenerator_randomness() to do the mixing.  It also has an
> > > unmixed source so that read of the TPM hwrng device works as expected.
> > 
> > Thinking that could this potentially racy? I.e. between the calls
> > something else could eat the entropy added?
> 
> Also, what is wrong just taking one value from krng and mixing
> it with a value from TPM RNG where needed? That would be non-racy
> too.

I guess we can move forward with this?

/Jarkko

  reply	other threads:[~2019-10-29  8:43 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-26 17:16 [PATCH] KEYS: asym_tpm: Switch to get_random_bytes() Jarkko Sakkinen
2019-09-26 17:16 ` Jarkko Sakkinen
2019-09-28 18:05 ` Jerry Snitselaar
2019-09-28 18:05   ` Jerry Snitselaar
2019-10-01 20:54   ` Jarkko Sakkinen
2019-10-01 20:54     ` Jarkko Sakkinen
2019-10-02 14:00 ` Mimi Zohar
2019-10-02 14:00   ` Mimi Zohar
2019-10-03 11:41   ` Jarkko Sakkinen
2019-10-03 11:41     ` Jarkko Sakkinen
2019-10-03 11:43     ` Jarkko Sakkinen
2019-10-03 11:43       ` Jarkko Sakkinen
2019-10-03 13:02     ` Mimi Zohar
2019-10-03 13:02       ` Mimi Zohar
2019-10-03 17:58       ` Jarkko Sakkinen
2019-10-03 17:58         ` Jarkko Sakkinen
2019-10-03 18:53         ` Mimi Zohar
2019-10-03 18:53           ` Mimi Zohar
2019-10-03 21:51           ` Jarkko Sakkinen
2019-10-03 21:51             ` Jarkko Sakkinen
2019-10-03 21:57             ` Jarkko Sakkinen
2019-10-03 21:57               ` Jarkko Sakkinen
2019-10-03 22:08               ` Mimi Zohar
2019-10-03 22:08                 ` Mimi Zohar
2019-10-03 23:59                 ` James Bottomley
2019-10-03 23:59                   ` James Bottomley
2019-10-04 18:22                   ` Jarkko Sakkinen
2019-10-04 18:22                     ` Jarkko Sakkinen
2019-10-04 18:24                     ` James Bottomley
2019-10-04 18:24                       ` James Bottomley
2019-10-04 18:33                       ` Jerry Snitselaar
2019-10-04 18:33                         ` Jerry Snitselaar
2019-10-04 18:42                         ` James Bottomley
2019-10-04 18:42                           ` James Bottomley
2019-10-04 20:07                           ` Jerry Snitselaar
2019-10-04 20:07                             ` Jerry Snitselaar
2019-10-04 20:11                             ` Jerry Snitselaar
2019-10-04 20:11                               ` Jerry Snitselaar
2019-10-04 22:11                               ` James Bottomley
2019-10-04 22:11                                 ` James Bottomley
2019-10-06  0:38                                 ` Mimi Zohar
2019-10-06  0:38                                   ` Mimi Zohar
2019-10-06 23:52                                   ` Jarkko Sakkinen
2019-10-06 23:52                                     ` Jarkko Sakkinen
2019-10-07 18:08                                     ` Mimi Zohar
2019-10-07 18:08                                       ` Mimi Zohar
2019-10-04 18:20                 ` Jarkko Sakkinen
2019-10-04 18:20                   ` Jarkko Sakkinen
2019-10-03 22:10               ` Jarkko Sakkinen
2019-10-03 22:10                 ` Jarkko Sakkinen
2019-10-04 13:26           ` Safford, David (GE Global Research, US)
2019-10-04 13:26             ` Safford, David (GE Global Research, US)
2019-10-04 18:27             ` Jarkko Sakkinen
2019-10-04 18:27               ` Jarkko Sakkinen
2019-10-04 18:30               ` Jarkko Sakkinen
2019-10-04 18:30                 ` Jarkko Sakkinen
2019-10-04 19:56               ` Safford, David (GE Global Research, US)
2019-10-04 19:56                 ` Safford, David (GE Global Research, US)
2019-10-07  0:05                 ` Jarkko Sakkinen
2019-10-07  0:05                   ` Jarkko Sakkinen
2019-10-07 22:13                   ` Ken Goldman
2019-10-07 22:13                     ` Ken Goldman
2019-10-08 23:49                     ` Jarkko Sakkinen
2019-10-08 23:49                       ` Jarkko Sakkinen
2019-10-08 23:53                       ` Jarkko Sakkinen
2019-10-08 23:53                         ` Jarkko Sakkinen
2019-10-09  7:10                         ` Pascal Van Leeuwen
2019-10-09  7:10                           ` Pascal Van Leeuwen
2019-10-09  7:33                         ` Jarkko Sakkinen
2019-10-09  7:33                           ` Jarkko Sakkinen
2019-10-09  7:41                           ` Jarkko Sakkinen
2019-10-09  7:41                             ` Jarkko Sakkinen
2019-10-09  8:09                             ` Pascal Van Leeuwen
2019-10-09  8:09                               ` Pascal Van Leeuwen
2019-10-14 19:11                               ` Jarkko Sakkinen
2019-10-14 19:11                                 ` Jarkko Sakkinen
2019-10-09  8:02                           ` Pascal Van Leeuwen
2019-10-09  8:02                             ` Pascal Van Leeuwen
2019-10-09 12:11                         ` Safford, David (GE Global Research, US)
2019-10-09 12:11                           ` Safford, David (GE Global Research, US)
2019-10-14 19:00                           ` Jarkko Sakkinen
2019-10-14 19:00                             ` Jarkko Sakkinen
2019-10-14 19:29                             ` Jarkko Sakkinen
2019-10-14 19:29                               ` Jarkko Sakkinen
2019-10-14 19:29                             ` James Bottomley
2019-10-14 19:29                               ` James Bottomley
2019-10-16 11:00                               ` Jarkko Sakkinen
2019-10-16 11:00                                 ` Jarkko Sakkinen
2019-10-16 12:34                                 ` James Bottomley
2019-10-16 12:34                                   ` James Bottomley
2019-10-16 16:25                                   ` Jarkko Sakkinen
2019-10-16 16:25                                     ` Jarkko Sakkinen
2019-10-16 19:10                                     ` James Bottomley
2019-10-16 19:10                                       ` James Bottomley
2019-10-17 12:52                                       ` Sumit Garg
2019-10-17 12:52                                         ` Sumit Garg
2019-10-17 12:58                                         ` James Bottomley
2019-10-17 12:58                                           ` James Bottomley
2019-10-17 18:04                                       ` Jarkko Sakkinen
2019-10-17 18:04                                         ` Jarkko Sakkinen
2019-10-21 11:39                                         ` Jarkko Sakkinen
2019-10-21 11:39                                           ` Jarkko Sakkinen
2019-10-29  8:42                                           ` Jarkko Sakkinen [this message]
2019-10-29  8:42                                             ` Jarkko Sakkinen
2019-10-29 14:58                                             ` James Bottomley
2019-10-29 14:58                                               ` James Bottomley
2019-10-31 21:03                                               ` Jarkko Sakkinen
2019-10-31 21:03                                                 ` Jarkko Sakkinen
2019-10-18  7:32                                   ` Janne Karhunen
2019-10-18  7:32                                     ` Janne Karhunen
2019-10-03 18:02       ` Jarkko Sakkinen
2019-10-03 18:02         ` Jarkko Sakkinen
2019-10-03 18:15         ` Jarkko Sakkinen
2019-10-03 18:15           ` Jarkko Sakkinen
2019-10-07 10:33     ` Janne Karhunen
2019-10-07 10:33       ` Janne Karhunen

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=20191029084258.GA5649@linux.intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=david.safford@ge.com \
    --cc=keyrings@vger.kernel.org \
    --cc=kgold@linux.ibm.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=zohar@linux.ibm.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 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.