-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
CRNG not ready and entropy used early at boot #1476
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
Quote taken from #1483 (comment) |
EDIT for current state:
random.trust_cpu=1
from coreboot command line to Heads kernel boot option.Older
Heads uses entropy early at boot through while CRNG initialization is not yet complete.
This is the result of explorations done, goal being to open a debate on the proper way forward.
The problem is that the CRNG is not ready when some system services need to use random numbers at boot time, such as shredding files, calling tpm binary, generating secrets, disk unlock key, and most importantly generating in-memory key material.
These operations are crucial for the security and privacy and they should not be compromised by a lack of entropy or a weak random number generator. The reason for this problem is that the kernel needs to collect at least 4096 bits of entropy before it can initialize the CRNG, and the default entropy sources are not sufficient or fast enough to provide that amount of entropy at boot time.
To solve this problem, I have explored some possible options to increase the entropy sources and reduce the crng readiness time. These options are:
random.trust_cpu=1
and pass it as a command line parameter to skip the PRNG part of the boot process and use the CPU's hardware random number generator (e.g. RDRAND for x86 CPUs) as a source of randomness, without mixing it with other entropy sources. This will reduce crng readiness time by avoiding the entropy starvation problem. However, this may not be secure or trustworthy, as there is a possibility of a backdoor in the RDRAND implementation or the XOR instruction that could compromise the quality of randomness. Some experts recommend using RDRAND only as an additional entropy source, not as the sole one.cat /proc/sys/kernel/random/entropy_avail
.random.trust_cpu
after the crng is ready. This way, we could use the CPU as the sole source of entropy for CRNG initialization, but switch to other sources afterwards.To enable these options, we need to make some changes to the kernel configuration and command line parameters. These changes are:
CONFIG_ARCH_RANDOM=y
in the kernel configuration, and addrandom.trust_cpu=1
to the kernel command line.CONFIG_HW_RANDOM_TPM=y
in the kernel configuration, and addrng_core.default_quality=1000
to the kernel command line.CONFIG_CRYPTO_JITTERENTROPY=y
in the kernel configuration, and addkernel.jitterentropy.ll=10
,kernel.jitterentropy.ml=10
,kernel.jitterentropy.bs=64
, andkernel.jitterentropy.bc=16
to the kernel command line. These parameters control how much jitter is generated by different methods.CONFIG_HW_RANDOM=y
in the kernel configuration.I would like to hear your opinions and feedback on these options, and discuss which one is the best way forward for Heads.
As of today, crng is ready after tpm binary is called and after shredding some files. If one user is quick selecting menu options, the crng might not be ready when setting a TPM disk unlock key, while really improbable.
The goal here is to try to have crng ready as early as possible. Another option would be to wait for the entropy pool to full prior of leaving Heads init, but blocking is not pretty nor practical.
I propose:
random.trust_cpu=1
but impement all other changes and see how that goes.@JonathonHall-Purism @saper others? comments?
Some sources:
The text was updated successfully, but these errors were encountered: