Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Aug 2021 00:49:26 GMT
From:      "David E. O'Brien" <obrien@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 2cc41234353f - stable/12 - Fortuna: Add trivial assert to match FS&K definition
Message-ID:  <202108060049.1760nQlC041517@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by obrien:

URL: https://cgit.FreeBSD.org/src/commit/?id=2cc41234353f4fff0b55984367b60748b67481ec

commit 2cc41234353f4fff0b55984367b60748b67481ec
Author:     Conrad Meyer <cem@FreeBSD.org>
AuthorDate: 2018-10-20 20:12:57 +0000
Commit:     David E. O'Brien <obrien@FreeBSD.org>
CommitDate: 2021-08-06 00:28:00 +0000

    Fortuna: Add trivial assert to match FS&K definition
    
    FS&K GenerateBlocks function asserts C (counter) != 0.  This should also
    be true in our implementation.
    
    Reviewed by:    delphij, markm
    Approved by:    secteam (delphij)
    Sponsored by:   Dell EMC Isilon
    Differential Revision:  https://reviews.freebsd.org/D16936
    (cherry picked from commit 84880efae7040bb55e6f63166f53158135574e3a)
---
 sys/dev/random/fortuna.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/dev/random/fortuna.c b/sys/dev/random/fortuna.c
index d203c2f138a1..7b4193b528d4 100644
--- a/sys/dev/random/fortuna.c
+++ b/sys/dev/random/fortuna.c
@@ -310,6 +310,8 @@ random_fortuna_genblocks(uint8_t *buf, u_int blockcount)
 	u_int i;
 
 	RANDOM_RESEED_ASSERT_LOCK_OWNED();
+	KASSERT(!uint128_is_zero(fortuna_state.fs_counter), ("FS&K: C != 0"));
+
 	for (i = 0; i < blockcount; i++) {
 		/*-
 		 * FS&K - r = r|E(K,C)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108060049.1760nQlC041517>