feat(libSceLibreSsl): implement X509_get_issuer_name, X509_get_subject_name and X509_get_serialNumber #10478
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10478"
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:46:13Z.
What
Implements
X509_get_issuer_name,X509_get_subject_nameandX509_get_serialNumberin 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.handx509_cmp.c:X509_NAME* X509_get_issuer_name(X509*)cert_info->issuerX509_NAME* X509_get_subject_name(X509*)cert_info->subjectASN1_INTEGER* X509_get_serialNumber(X509*)cert_info->serialNumberThe layouts are 176 bytes for
X509(cert_infoat 0) and 104 forX509_CINF(serialNumberat 8,issuerat 24,subjectat 40). They were checked withstatic_asserts and againstoffsetoffrom the 2.5.4 headers compiled on x86-64. LibreSSL dereferences the certificate and its info without checking them, so a null for either throws. No export of this module creates a certificate yet, so for now only certificates built by the caller reach these functions.The debt entry records the source and what is unverified, and the pending-export count drops from 357 to 354.
Tested
Ubuntu 26.04 (WSL2, kernel 6.18), GCC 15.2.0, Release, full build with
BUILD_TESTING=ONonmain379b1dca3. There is one commit per function, and each adds that function with its test block and debt update. Each was built and itsguest_libressl_x509test andcheck_conventions.pyrun on its own.guest_libressl_x509test. Each getter returns null while its field is null and then returns its own field, not a neighbour: issuer versus subject, serial number versus version. A null certificate and a null certificate info throw in all three.ctest -j16at the last commit: 2005/2006 pass.agc_driver_multisample_retirementfails the same way onmainon this machine.main1e740a23a3(after #9033), head 6d3755d4d7: 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, head 190f012bc5, 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. 190f012bc5 (refactor(libSceLibreSsl): declare the X509 name and serial 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), head 6a3402ef61, 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.main2dbe9b99f5(after #9745, #9870 and #11111), head 5458e6f643, to resolve the conflicts withmainon the sharedCMakeLists.txtand debt-file lines; both sides are kept and the count is 340 minus this PR's exports. Full build andctest -j16: 2370/2371 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.main88795ed448(after #10248; head 4fa2d55578) 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 0c05e03eab, 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. Full build andctest -j16: 2394/2395 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.main474030e584(after #13562), head 3462b50cc5, 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), head a30919457a, 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 287 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 c9ce4296b7, 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 258 stubs left inExport.cpp. Full build andctest -j16: 3538/3538 pass.check_conventions.py --base upstream/mainpasses.main4f41f4c375, head 4002ce1244, 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:50:26Z.
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-24T15:59:36Z.
Review: APPROVED
Reviewed the three X509 accessors against the cited LibreSSL 2.5.4 layouts. The certificate-info member offsets match the static assertions, including the 64-bit ASN1_ENCODING length needed to keep those offsets, and the null certificate/info paths are covered. The current head merges cleanly with upstream main; convention and diff checks pass. I compiled and ran
GuestLibreSslX509.cppwithX509.cppdirectly using GCC 12.2.0; it passed. The broader Linux test results are author-reported; hosted product jobs are skipped.Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-10-25T18:08:23Z.
Review: APPROVED
Reviewed head
79c3000fa8merged onto main7a25f87620. Only the debt file conflicts (the usual pending-count line); taking main's side with the count at 342 matches the 342 stubs left inExport.cpp. Linux x86_64, GCC 13.3, Release.What I ran:
guest_libressl_x509and the otherguest_libressl_*tests on the merged tree: all pass..subject, serial returning.version, and dropping the nullcertInfocheck each makeguest_libressl_x509fail.tools/check_conventions.py --base origin/main: pass.107a5b52...336efa, matches ftp.openbsd.org):sizeof(X509)176,sizeof(X509_CINF)104,sizeof(ASN1_ENCODING)24,cert_info0,serialNumber8,issuer24,subject40,enc80. Same as the static_asserts. The only#ifdefinx509_stisOPENSSL_NO_SHAaroundsha1_hash, which 2.5.4 doesn't define, and it sits after every field read here anyway.d2i_X509(RSA and EC, v1 and v3, serials 0, 1, 0xFF and a 20-byte one, plus a leaf whose issuer differs from its subject) and called the PR's exports on the sameX509*. All three pointers equal 2.5.4'sX509_get_*for every cert, and names and serial bytes read back correctly through them.Source: 2.5.4
x509_cmp.cL148-177 returna->cert_info->issuer/subject/serialNumberwith no null check, so throwing on a null cert or cert info fits the rules. The struct fields matchx509.hL251-264 andasn1.hL246-250 (long len, soint64_tis right).Not checked: a console, or the console's build options (they could only change what's in
rest).Two small optional things:
X509_get_serialNumbercould returnAsn1String*instead ofvoid*.ASN1_INTEGERisasn1_string_stin 2.5.4, andASN1_INTEGER_get_nid_postfixalready takesconst Asn1String*, so a caller could pass the result straight in.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T08:59:36Z.
Review: DISMISSED
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.