feat(libSceLibreSsl3): implement OBJ_cmp #10631
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10631"
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 MarcZX10 on 2026-10-24T13:43:47Z.
What
Implements
OBJ_cmpin libSceLibreSsl3 following the public LibreSSL source: objects are compared by encoded length first (the difference is returned) and then byte by byte, returning the difference of the first differing unsigned bytes. The 40-byte LP64ASN1_OBJECTlayout is the one used by #10461. Null objects, null data with a nonzero length and negative lengths throw. LibreSSL subtracts unequal lengths before reading data, so unequal negative lengths do not necessarily fault; only equal negative lengths reach its byte comparison. PS5 behavior and the module's LibreSSL version are not verified; the debt entry says so, including that the magnitude of a byte mismatch is the byte difference rather than whatever the console'smemcmpreturns.Commits: implementation, test, debt entry.
Tested
Linux x86-64, GCC, full CMake build (Ninja, Release).
guest_libressl3_obj_cmpcovers equal encodings, the first differing byte in both directions, the length difference taking precedence, bytes above 0x7f compared as unsigned, empty encodings that must not read data, and the three rejected inputs. The host CPU (Xeon E5-1620 v2) fails the startup CPU-feature gate, so I ran the test with that check disabled in a local, uncommitted edit; it exits 0.tools/check_conventions.pyandgit diff --checkpass. After review, I added negative-length mismatch andINT_MINregressions and compiled the exact production source plus focused test with GCC C++20-Wall -Wextra -Wpedantic -fsanitize=undefined -fno-sanitize-recover=undefined; the test passes. The prior implementation triggered UBSan signed overflow forINT_MINversus length 1. No title or GPU involved. Open PRs #9970, #10452, #10461, #10490, #10491, #10493 and #10557 touch shared CMake/debt insertion points. This PR will land after #10493 and #10557 and rebase to retain their source-list and debt entries; #10493 carries the preceding LibreSSL dependency chain. #10461 is the source of the 40-byteASN1_OBJECTlayout used here. I am coordinating the order with #10493’s author; #10557 is also mine and will be rebased after #10493.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 harisibrar1 on 2026-10-24T15:34:10Z.
Review: COMMENTED
Checked against main
b607bfdc8band LibreSSL 4.0.0 (libressl-v4.0.0tag, objects/obj_lib.c and asn1/asn1_local.h):OBJ_cmpat 4.0.0 (obj_lib.c:125-134): length difference first, 0 for empty encodings without readingdata, then unsigned bytes. The 40-byte layout and the offsets in the static_assert matchstruct asn1_object_stin asn1_local.h:74-80. (Discussion #8981 places libSceLibreSsl3 at LibreSSL 4.0.0, if you want to cite a version in the debt entry.)OBJ_cmpis defined inobjects/obj_lib.c, notobj_dat.c, so the link in the debt entry and the description points to the wrong file.a->length - b->lengthbefore reading data, so for lengths -1 and 0 it returns -1 rather than faulting; only equal negative lengths reachmemcmp. Throwing for any negative length seems fine to me (andthrows(&negative, &empty)pins it), but could the sentence say exactly that?git merge-tree, no conflicts), and main still has theOBJ_cmpstub (Export.cpp:223), so there's no duplication.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T04:57:47Z.
Review: COMMENTED
Reviewed — include request met, one reported failure unverified
The
ObjCmp.cppinclude request is met at this head, and the only open point is a test failure reported on an older head.What I ran
Live head
79d5bea103f9255b457ed835314d26209fe4895a(matches batch).gh pr viewforstatusCheckRollup;gh apireads of comments;git show <head>:<path>onObjCmp.cppandApi.hpp;git logonObjCmp.cpp. Nothing was built or run.Results
guest_libressl3_obj_cmpis not in this resultFindings
ObjCmp.cpp:6includesprx/libSceLibreSsl3/include/Api.hpp, andApi.hpp:51declaresOBJ_cmp_nid_postfix. The include came in commit79d5bea103by Dean Galvin (oneandonlydean), a fix-up pushed to this branch.13f4b3d7e43, not this head. It saysguest_raise_exceptionfailed on the reporter's machine and also fails onmain0a570f617d8. I did not run it. I cannot confirm the failure or the main comparison.Sources
github.com/boykopovar/AnyPS5@79d5bea103/core/libs/prx/libSceLibreSsl3/src/ObjCmp.cpp (L6)github.com/boykopovar/AnyPS5@79d5bea103/core/libs/prx/libSceLibreSsl3/include/Api.hpp (L51)Not verified
guest_raise_exceptionfailure and its comparison withmain.guest_libressl3_obj_cmpon this head.