test(libSceLibreSsl): guard SHA padding and digest output extents #14283
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14283"
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 StoneDC on 2026-11-01T06:18:41Z.
What
Guards SHA-256 and SHA-512 input, existing context storage and exact 32/64-byte digest outputs. Twenty message lengths cross the 56/64-byte and 112/128-byte padding boundaries, with five update chunk sizes per algorithm. Existing known-answer tests use ordinary arrays and canaries.
Implementation basis: SHA-256/SHA-512 digest semantics follow FIPS 180-4; literals were generated independently with Python hashlib for the stated deterministic byte pattern. Tests use the canonical Sha256Context/Sha512Context declarations and actual Init/Update/Final functions without introducing a layout. FIPS 180-4.
Known limits: Does not validate a firmware context layout, EVP private fields, side channels or other digest algorithms.
Source and canonical declarations: core/libs/prx/libSceLibreSsl/src/Digest.cpp; core/libs/prx/libSceLibreSsl/include/Api.hpp.
One independent commit
e5ea5512af20f4b35d0c8f546ceea6e3d0a53ed8on synchronized main588f2f6fe3a41f795bc4143b2369e4bee7b26605. A final merge check against main3ee28266a3eea1f59d7ecead00b1e760f778ccacpassed. The repository overlap checker against3ee28266a3eea1f59d7ecead00b1e760f778ccacreported no confirmed overlap. It could not finish full-branch comparisons for older PRs already conflicting with main: #9446, #9448, #10078, #10418, #10508, #10570, #11003, #11128, #11129, #11138, #11143, #11146, #11151, #11175, #11176, #11359, #11466, #12729, #12730, #13266, #13285, #13546, #13547, #13877. Shared-file diffs were inspected separately. 22 scoped file changes projected onto main and then combined with this topic without a new conflict; 2 scoped peer changes already conflict with main and are not claimed automatically mergeable. They do not supply this boundary-test matrix. The target and fixture are self-contained and use APIs already on main; no other PR must land first. Shared registration changes made before landing require a refreshed merge/test check. No new production exports, ABI layouts, dependencies or production behavior changes are introduced.Tested
Exact topic head:
e5ea5512af20f4b35d0c8f546ceea6e3d0a53ed8. Product validation used integratione793e5fbb89451d5daf6d1d7783b8b6dc909a019, containing all ten independent topic heads and current main3ee28266a3eea1f59d7ecead00b1e760f778ccac. Ubuntu/WSL GCC 15.2; Windows MinGW GCC 15.2; both C++20.This registered fixture exercises the actual library through canonical headers, with OS-protected/read-only pages: 200 cases passed on each platform. Linux and Windows each passed all 10 new tests and 10 related existing tests, with zero skips. New-test command:
ctest --test-dir <build> -R '^(guest_random_extent|guest_zlib_window|guest_jpeg_encode_capacity|guest_png_input_extent|guest_jpeg_input_extent|guest_digest_extents|guest_unicode_extents|guest_icu_version_extents|guest_outline_bounds_extents|guest_rtc_parse_extents)$' -j 8 -V --output-on-failure. Each new test has a 20-second timeout and completed below 1 second locally.cmake --build <linux-full-build> --parallel 8: complete default Linux product build passed. Windows used the full configuration, built the ten new and ten related test targets plus relinker with--parallel 8, and ran both filtered CTest groups; a complete default Windows build is not claimed.Fault-detection control on Linux: exact fixture head
e5ea5512af20f4b35d0c8f546ceea6e3d0a53ed8, module contextced276fb83b0404be919f0597b2d030f42c7ae13. The complete production source unit was compiled and linked into the actual shared module using the product compile/link commands and its other unchanged module objects. The registered fixture passed with that unchanged module and failed after this deliberate defect inSHA256_Final_nid_postfix:digest[32] = 0;. This is a separate module-injection control, not PS5 execution.Conventions (including this body), whitespace, test registration and public-header declaration/umbrella audits passed. No PS5 hardware, game-title, macOS, WASM or GPU runtime validation is claimed. Hosted CI is not a local result and is pending when this PR opens.
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-11-02T06:45:02Z.
Review: COMMENTED
Reviewed — no blocking findings
This is a test-only change: a guarded-memory test for the SHA-256 and SHA-512 exports of
libSceLibreSsl. The input, the context and the digest output sit between guard pages, and the test covers the padding cases. The Windows CTest run passedguest_digest_extents.What I ran
e5ea5512af20f4b35d0c8f546ceea6e3d0a53ed8; base3a1457d34f4eb9d61b448677a2bab712eecbbf9c. 2 files:core/libs/prx/libSceLibreSsl/CMakeLists.txt(registersguest_digest_extents) andcore/libs/tests/GuestDigestExtents.cpp(143 lines, new).mainin full and the last 14 lines of the check helper. The helpers above them (the guarded-buffer class and the per-hash check) were not read in full.guest_digest_extents(Test #2305, 0.01 s). The run reports 2577 of 2577.Results
mainruns both hashes; the helper's end compares the digest and checks the input is unchangedPrefixon each buffer after the callguest_digest_extents(hosted, Windows)Test #2305, 0.01 smprotectguard pages)Read-only check output
Precheck was not run: no PR-head code is run here. Diff check: passed. Conventions: passed. ABI audit: not applicable. Stack check: passed. Hosted:
gh api repos/boykopovar/AnyPS5/commits/e5ea5512af20f4b35d0c8f546ceea6e3d0a53ed8/check-runs, and the Windows job log.Negative control
Not run here. A negative control needs a local build, and code from this head is not run here.
Findings
Blocking
None.
Non-blocking
None.
Sources
github.com/boykopovar/AnyPS5@e5ea5512af/core/libs/tests/GuestDigestExtents.cppgithub.com/boykopovar/AnyPS5@e5ea5512af/core/libs/prx/libSceLibreSsl/CMakeLists.txtwindowsone5ea5512afNot verified
main(not read in full).To get this to a good state