Skip to content

soc: apple: sep: credit the enclave RNG at 900, as a policy - #2996

Draft
Alyx-ML wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
Alyx-ML:aurora/sep-hwrng-quality
Draft

Alyx-ML wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
Alyx-ML:aurora/sep-hwrng-quality

Conversation

@Alyx-ML

@Alyx-ML Alyx-ML commented Nov 23, 2026

Copy link
Copy Markdown

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

-pub(crate) const QUALITY: c_ushort = 1024;   # every bit counted as fully random
+pub(crate) const QUALITY: c_ushort = 900;    # no public analysis of the source: less than full credit

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_quality in sysfs can set it back to 1024. If you
would rather trust the SEP by default, close this; nothing depends on it.

Evidence

  • Checked in drivers/char/hw_random/core.c: quality is clamped at registration and scales the
    credit in hwrng_fillfn(). Build: passed, Apple build and KUnit, SEP source checks.
  • Needed before merging: a boot on a Mac, where rng_quality in 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)

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant