On this page

0262. OS entropy fill plugin

Context

ADR-0205 requires direct OS entropy for bearer credentials, sharing the port in ADR-0200 without OpenSSL or weak fallback. ADR-0243:49 moves hosting's entropy need off the deferred R3b signing path but supplies no port. The unchanged hosting requirements still need it. The platform/native and interpreter trees are frozen for Forge P4. ADR-0247 prohibits implementing cryptography in Harness; reading OS entropy is not implementing cryptography.

Decision

Provide plugins/entropy via FFI (ADR-0151) for fills of 1..1024 bytes. Linux uses getrandom with flags 0 (blocking until initialized); macOS uses getentropy. Unsupported platforms fail at compile time. No fallback or fabricated bytes are allowed. Reads are at most 256 bytes, retry interruptions and short reads, and count every call toward a 64-call bound. Exhaustion fails even if the 64th call completes the fill. Wipe and free partial buffers on every failure.

A data-driven test hook injects errors or shortens real OS reads; it never fabricates bytes. It is for testing only.

Alternatives considered

Consequences

Consumers must admit ffi in their capability ceiling. The interpreter needs a C compiler for its FFI host (ADR-0152). Platforms other than Linux and macOS cannot build this plugin.