From: Sumit Garg <sumit.garg@linaro.org> To: James Bottomley <James.Bottomley@hansenpartnership.com> Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>, "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: Thu, 17 Oct 2019 18:22:17 +0530 [thread overview] Message-ID: <CAFA6WYNNNTWXDrp_R3M60srGJYjJdRoaNpSnP54V_BinYYXTMA@mail.gmail.com> (raw) In-Reply-To: <1571253029.17520.5.camel@HansenPartnership.com> On Thu, 17 Oct 2019 at 00:40, James Bottomley <James.Bottomley@hansenpartnership.com> 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. > Why not just configure quality parameter of TPM hwrng as follows? It would automatically initiate a kthread during hwrng_init() to feed entropy from TPM to kernel random numbers pool (see: drivers/char/hw_random/core.c +142). diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c index 3d6d394..fcc3817 100644 --- a/drivers/char/tpm/tpm-chip.c +++ b/drivers/char/tpm/tpm-chip.c @@ -548,6 +548,7 @@ static int tpm_add_hwrng(struct tpm_chip *chip) "tpm-rng-%d", chip->dev_num); chip->hwrng.name = chip->hwrng_name; chip->hwrng.read = tpm_hwrng_read; + chip->hwrng.quality = 1024; /* Here we assume TPM provides full entropy */ return hwrng_register(&chip->hwrng); } > > 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. Above suggestion is something similar to yours but utilizing the framework already provided via hwrng core. -Sumit > > James > > > > >
next prev parent reply other threads:[~2019-10-17 12:52 UTC|newest] Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-09-26 17:16 Jarkko Sakkinen 2019-09-28 18:05 ` Jerry Snitselaar 2019-10-01 20:54 ` Jarkko Sakkinen 2019-10-02 14:00 ` Mimi Zohar 2019-10-03 11:41 ` Jarkko Sakkinen 2019-10-03 11:43 ` Jarkko Sakkinen 2019-10-03 13:02 ` Mimi Zohar 2019-10-03 17:58 ` Jarkko Sakkinen 2019-10-03 18:53 ` Mimi Zohar 2019-10-03 21:51 ` Jarkko Sakkinen 2019-10-03 21:57 ` Jarkko Sakkinen 2019-10-03 22:08 ` Mimi Zohar 2019-10-03 23:59 ` James Bottomley 2019-10-04 18:22 ` Jarkko Sakkinen 2019-10-04 18:24 ` James Bottomley 2019-10-04 18:33 ` Jerry Snitselaar 2019-10-04 18:42 ` James Bottomley 2019-10-04 20:07 ` Jerry Snitselaar 2019-10-04 20:11 ` Jerry Snitselaar 2019-10-04 22:11 ` James Bottomley 2019-10-06 0:38 ` Mimi Zohar 2019-10-06 23:52 ` Jarkko Sakkinen 2019-10-07 18:08 ` Mimi Zohar 2019-10-04 18:20 ` Jarkko Sakkinen 2019-10-03 22:10 ` Jarkko Sakkinen 2019-10-04 13:26 ` Safford, David (GE Global Research, US) 2019-10-04 18:27 ` Jarkko Sakkinen 2019-10-04 18:30 ` Jarkko Sakkinen 2019-10-04 19:56 ` Safford, David (GE Global Research, US) 2019-10-07 0:05 ` Jarkko Sakkinen 2019-10-07 22:13 ` Ken Goldman 2019-10-08 23:49 ` Jarkko Sakkinen 2019-10-08 23:53 ` Jarkko Sakkinen 2019-10-09 7:10 ` Pascal Van Leeuwen 2019-10-09 7:33 ` Jarkko Sakkinen 2019-10-09 7:41 ` Jarkko Sakkinen 2019-10-09 8:09 ` Pascal Van Leeuwen 2019-10-14 19:11 ` Jarkko Sakkinen 2019-10-09 8:02 ` Pascal Van Leeuwen 2019-10-09 12:11 ` Safford, David (GE Global Research, US) 2019-10-14 19:00 ` Jarkko Sakkinen 2019-10-14 19:29 ` Jarkko Sakkinen 2019-10-14 19:29 ` James Bottomley 2019-10-16 11:00 ` Jarkko Sakkinen 2019-10-16 12:34 ` James Bottomley 2019-10-16 16:25 ` Jarkko Sakkinen 2019-10-16 19:10 ` James Bottomley 2019-10-17 12:52 ` Sumit Garg [this message] 2019-10-17 12:58 ` James Bottomley 2019-10-17 18:04 ` Jarkko Sakkinen 2019-10-21 11:39 ` Jarkko Sakkinen 2019-10-29 8:42 ` Jarkko Sakkinen 2019-10-29 14:58 ` James Bottomley 2019-10-31 21:03 ` Jarkko Sakkinen 2019-10-18 7:32 ` Janne Karhunen 2019-10-03 18:02 ` Jarkko Sakkinen 2019-10-03 18:15 ` Jarkko Sakkinen 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=CAFA6WYNNNTWXDrp_R3M60srGJYjJdRoaNpSnP54V_BinYYXTMA@mail.gmail.com \ --to=sumit.garg@linaro.org \ --cc=James.Bottomley@hansenpartnership.com \ --cc=david.safford@ge.com \ --cc=jarkko.sakkinen@linux.intel.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 \ --subject='Re: [PATCH] KEYS: asym_tpm: Switch to get_random_bytes()' \ /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
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).