feat(libc): implement srandomdev using host entropy #8730
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8730"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-20T22:40:00Z.
What
Add the missing
srandomdevexport (NIDa2MOZf++Wjg) named in the firmware 3.20 libSceLibcInternal inventory. It fills the activerandom()state with host OS entropy and resets additive feedback positions, following FreeBSD 11 random.c. It shares the existing generator lock, state and entropy provider. Console parity is unverified and recorded in technical debt.Tested
Windows 11, WinLibs GCC 15.2.0: all 133 tests registered under
core/libs/prx/libcpass. WSL Ubuntu 26.04, GCC 15.2.0: all 111 tests registered undercore/libs/prx/libcpass, including both focused random tests. The new test fails to link on the original source becausesrandomdev_nid_postfixis absent; it passes after the implementation.Deterministic entropy injection covers all five generator sizes, an unaligned state, complete word filling, untouched header and guards, reset positions, no warm-up, linear-generator output and propagated entropy failure. The shared-library test also uses real OS entropy for every state size. No title run or console measurement.
tools/check_conventions.py --base origin/mainpasses. Rantools/pr_overlap.py --branch codex/libc-srandomdev-20261020; no competing export or confirmed merge conflict remains. Manually reviewed the stale shared-file PR diffs reported as uncompared: they change other behavior or reorganize tests, and do not implementsrandomdev.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T22:48:51Z.
Review: APPROVED
Reviewed the current diff.
srandomdevsharesg_randomLockand the active state, fills the generator words after the type header through the existing OS entropy provider, and resets the additive front/rear positions without changing generator type. The tests exercise all five state sizes, unaligned state storage, guards/header preservation, feedback reset, linear-state output and entropy failure propagation. The author reports complete libc suites passing on Windows and Linux, with macOS relinker/write-watch and sanitizer checks also green; full platform build jobs are skipped. Console parity remains explicitly unverified. Approval is based on the focused implementation and reported test coverage. AI-assisted review.