feat(libSceLibreSsl): implement OBJ_obj2nid for objects with a known NID #10571
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10571"
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-24T10:23:51Z.
What
Implements
OBJ_obj2nidin libSceLibreSsl for the cases that need no object identifier table, following LibreSSL 2.5.4's obj_dat.c: a null object returnsNID_undef, an object whosenidis set returns it, and an object withnid == NID_undefand no encoded bytes follows the 2.5.4 table search toNID_ccitt(404). An object known only by its encoded bytes throws throughNotImplemented_nid_no_patch, since the table is not present.The 40-byte LP64
ASN1_OBJECTlayout is the one used by #10461. PS5 behavior has not been independently measured.Commits: implementation, test, debt entry.
Tested
Linux x86-64, GCC. Full CMake configuration is blocked in this isolated checkout because the SDL2 submodule is not populated and XRandR is unavailable. Compiled
ObjNid.cppandGuestLibreSslObjNid.cppdirectly with-std=c++20 -Wall -Wextra -Werror, linked a small shim forNotImplemented_nid_no_patch, and ran the test successfully. The test checks the 404 empty-object result, stored-NID and null cases, and the unsupported encoded-byte path. The CTest registration was not run through CMake.tools/check_conventions.pyandgit diff --checkpass. The overlap check script could not parse the current GitHub PR response; existing overlap reports identify shared LibreSSL build/debt files, and this PR now declares its order after #10570.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-24T12:29:26Z.
Review: COMMENTED
Checked against main
87666fc5d6and LibreSSL 2.5.4 (obj_dat.c / obj_dat.pl at 2e2c612, and the generated crypto/objects/obj_dat.h and include/openssl/obj_mac.h from the libressl-2.5.4 release tarball):nid != 0paths and the 40-byte layout match 2.5.4, and throwing for objects that only have encoded bytes looks right to me.length == 0 → NID_undefbranch (ObjNid.cpp:168) matches 2.5.4. Withnid == 0,OBJ_obj2nidfalls through toOBJ_bsearch_obj, andobj_cmpcompareslengthfirst. obj_dat.pl gives single-arc OIDs length 0, so the generatedobj_objsstarts with six length-0 entries (0, 181, 393, 404, 645, 646), andNUM_OBJis 890. The bisection probes 445, 222, 111, 55, 27, 13, 6 and then 3, so an empty object (e.g. a freshASN1_OBJECT_new()) matchesobj_objs[3]and returns 404 (NID_ccitt), notNID_undef. I couldn't run this on a console; it comes from reading the source and the generated table (the zero-lengthmemcmpon NULL pointers is formally UB but returns 0 in practice). Could this case throw like the encoded-bytes case, or return 404 with that source cited? The test at GuestLibreSslObjNid.cpp:206-207 and the debt sentence would need updating to match.libSceLibreSsl/CMakeLists.txt, insert their test blocks at the same place, and edit the same debt count line, so whichever merges second will need a rebase, and the count should end at 354.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
Pull request closed