feat(libressl3): implement CRYPTO_memcmp #8956
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8956"
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 ynkmyz233 on 2026-10-21T07:04:19Z.
What
libSceLibreSsl3'sCRYPTO_memcmpcurrently throws for every call. Implement the public LibreSSL contract: compare exactlylengthbytes, returning zero for equality and nonzero otherwise. Volatile unsigned-byte reads accumulate differences without a content-dependent early return. Update technical debt to retain the unverified PS5 behavior and toolchain-dependent timing guarantees.Tested
Windows x86-64, MinGW-w64 GCC 15.2.0, Release build:
guest_crypto_memcmpCTest.tools/pr_overlap.py --repo boykopovar/AnyPS5 --branch feat/libressl3-crypto-memcmpreported no overlap with open pull requests.PS5 hardware, other platforms, commercial titles, and the full test suite were not tested. Other toolchains still require generated-code inspection.
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-21T07:08:03Z.
Review: APPROVED
Reviewed the implementation and tests against the documented CRYPTO_memcmp contract. It checks exactly the requested range, returns zero/nonzero as required, has no content-dependent early exit, and documents the toolchain timing caveat. The guard-page and boundary tests are useful, and all current GitHub checks pass.
Imported from boykopovar/AnyPS5. Originally posted by r1p0N on 2026-10-21T07:29:02Z.
Reviewed and ran the new test standalone (Export.cpp + GuestCryptoMemcmp.cpp, g++ 13, -O2 and ASan/UBSan): passes, no sanitizer findings.
Semantics match LibreSSL's CRYPTO_memcmp: 0 when equal, nonzero otherwise (not a sign), no early exit, reads through volatile.
Zero length with null pointers returns 0 without dereferencing; the guard-page test confirms no reads past length.
The new CMakeLists.txt duplicates the default rule in core/libs/CMakeLists.txt (same Export.cpp, include dir, unwind) and only adds the test, as libSceOpusDec does.
LGTM from my side. Not covered: full ctest, Windows.
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-21T17:06:38Z.
Heads-up (support triage): #9043 ("feat(libSceLibreSsl3): implement MD5, SHA1 and CRYPTO_memcmp") also implements
CRYPTO_memcmpforlibSceLibreSsl3and will conflict with this PR inExport.cpp. Your PR is ~3.5 hours older. Please agree which lands first and declare it withDepends onon the checklist line.