What the review read and ran
An appendix to the milestone.
The crate
partsfoundry/jh7110_entropy at eac91efd0381cc4cd7556a53e512bcfb2eeaaf17, version 0.3.0-pre.2,
edition 2024, rust-version 1.85, no dependencies and no features. Read in full: Cargo.toml,
README.md, CHANGELOG.md and src/lib.rs up to its test module. Read for their shape only:
the 28 unit tests of src/lib.rs and the eight Kani harnesses of src/verification.rs. Listed
and not read: docs/ and falsifications/. The crate has no examples/, tests/ or fuzz/
directory.
The commands
The review ran each command in a copy of the clone on a Linux x86_64 host, with rustc 1.100.0 and the build directory outside the copy.
cargo buildpasses.cargo test: 28 unit tests and 3 doctests pass.cargo +1.85 test, the declared minimum: the same 28 and 3 pass.cargo doc --no-deps, and again withRUSTDOCFLAGS="-D warnings": both pass.cargo clippy --all-targetspasses with no warning.cargo build --lib --target riscv64imac-unknown-none-elf,aarch64-unknown-none-softfloatandx86_64-unknown-none: all pass.cargo package --list --allow-dirtylists 19 files: the manifest and lock files, the README, the changelog, the two licenses, one file ofdocs/, the eight falsification patches and the two source files. No repository scaffolding is in the list.grep -n must_use src/lib.rsfinds two lines, onPool::newandPool::remaining_bytes(P1-3).grep -rn 'pool ==\|== Pool' srcfinds nothing: no test or proof compares two pools (P0-5).grep -n Discovered src/lib.rsfinds the declaration and one mention in the crate documentation, and no function signature (P0-4).- The crate has no features, so there is no feature combination to build.
The comparators read
The review took each crate's .crate file from crates.io at the version the prior-art table
gives and unpacked it into a directory of its own. The download figures are the crates.io API's
on 2026-11-26 (UTC), asked for under the User-Agent release-review-lane. The searches were jh7110, starfive, trng,
hwrng, true random number generator, rng driver and hardware rng, sorted by recent
downloads.
rdrand0.9.0:RdRandandRdSeed(src/lib.rs) are unit-like structs made bynew() -> Result<Self, ErrorCode>orunsafe fn new_unchecked. Both implementrand_core0.10'sTryRngwithtype Error = ErrorCode, andTryCryptoRng.ErrorCode(src/errors.rs) hasUnsupportedInstructionandHardwareFailure, derivesDebug,CopyandClone, and implementsDisplayandcore::error::Error. One feature,std. License ISC.esp-hal1.2.3:rng::Rng(src/rng/mod.rs) derivesClone,Copy,DefaultandDebugand hasrandom() -> u32andread(&self, buffer: &mut [u8]), neither fallible.rng::Trng(src/rng/trng.rs) is made bytry_new() -> Result<Self, TrngError>while aTrngSourcelives;TrngErroris#[non_exhaustive]. Both implementRngCoreofrand_core0.6 and 0.9 andTryRngof 0.10 withError = Infallible. The three optional dependencies arerand_core-06,rand_core-09andrand_core-010, turned on by theunstablefeature.embassy-stm320.6.0:rng::Rng<'d, T>(src/rng.rs) owns the peripheral. It hasasync_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error>, blockingnext_u32,next_u64andfill_bytes, andresetandrecover_seed_error.ErrorhasSeedErrorandClockErrorand implements neitherDisplaynorcore::error::Error. It implementsRngCoreandCryptoRngofrand_core0.6 and 0.9, through dependencies renamedrand-core-06andrand-core-09.jh71xx-pac0.11.1:trng::RegisterBlock(src/trng.rs) is#[repr(C)]withctrl,stat,mode,smode,ie,istat, eightrand,auto_rqstsandauto_age, and reserved bytes from0x18to0x1Fand from0x40to0x5F; it ends at0x68.IstatimplementsReadableonly (src/trng/istat.rs).ctrlhas three one-bit fields,exec_nop,gen_randandreseed, at bits 0, 1 and 2 (src/trng/ctrl.rs).statgiveslast_reseedas eight one-bit fields at bits 16 to 23 (src/trng/stat.rs), where the crate under review has a three-bit field at bit 16.Peripherals::trngpoints at0x1600_c000(src/lib.rs). GPL-3.0-only.jh71xx-hal0.7.2: modules for clocks, DDR memory, delay, GPIO, I2C, the card controller, the phase-locked loops, PWM, SPI and the UART undersrc/, and none for the generator. GPL-3.0-only.nrf-hal-common0.19.0:rng::Rng(src/rng.rs) owns the peripheral, hasrandom(&mut self, buf: &mut [u8])and four integer methods, none fallible, and implementsRngCoreandCryptoRngofrand_core0.9.virtio-drivers0.13.0:VirtIORng<H, T>(src/device/rng.rs) owns its transport and hasrequest_entropy(&mut self, dst: &mut [u8]) -> Result<usize>.rand_core0.10.1:TryRng(src/lib.rs) hastype Error: core::error::Error,try_next_u32,try_next_u64andtry_fill_bytes(&mut self, dst: &mut [u8]) -> Result<(), Self::Error>;Rngis its infallible form, andTryCryptoRnga marker.block::Generator(src/block.rs) hasgenerate(&mut self, output: &mut Self::Output)and adrophook for the output buffer.block::BlockRng<G>derivesClone, has aDebugthat leaves out its results, and hasnext_word,next_u64_from_u32andfill_bytes.
The systems outside Rust
- Linux v6.12,
drivers/char/hw_random/jh7110-trng.c(397 lines, fetched from the tagged raw address; SHA-2561cc7ced32bca61dd21e0b2c98c6cf423ac8f253235fc27ea19b6b007c591cc7f).struct starfive_trngholds the base, two clocks, the reset and two completions.starfive_trng_wait_idlepollsSTATuntil neitherRAND_GENERATINGnorRAND_SEEDINGis set.starfive_trng_cmdwritesSTARFIVE_CTRL_GENE_RANDNUM(1) orSTARFIVE_CTRL_EXEC_RANDRESEED(2) toCTRLand waits for a completion, up to 1 ms, or 40 microseconds when the caller will not wait.starfive_trng_initwrites the two automatic reseed registers, clearsISTAT, enables the interrupts, sets the output width and reseeds.starfive_trng_irqacknowledges eachISTATbit by writing it back and reseeds onLFSR_LOCKUP.starfive_trng_readclamps to 32 or 16 bytes by the mode, issues a generate and copies withmemcpy_fromio. The file definesSTARFIVE_STAT_SEEDEDand never reads it. GPL; read for its interface shape only.
The benchmark
A scratch crate depending on the crate's copy by path and on rand_core = "=0.10.1", built with
cargo build --release and run three times. The source of both sides is one counter that adds
0x9E37_79B9 for each of eight u32 words, passed through black_box. Each row starts at 64
repeats and doubles until a pass lasts 50 ms. It then runs seven passes and reports the lowest
divided by the repeats, with black_box on the output slice and on each result.
Poolinto a slice:Pool::take_intoon a slice of 8, 32 or 1024 bytes. The generator callsgeneration_outcomeon a seeded, ready, 256-bit snapshot of the counter's words and returns the bytes ofReady. The figure includes that decode, the copy and the zeroing of each byte.BlockRnginto a slice:BlockRng::fill_byteson a slice of the same length, over aGeneratorwithOutput = [u32; 8]that stores the counter's words.- One
u64:Pool::take(8, ..)with a generator that returnsoutput_bytesof the counter's words, againstBlockRng::next_u64_from_u32. generation_outcomealone: one call on the ready snapshot, withblack_boxon each argument.
The per-byte figure in the block is the 1024-byte row divided by 1024.
What was not run
- No benchmark on the device: the host figures measure the pool and the decode against memory.
- No benchmark of a ranked comparator:
rdrandmeasures a processor instruction, andesp-halandembassy-stm32need their own chips. cargo build --lib --target riscv64gc-unknown-none-elf: the target is not installed on the host.- Kani, mutation testing and the falsification patches were not run.
- NetBSD's
sys/arch/riscv/starfive/jh7110_trng.cand the device-tree binding were not read.