[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHmME9pxJFBv-ZZ3bPMJdmxUO4oeY-wS4BtW34w1ncbeeU=MeA@mail.gmail.com>
Date: Thu, 20 Jan 2022 16:03:41 +0100
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: "Theodore Ts'o" <tytso@....edu>
Cc: LKML <linux-kernel@...r.kernel.org>
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@....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
Powered by blists - more mailing lists