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
This commit is contained in:
Conrad Meyer 2018-10-20 20:12:57 +00:00
parent 90545403e9
commit 84880efae7

View File

@ -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)