lkml.org 
[lkml]   [2022]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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

\
 
 \ /
  Last update: 2022-01-20 16:05    [W:0.084 / U:0.628 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site