From owner-dev-commits-src-all@freebsd.org Wed May 26 11:41:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85F1663A3D9; Wed, 26 May 2021 11:41:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FqptS3BgVz4nmH; Wed, 26 May 2021 11:41:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 55D6010431; Wed, 26 May 2021 11:41:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14QBf4Rn033768; Wed, 26 May 2021 11:41:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14QBf4ck033767; Wed, 26 May 2021 11:41:04 GMT (envelope-from git) Date: Wed, 26 May 2021 11:41:04 GMT Message-Id: <202105261141.14QBf4ck033767@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eugene Grosbein Subject: git: 3bca93e04275 - main - rc.d/random: add support for zero harvest_mask MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: eugen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3bca93e04275045c3d868d09a57f9201999908f0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 May 2021 11:41:04 -0000 The branch main has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=3bca93e04275045c3d868d09a57f9201999908f0 commit 3bca93e04275045c3d868d09a57f9201999908f0 Author: Eugene Grosbein AuthorDate: 2021-05-26 11:30:24 +0000 Commit: Eugene Grosbein CommitDate: 2021-05-26 11:30:24 +0000 rc.d/random: add support for zero harvest_mask Replace the check for zero harvest_mask with new check for empty string. This allows one to specify harvest_mask="0" that disables harversting entropy from all but "pure" sources. Exact bit values for "pure" sources differ for stable/12 and later branches, so it is handy to use zero. The check for zero pre-dates introduction of "pure" non-maskable sources Use empty string to disable altering sysctl kern.random.harvest.mask. Note that notion of "pure" random sources is not documented in user level manual pages yet. Still, it helps to extend battery life for hardware with embedded "Intel Secure Key RNG" by disabling all other sources. Note that no defaults changed and default behaviour is not affected. Reported by: Dmitry Luhtionov --- libexec/rc/rc.d/random | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/random b/libexec/rc/rc.d/random index d275284e13d6..fda3c8a71fae 100755 --- a/libexec/rc/rc.d/random +++ b/libexec/rc/rc.d/random @@ -47,7 +47,7 @@ feed_dev_random() random_start() { - if [ ${harvest_mask} -gt 0 ]; then + if [ -n "${harvest_mask}" ]; then echo -n 'Setting up harvesting: ' ${SYSCTL} kern.random.harvest.mask=${harvest_mask} > /dev/null ${SYSCTL_N} kern.random.harvest.mask_symbolic