feat(libSceLibreSsl): implement X509_NAME_get_entry and X509_NAME_ENTRY_get_data #10477
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10477"
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 alvaroelpob on 2026-10-24T02:42:20Z.
What
Implements
X509_NAME_get_entryandX509_NAME_ENTRY_get_datain libSceLibreSsl, which threw and were declared without parameters.The module is LibreSSL 2.5.4 (firmware 13.40 measurements in #8981). Signatures, layouts and results follow that release's
x509.h,x509name.candstack.c:X509_NAME_ENTRY* X509_NAME_get_entry(X509_NAME*, int loc)loc, a null entry stack (sk_numis -1) orloc >= num; otherwiseentries->data[loc]ASN1_STRING* X509_NAME_ENTRY_get_data(X509_NAME_ENTRY*)valueThe layouts are 40 bytes for
X509_NAME(entriesat 0), 24 forX509_NAME_ENTRY(object,value,set,size) and 32 for_STACK(num,data,sorted,num_alloc,comp). They were checked withstatic_asserts and againstoffsetoffrom the 2.5.4 headers compiled on x86-64. A positive entry count with a null entry array, which LibreSSL dereferences, throws. No export of this module creates a name yet, so for now only names built by the caller reach these functions.The 2.5.4
_STACKlayout ismain'sLibreSslStackfrom #10373. This PR reads it through that struct and changes none of thesk_*exports.The debt entry records the source and what is unverified, and the pending-export count drops from 357 to 355.
Tested
Ubuntu 26.04 (WSL2, kernel 6.18), GCC 15.2.0, Release, full build with
BUILD_TESTING=ONonmaindb6af9e0f. There is one commit per function, and each adds that function with its test block and debt update. Each was built and itsguest_libressl_x509_nametest andcheck_conventions.pyrun on its own.guest_libressl_x509_nametest.X509_NAME_get_entryreturns null for a null name, a null entry stack, indexes -1,INT_MIN,INT_MAXandnum, and an empty stack. It returns the first and second entries of a two-entry stack, and a null slot as null. A null entry array throws, unless the index is out of range.X509_NAME_ENTRY_get_datareturns null for a null entry or a null value, and otherwise the value, whateverobjectandsethold.ctest -j16at the last commit: 2005/2006 pass.agc_driver_multisample_retirementfails the same way onmainon this machine.main1e740a23a3(after #9033), head 448392a96b: the conflicts were only theadd_librarysource list, the end of the test block, the pending-export count and the last debt entry; both sides are kept and the count is 357 minus this PR's exports. Full build andctest -j16: 2043/2044 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.maine7e3e9c198, head73b11e79a7, to resolve the conflict from #9529 on the sharedCMakeLists.txtand debt-file lines; both sides are kept and the count is 353 minus this PR's exports.73b11e79a7(refactor(libSceLibreSsl): declare the X509_NAME exports in the public header) puts the real signatures and their structs inlibSceLibreSsl/include/Api.hppand drops the test's redeclarations, whichpublic_headersrequires since #10706. Full build andctest -j16: 2202/2203 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.mainae7d59258e(after #9949), headaa4fd175d5, to resolve the conflicts withmainon the sharedCMakeLists.txtand debt-file lines; both sides are kept and the count is 342 minus this PR's exports. Full build andctest -j16: 2275/2276 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.main88795ed448(after #10248; head 06e8626898) to resolve the conflicts on the shared debt-file lines; both sides are kept and the count is 335 minus this PR's exports. Full build andctest -j16: 2383/2384 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.mainc7b4878fa8(after #10373, #10376 and #10449), head 0d079a6d82, to resolve the conflicts withmainon the sharedCMakeLists.txt,Api.hppand debt-file lines; both sides are kept and the count is 319 minus this PR's exports. The rebase drops this PR's copy ofLibreSslStackfromApi.hpp, and its twostatic_asserts inX509Name.cpp, sincemainnow declares the same struct (withcomptyped asStackCompare) and asserts its layout inStack.cpp. Full build andctest -j16: 2394/2395 pass;agc_driver_multisample_retirementfails the same way on thatmain, andguest_pthread_starttimed out once at 20 s while another full suite shared the machine; run alone with--repeat until-fail:3it passes 3/3 in about 2 s.check_conventions.py --base upstream/mainpasses.main474030e584(after #13562), head 63a6ee75dc, to resolve the conflict on the pending-export count in the debt file; the count is 292 minus this PR's exports. Full build andctest -j16: 3062/3062 pass.check_conventions.py --base upstream/mainpasses.maincf79276fee(after #13820), head1fe82b5b65, to resolve the conflict on the pending-export count in the debt file.mainstill says 292 although #13820 removed two stubs, leaving 290, so the count is now set to the 288 stubs left inExport.cpp. It also restores the PS5 3.20 export table link,b2a77c09cd71c01f34c790cfbe98c751a13262ad, which the previous rebase had written without its zeros. Full build andctest -j16: 3107/3107 pass (log_filefailed once on #10486 and passed on five reruns and a second full run).check_conventions.py --base upstream/mainpasses.main4939814d79(after #9970, #10078 and #10488), head 886b309bda, to resolve the conflicts on the sharedCMakeLists.txt,Export.cpp,Api.hppand debt-file lines; both sides are kept. The count is set to the 259 stubs left inExport.cpp. Full build andctest -j16: 3538/3538 pass.check_conventions.py --base upstream/mainpasses.main4f41f4c375, head 2417a2f231, to resolve the conflicts on the sharedCMakeLists.txt,Export.cppand debt-file lines; both sides are kept and the debt count is recomputed fromExport.cpp. Full build andctest -j16: 3796/3800 pass;guest_sce_net,guest_poll,guest_select_waitandguest_memoryfailed under that load, pass when run alone, andmain4f41f4c375passes all 3799 with-j16on the same machine.check_conventions.py --base upstream/mainpasses.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 copilot-pull-request-reviewer[bot] on 2026-10-24T02:44:14Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T16:00:00Z.
Review: APPROVED
Reviewed both X509_NAME accessors against the cited LibreSSL 2.5.4 layouts and stack behavior. The entry-count/data-array checks preserve the null/out-of-range behavior described, and the data getter returns only the entry's value field; the focused tests cover boundary and null-slot cases. The current head merges cleanly with upstream main; conventions and diff checks pass. I compiled and ran
GuestLibreSslX509Name.cppwithX509Name.cppdirectly using GCC 12.2.0; it passed. The broader Linux suite is author-reported; hosted product jobs are skipped.Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-10-25T18:06:23Z.
Review: APPROVED
Reviewed head
d63afe313c, merged locally onto main7a25f87620. Linux, GCC 13.3, Release.What I ran:
guest_libressl_x509_nameon the merged tree: pass.X509Name.cpp: main's stub bodies,num < locinstead ofnum <= loc, noloc < 0check, andentry->objectinstead ofentry->value. The test fails on each.107a5b52..., matches the published SHA256): every field ofX509_NAME,X509_NAME_ENTRYand_STACKhas the same offset and size asLibreSslX509Name,LibreSslX509NameEntryandLibreSslStack(40/24/32 bytes).OPENSSL_NO_BUFFERonly switchesbytesbetween two pointer types.libSceLibreSsl.prxand passed real 2.5.4X509_NAME*values straight to both exports. I compared them with 2.5.4's own calls forlocinINT_MIN, -2, -1, 0..count+1, INT_MAX, andget_dataon every entry. The names were a null name, an empty name, API-built names (multi-valued RDNs, 40 entries, 38 after deletes) and subjects/issuers parsed from DER certs with 1, 3, 6 (multi-valued) and 11 entries. 363 comparisons, 0 mismatches.num > 0with a nulldataarray: 2.5.4 segfaults forloc0..num-1 and returns NULL outside that range. This PR throws for the samelocvalues and returns NULL for the rest. That matches the debt entry.Sources: 2.5.4
x509name.cX509_NAME_get_entry/X509_NAME_ENTRY_get_data,stack.csk_num/sk_value,x509.h,stack.h.LGTM. One heads-up: the branch now conflicts with main in
docs/dev/debt/libSceLibreSsl.mdonly. Main reworded the MD4..SHA512 entry next to your count line, so CI needs a merge first.Not checked: the console, and whether the module really is 2.5.4. I relied on the #8981 measurement for that, as the debt entry does.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T08:59:38Z.
Review: CHANGES_REQUESTED
Re-check — changes requested\n\nThe new report is useful: it says the implementation functions were preserved through the merge and the full test suite has the same single known failure as its tested main, with conventions passing. However, the tested integration point is
4c7d275bef; current upstream main isaaccd0ba39, and this PR head is 44 commits behind it.\n\nPlease update onto current main, preserve the implementation and debt-count changes, recount the pending exports against the resulting Export.cpp, and rerun the relevant LibreSSL tests plus conventions on the exact updated head. The earlier approval was for the prior head and does not cover this stale integration point. I did not rerun these checks locally.Pull request closed