lkml.org 
[lkml]   [2022]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] random: defer use of bootloader randomness to random_init()
Hi Ard,

On Tue, Jun 07, 2022 at 04:19:26PM +0200, Ard Biesheuvel wrote:
> #include <stdio.h>
> #include <stdlib.h>
> #include <sys/random.h>
>
> static unsigned char buf[16];
>
> int main(void)
> {
> for (int i = 0; i < 1000000; i++) {
> if (getrandom(buf, sizeof(buf),
> GRND_RANDOM | GRND_NONBLOCK) < sizeof(buf)) {
> fprintf(stderr, "getrandom() error!\n");
> exit(-1);
> }
> }
> return 0;
> }

I'm actually more worried about the random input flow than the random
output flow and branch misprediction. But more generally, I'd just like
to keep that code as cold as possible after crng init. It's code that's
only used in that one phase and then never again. It can be entirely
disabled.

Anyway, we've got a few solutions now to pick from on the random.c side
of things. I'm going to investigate the arm32 situation next. And then
we'll see what it all looks like.

Jason

\
 
 \ /
  Last update: 2022-06-07 16:49    [W:0.859 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site