From nobody Tue Sep 30 15:23:47 2025 X-Original-To: dev-commits-src-all@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 4cbhfW5FMqz69F55; Tue, 30 Sep 2025 15:23:47 +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 4cbhfW2kGrz3M1L; Tue, 30 Sep 2025 15:23:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759245827; 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=U+5dEEkGwYSoVoQ1LlMb1YWnqBLFzu8R7RVTFBmC8JM=; b=XCZ+1u0XUW77dvqxi0udZGr5UgD8p1IydvWLVGwHkKHI3YsabR6IRFDgyKU0nnq39/6+6o nzHRoH2kohx/yV83PKk2XEYZ61F4A+WirAJswCghRGleF7EbpCLySKekrxCU7HOliTCHLH oZKNHhgh+EtRoSW6gqB7S8UQCXXpKkSCJ1ZvVhmC3DXtTHv9d84N2iRJjbx6b8IYm45v1H A+nQfFyb8ih49cEKZsu9TZqw0iYiyjRIYiwrOCldcuMD9mSjDjbT39yc2Ic1oFcRwsSXrU PA6XAJyZ8tslylpwut2gegg5aRZyp5Z5T1xMT7hWNQvZNt1uxsi5IGSA7KnUmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759245827; 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=U+5dEEkGwYSoVoQ1LlMb1YWnqBLFzu8R7RVTFBmC8JM=; b=ULd3vN8K3suawypQxLbHfqMiKKNN1mJXtfQd4mG7RcTCUSmHFtLokmlXljUX7+/KAmat79 5iVLB7raqVfM0zuHky7h+p6oJayMsrFFjQ9+F/gls9eyFSyuXIHGG7urwo2BmN9d7zq05X +cprSvCd+5WZlhAtZMrBfnqimKrjhKGgYrwQOc4k2mBgJzEZFNci+TS4E4mnfv57K0oVaj 9nYQ0HlJCC6QqtKlEYIB3wiX1foFDHRkL8fYJP14pEbdaAvmFaws5qwBQ4gJcIsOUoM2B2 hlxg5BDr+qhr+0/fbA6YRafuzbwGcFVIXhxhvmoT1olYt+1yyWV4X4wL1FDDhw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759245827; a=rsa-sha256; cv=none; b=FSSb64bfooBLAP33uLsxmC90Le3kW9/2EL4MElN9IG09MdjzRudUlf3R1jfzyXo2P8mhRQ 05aaqklT9T6GOMxSgcZSZTFWB7ejvTNJeBbIJFvXa2vzHw7sMgDrvLcix0W3aNhMM6x1TB WpZ32cJh24wqglp4lzyvF6OZFPOn3X5jKxTw6OC8df1fATb9kn2tnSIt3zVQE5ka7v857p AE2vGH2SXPBmDmA130HO55wMTFDPBuRCCrv8XEzWWmfLkrD9xGqpqLUTP/M+kbyVP4sTfY z8ADMS3SZkCdZrHU1tQrDW1RRpJooVcWRiCVRa1KpfJNHsvBMnEcO9T+YFowlw== 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 4cbhfW2HMPzjGL; Tue, 30 Sep 2025 15:23:47 +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 58UFNl5E045977; Tue, 30 Sep 2025 15:23:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58UFNlmM045974; Tue, 30 Sep 2025 15:23:47 GMT (envelope-from git) Date: Tue, 30 Sep 2025 15:23:47 GMT Message-Id: <202509301523.58UFNlmM045974@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: a33ab3001a1e - stable/15 - random: Exclude the timestamp from healthtest for pure sources List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/stable/15 X-Git-Reftype: branch X-Git-Commit: a33ab3001a1e6df38e4c974ea87a641c110cfbe3 Auto-Submitted: auto-generated The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a33ab3001a1e6df38e4c974ea87a641c110cfbe3 commit a33ab3001a1e6df38e4c974ea87a641c110cfbe3 Author: Mark Johnston AuthorDate: 2025-09-08 14:46:12 +0000 Commit: Mark Johnston CommitDate: 2025-09-30 09:43:08 +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 (cherry picked from commit 480928ae657d81e41f8c10837cd1cf0ca87b14ae) --- 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