Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround lack of boottime entropy for GFE environments #2296

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sys/conf/options
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,9 @@ RANDOM_LOADABLE opt_global.h
# the uma slab allocator.
RANDOM_ENABLE_UMA opt_global.h
RANDOM_ENABLE_ETHER opt_global.h
# This is highly insecure but used in environments without any
# pre-boot entropy
RANDOM_NO_ENTROPY opt_global.h

# This options turns TPM into entropy source.
TPM_HARVEST opt_tpm.h
Expand Down
4 changes: 4 additions & 0 deletions sys/dev/random/fortuna.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ CTASSERT(RANDOM_FORTUNA_BLOCKS_PER_KEY * RANDOM_BLOCKSIZE ==
* Making RANDOM_FORTUNA_DEFPOOLSIZE too large will mean a long time between reseeds,
* and too small may compromise initial security but get faster reseeds.
*/
#ifdef RANDOM_NO_ENTROPY
#define RANDOM_FORTUNA_MINPOOLSIZE 1
#else
#define RANDOM_FORTUNA_MINPOOLSIZE 16
#endif
#define RANDOM_FORTUNA_MAXPOOLSIZE INT_MAX
CTASSERT(RANDOM_FORTUNA_MINPOOLSIZE <= RANDOM_FORTUNA_DEFPOOLSIZE);
CTASSERT(RANDOM_FORTUNA_DEFPOOLSIZE <= RANDOM_FORTUNA_MAXPOOLSIZE);
Expand Down
4 changes: 4 additions & 0 deletions sys/dev/random/fortuna.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@

/* Defined in FS&K */
#define RANDOM_FORTUNA_NPOOLS 32 /* The number of accumulation pools */
#ifdef RANDOM_NO_ENTROPY
#define RANDOM_FORTUNA_DEFPOOLSIZE 1 /* The default pool size/length for a (re)seed */

Check warning on line 33 in sys/dev/random/fortuna.h

View workflow job for this annotation

GitHub Actions / Style Checker

line over 80 characters
#else
#define RANDOM_FORTUNA_DEFPOOLSIZE 64 /* The default pool size/length for a (re)seed */
#endif

#ifdef _KERNEL
typedef struct mtx mtx_t;
Expand Down
2 changes: 2 additions & 0 deletions sys/riscv/conf/GFE
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@

options BREAK_TO_DEBUGGER
options ALT_BREAK_TO_DEBUGGER

options RANDOM_NO_ENTROPY

Check warning on line 15 in sys/riscv/conf/GFE

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line
Loading