Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp19837imm; Tue, 17 Jul 2018 19:44:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd8nABcJKBRmhJ9ebLY0wpayxHI9dedhh1m3cUHuO6QXAFsWbzRbq/i+4ORFL3nJgHqttjN X-Received: by 2002:a17:902:3343:: with SMTP id a61-v6mr3925704plc.241.1531881848066; Tue, 17 Jul 2018 19:44:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531881848; cv=none; d=google.com; s=arc-20160816; b=lEmpmCImM9UITsvlbUskNcT0dHpPhIANH6nbC6aqMCnnRMBQ2hXGeLKJZEt6wSQmKw mD6vIzwGp95uPndaoBOdo4zN/XBfJ3jDlV2Cr/kyYtmaB73oznpoh0DaHOKN1LbLhIVD PiS8SgydzYewRdAP3zXbwAoBFpMQXX0GMIuud2A41nDot/IhzAhF+mx35JRCjU9GtL/t thrdI6J4IgLjaPVhqlkOqZYgXDKG7xr/gA5McXZXn4eXl9Mj+HA/77PExQiZTSsCx1CC 2uZ1Sp39zrHaEy7lHxYkEUPEdYnFS4XOTrhne2p+GHQu1LpG9b6aLKQWng78bZww7JvA 1sZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=hGCO4ukNoxtsWsd6lxiW7iaIu/DyNa4l5pFV9kMh5kE=; b=T8nH50nKPnGClSdh4X1nGpzm9J/Hcq/2WAzuDyBo8/hW8CPSAXpBZdniFdqDQNveB9 9qtr/4Baz+Zh3UpJKU234Rm2JylW6I7udC8oLL/L/R12fFik3QspLty7t5hVWaJb+chB w672My3b4sflrPkJUy6j0ghq9BJTLgDGajcnTBlYegFN/dhXlcGPfIlgJR4FBcZ/UfAz 4gP5/XajdKM9InDFJpaXOd7S9iNT4Jrb0yOjQADozKFudURkjfGDh9jaXaVFJzFcyfrl 3NyWQL90kY2Cb/IpoLac0/YzrgGsHUZNHLgNNdctu4RwN/YWTUDdgdpYHV40YREZ5G2V Vn7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xaptum-com.20150623.gappssmtp.com header.s=20150623 header.b=kCqen7+V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r59-v6si2111948plb.187.2018.07.17.19.43.51; Tue, 17 Jul 2018 19:44:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@xaptum-com.20150623.gappssmtp.com header.s=20150623 header.b=kCqen7+V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731584AbeGRDSs (ORCPT + 99 others); Tue, 17 Jul 2018 23:18:48 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:46160 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731304AbeGRDSs (ORCPT ); Tue, 17 Jul 2018 23:18:48 -0400 Received: by mail-wr1-f66.google.com with SMTP id s11-v6so3015974wra.13 for ; Tue, 17 Jul 2018 19:43:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xaptum-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=hGCO4ukNoxtsWsd6lxiW7iaIu/DyNa4l5pFV9kMh5kE=; b=kCqen7+VEnkjUOrahU+Q4htWtX/Mwi3uy9fS8pldN1q6An0RsiM5ivjSfaf7nyZ6iu bXxANumM6MtLyz26pYEDg9U8YI59hCnrqdpmbwdAFn6IJW5KfP3SghpaFEeRKhw7EJF3 1aJEaplj6Opa4qJpwm9JjsWx29IdhsvABVPSjbVXuscaGeSCzI29qlXrHHbzlW+IrcYE PRkzTTyEfQfZ0yUnFsdy/00MVof8CkKIn7wqh1ct0YwgEJtttm34sOb9ZE6660lpI4Hd EWXWZfyrpAYO1yEblPgEaN75y8kikDyLCSrhsQjS/0Js2o1zUQ8cQlGfCNHNENqF3xZK cP4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=hGCO4ukNoxtsWsd6lxiW7iaIu/DyNa4l5pFV9kMh5kE=; b=Vcss67XXFitwcD3/dj4KE0GcD7KyaIdNiidf5oUE8+9IZZzNRuMrlTAK09PfyEevhg yzEALGbiELLHj/lU00SkjTiAlXVqgqoiN2xFkkEpvWp+haqnQGNu7ResgPifrO5kmY3x QsW5KgV8x7BeBzb+UKNKDgWJUroc3zziGJTpWgWkk8+gMlJTDpehY+gVlt8zp4VHArhd GmxPx1+dj955bwsBwd0VjFlkFbQCkFDmTvbnXzZf4Uss8PIk5xKC4eS73EAN/49ZcZwL sdsrMjRk2oVE6Hkbz1ORbz/ioXqvAoUoAgbbzGPUwU+w0UWKA/+i6SINzxiVQ5jYRjZZ MZ+A== X-Gm-Message-State: AOUpUlFPxEkyL6pY591Uh5hk9sQioCOWzG9CLnNiJFKLPGeGSXaoE1UW 4pJJV1LQZLX5sWSqPjDUupR+nBXUhXoik2HeistlBw== X-Received: by 2002:adf:a599:: with SMTP id g25-v6mr3072012wrc.88.1531881793551; Tue, 17 Jul 2018 19:43:13 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:3d8b:0:0:0:0:0 with HTTP; Tue, 17 Jul 2018 19:43:12 -0700 (PDT) In-Reply-To: References: <20180608065438.110109-1-louiscollard@chromium.org> <20180618180712.GB20697@linux.intel.com> <20180618193306.GF6805@ziepe.ca> <20180621162101.GB11859@linux.intel.com> From: "David R. Bild" Date: Tue, 17 Jul 2018 22:43:12 -0400 Message-ID: Subject: Re: [PATCH] tpm: Add module parameter for hwrng quality. To: Louis Collard Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 4, 2018 at 2:54 AM, Louis Collard wrote: > On Fri, Jun 29, 2018 at 9:03 PM, David R. Bild wrote: >> As a point of clarification (and correct me if I'm wrong), the TPM is >> always ready used to seed the rng. It just doesn't update the entropy >> pool estimate. > > Good point. > >> >> So, perhaps the default value for the TPM hwrng quality should be >> non-zero (in addition to the module param that lets users override >> it)? > > That makes sense to me, however I can imagine that some users would > prefer to not have the TPM enabled as an ongoing source of entropy by > default. Fair enough. > Following on from your previous point - perhaps we can just make a > small change to how the initial seeding is done: maybe we can replace > the call to crng_slow_load (via add_early_randomness and > add_device_randomness) with a call (indirectly) to crng_fast_load. (We > might also need to increase the amount of data read at this point.) > > This would update crng_init_cnt and crng_init, and calls to getrandom > [without GRND_RANDOM] would not block. Interesting. add_hwgenereator_randomness() will call crng_fast_load(), regardless of entropy estimate/quality, if crng_init is 0. So initializing crng_init from the hwrng, regardless of quality, is already the intent. But hw_random only calls add_hwgenerator_randomness() if current_quality > 0, via the hwrng_fillfn() kthread. All that to say, I agree. add_early_randomness() should (indirectly) call crng_fast_load(), like add_hwgenerator_randomness() does. > This obviously doesn't solve the issue if there are blocking calls on > boot that are querying random rather than urandom; I don't believe > that would be a problem for our use case though. > It wouldn't be a problem for our use case either. Best, David