From nobody Mon Sep 8 15:26:35 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cL9lw3LFjz66kGC; Mon, 08 Sep 2025 15:26:36 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cL9lv710gz3NQ3; Mon, 08 Sep 2025 15:26:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757345196; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ISWkEM8cVhV0gU5U1lSKqc8twuPsEKaHkHtfukOBBiM=; b=NmKWTLBidTr98nJQP5gCJEIvfqvEG27pC8hR9nUhWyOEnq2KxZpw0C1PfozucqhcEi5JJx NgWQnC4t8176W30EUJVT+4kNQmrv8mL5qlsqNTEpuWx4RcSXsub2zzP/t0zXyC4/OHuPpC X83CgxDehUpN+Bcy4/7CQIzBXA6u9v47E/GqT6edwMYiHFzZhXjrXveyDVOnjPbtVN6yUe ZVlteHh8qZqbJOcr9Rd+jRXKaFrbA/DeF9cWAm4ebTQtX94suWVbPeON86/heYhbqSWtF1 QEkRujjmyvvYOWL782RuCiC9hd1NjsNekbDq1Eyytdqs5NJVdbfnW9Fd4JmZjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757345196; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ISWkEM8cVhV0gU5U1lSKqc8twuPsEKaHkHtfukOBBiM=; b=o8gbOVM5Mt5AY1F4ICaCvKSHYYEnIfoT3ezbg8LBQbT7DEcXmNf2fNOXlE3uDVbP7SFcv0 nVn9gvpK3KpjL9m3zLsOCA4elWfH++zenlL396fnY3lRDM78ct+XjTYv8qL54RnUSjajHL Oy0claYuZW6QfxY8ogH4gr6cAQMtbmuAzMvWjH+NAYi5XVpX/IpVKTYAQBgSlTrxJYFw0D XTwYe4DU+YeXz8y8Zriv3eaAr3PB42UpKvZORC2+eZn/NVUC4fhzhE6Z9nqS/nOnamL5wt YzWYPLc4Zn2VaeQSKS92TxdGN1U2PXiTrxsvHt2rpwofquRXYggi0DMRWlr5dg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757345196; a=rsa-sha256; cv=none; b=qXoFTqcWqVHJHjfpyPA2AbO/hN1poo/FHSvPozMcVXMOTRzcsECAghlLZXQq2ZxhcoQtYa DJrOc22kjr0rAl89AG12JfG7PAkNmo9pmP4z2hmGZL65Vj/KwXAnmmEjRzvVbc2C0hrE3V 4PpgDjOSOCvAq1+Y2N8t4QoEqEbLQzeAsriZIQiRxbc6Yfr+vHnafir6tnQeIgsACG+xk7 gYzrpgkAV9qNUzP+3v+LjCTF0fvsZTF0e+F+pGq5J4ofydZIJycbfPDc7LAKuEETJeQbPJ 2zMP6Gr1pshatyX/WAi4ATv7UbpdnNtxCAUxwvML/kLoR1QmHlyYgOwgd0304Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cL9lv6Vbbz19qc; Mon, 08 Sep 2025 15:26:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 588FQZu7076669; Mon, 8 Sep 2025 15:26:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 588FQZuF076666; Mon, 8 Sep 2025 15:26:35 GMT (envelope-from git) Date: Mon, 8 Sep 2025 15:26:35 GMT Message-Id: <202509081526.588FQZuF076666@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 480928ae657d - main - random: Exclude the timestamp from healthtest for pure sources List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 480928ae657d81e41f8c10837cd1cf0ca87b14ae Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=480928ae657d81e41f8c10837cd1cf0ca87b14ae commit 480928ae657d81e41f8c10837cd1cf0ca87b14ae Author: Mark Johnston AuthorDate: 2025-09-08 14:46:12 +0000 Commit: Mark Johnston CommitDate: 2025-09-08 15:21:43 +0000 random: Exclude the timestamp from healthtest for pure sources So-called pure sources provide entropy at regular intervals, so the timestamp counter provides little entropy. Exclude it from health testing for such sources. Reviewed by: cem, emaste MFC after: 2 weeks Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D52233 --- sys/dev/random/random_harvestq.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c index c308f6f80d59..2d7af254c52c 100644 --- a/sys/dev/random/random_harvestq.c +++ b/sys/dev/random/random_harvestq.c @@ -343,7 +343,17 @@ copy_event(uint32_t dst[static HARVESTSIZE + 1], { memset(dst, 0, sizeof(uint32_t) * (HARVESTSIZE + 1)); memcpy(dst, event->he_entropy, event->he_size); - dst[HARVESTSIZE] = event->he_somecounter; + if (event->he_source <= RANDOM_ENVIRONMENTAL_END) { + /* + * For pure entropy sources the timestamp counter is generally + * quite determinstic since samples are taken at regular + * intervals, so does not contribute much to the entropy. To + * make health tests more effective, exclude it from the sample, + * since it might otherwise defeat the health tests in a + * scenario where the source is stuck. + */ + dst[HARVESTSIZE] = event->he_somecounter; + } } static void