Repository navigation
Conversation
The SEP hwrng registers with quality 1024. That tells the hwrng core that every bit read is fully random, so the core credits all of it to the kernel's entropy pool. This change is a policy choice, not a fix for a known weakness. Nothing shows that the enclave's output is weaker than 1024 claims. Nothing public shows that it is as strong either: there is no analysis of its noise source, or of how its firmware conditions the output before it reaches the mailbox. The policy proposed here is that a source with no such analysis does not get full credit by default. 900 is the value most SoC TRNG drivers declare under that policy, without a measurement of their own (omap-rng, stm32-rng, mtk-rng and others). What changes: the pool is credited 900/1024 of the bits the SEP gives. The device still feeds the pool at the same rate, and is still chosen as the current hwrng when it is the only one. An administrator who trusts the source can set rng_quality back to 1024 through sysfs. If the maintainers prefer to trust the SEP by default, this patch can be dropped; nothing else depends on it. Checked by reading drivers/char/hw_random/core.c: quality is clamped to min(default_quality, 1024, quality) at registration and scales the credit in hwrng_fillfn(). The kernel Rust code was not compiled here. Signed-off-by: Alyx-ML <256263590+Alyx-ML@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the #2755 split. Draft until it has a run on a Mac (the last Evidence line says which). RyanTheTide asked for this to be separate and stated as policy.
Summary
This is a policy choice, not a fix for a known weakness. 900 is what omap-rng, stm32-rng, mtk-rng
and others declare under the same policy.
rng_qualityin sysfs can set it back to 1024. If youwould rather trust the SEP by default, close this; nothing depends on it.
Evidence
drivers/char/hw_random/core.c: quality is clamped at registration and scales thecredit in
hwrng_fillfn(). Build: passed, Apple build and KUnit, SEP source checks.rng_qualityin sysfs reads 900.Merge Danger
Door: two-way
Blast Radius: entropy accounting
The core picks the source with the highest quality, so another source declaring more than 900
would now be chosen over the SEP.
Assisted-by: LLM (Claude:Opus 5.5)