Messages in this thread | | | From | "Jason A. Donenfeld" <> | Date | Thu, 20 Jan 2022 16:03:41 +0100 | Subject | Re: [PATCH v2] random: avoid superfluous call to RDRAND in CRNG extraction |
| |
On Tue, Jan 4, 2022 at 6:55 AM Theodore Ts'o <tytso@mit.edu> wrote: > If we want to worry about what happens if we could actually manage to > call _extract_crng() more than 2**64 times before the reseed interval > is up --- which *is* one of the benefits of: > > if (arch_get_random_long(^v)) > crng->state[14] ^= v; > > I could see doing perhaps this instead: > > if (crng->state[12] == 0) { > crng->state[13]++; > if (crng->state[13] == 0) { > crng->state[14]++; > if (crng->state[14] == 0) { > crng->state[15]++; > } > } > }
While probably overkill, I've got a patch that does this while also labeling these constants. I'll send that as a reply to this message.
Jason
| |