feat(libSceLibreSsl3): implement the X509 notBefore, notAfter and signature getters #10491
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10491"
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-24T03:21:02Z.
What
Implements
X509_getm_notBefore,X509_getm_notAfter,X509_get0_notBefore,X509_get0_notAfterandX509_get0_signaturein libSceLibreSsl3, which threw and were declared without parameters.The module is LibreSSL 4.0.0 (firmware 13.40 measurements in #8981). Signatures, layouts and results follow that release's
x509_local.h,x509_set.candx_x509.c:ASN1_TIME* X509_getm_notBefore(const X509*)cert_infoorvalidityis null, otherwisevalidity->notBeforeASN1_TIME* X509_getm_notAfter(const X509*)notAfterconst ASN1_TIME* X509_get0_notBefore(const X509*)X509_getm_notBeforeconst ASN1_TIME* X509_get0_notAfter(const X509*)X509_getm_notAftervoid X509_get0_signature(const ASN1_BIT_STRING**, const X509_ALGOR**, const X509*)signatureandsig_algthrough the non-null output pointersThe layouts are 216 bytes for
X509(sig_algat 8,signatureat 16), 104 forX509_CINF(validity, a pointer, at 32) and 16 forX509_VAL(notBefore,notAfter). They were checked withstatic_asserts and againstoffsetoffrom the 4.0.0 headers compiled on x86-64.X509_get0_signaturereads the certificate only for the outputs requested, as LibreSSL does: with both outputs null it returns without reading it, and a null certificate throws only when an output is requested, where LibreSSL would dereference it. 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. The pending-export count drops from 84 to 79, and the five names join the exclusion list.
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_libressl3_x509_validitytest andcheck_conventions.pyrun on its own.guest_libressl3_x509_validitytest. The four time getters return null for a null certificate, a nullcert_info, a nullvalidityand a null field, and return their own field, not the other one.X509_get0_signaturewrites null fields, then the signature and algorithm, each through its own output only, accepts both outputs null, also with a null certificate, and throws for a null certificate when either output is requested. The fixtures are the publicLibreSsl3X509Validity,LibreSsl3ValidityCertInfoandLibreSsl3ValidityX509.ctest -j16at the last commit: 2005/2006 pass.agc_driver_multisample_retirementfails the same way onmainon this machine.maine7e3e9c198, head a2c3fa4587. The branch still merged cleanly, but after #10706public_headersfails on the merge: the exports kept their(void)stubs ininclude/Api.hppand the test redeclared them. a2c3fa4587 (refactor(libSceLibreSsl3): declare the X509 validity exports in the public header) puts the real signatures and their structs inlibSceLibreSsl3/include/Api.hppand drops the test's redeclarations. Full build andctest -j16: 2202/2203 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.main6e775f452a, head 8b44f2b4b1, to resolve the conflicts withmainon the sharedCMakeLists.txtand debt-file lines; both sides are kept and the count is 84 minus this PR's exports. Review fixes 82d32bab09, 81d4732676 and 8b44f2b4b1 makeX509_get0_signaturewith both outputs null return without reading the certificate, build the tests on the public structs and update the debt entry;guest_libressl3_x509_validitypasses. Full build andctest -j16: 2268/2269 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.main74acfad65b(after #10948), head db1a62489f, to resolve the conflicts withmainon the sharedCMakeLists.txtand debt-file lines; both sides are kept and the count is 83 minus this PR's exports. Full build andctest -j16: 2431/2432 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.mainf2d874c1fd(after #10948, #13267, #13831, #13897 and #14171), head 365d7689ca, to resolve the conflicts on the pending-export line of the debt file: the count and the exclusion list keepmain's names and add this PR's, and the count, 72, matches the stubs inExport.cpp. Full build andctest -j16: 3157/3157 pass.check_conventions.py --base upstream/mainpasses.main4939814d79(after #9535 and #9970), head e1e1ee0426, to resolve the conflicts on the sharedExport.cpp,Api.hppand debt-file lines; both sides are kept.mainsays 76 pending exports with 74 stubs left, so the count is set to the 69 stubs left inExport.cpp. Full build andctest -j16: 3538/3538 pass.check_conventions.py --base upstream/mainpasses.mainb11c7bf84f(after #10557), head 5f3d95a631, to resolve the conflicts on the sharedCMakeLists.txt,Api.hppand debt-file lines; both sides are kept,X509_PUBKEY_get0_paramstays in the exclusion list, and the count is set to the 68 stubs left inExport.cpp. Full build andctest -j16: 3883/3883 pass.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-24T03:22:54Z.
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-24T12:14:46Z.
Review: APPROVED
Reviewed head
5a11f928979734bdf574849cbd771c86b892c36a.I checked the five implementations against the pinned LibreSSL 4.0.0
x509_set.c,x_x509.c, andx509_local.h. The validity getters match the source's null checks and field selection; theget0getters delegate to their mutable counterparts.X509_get0_signaturewrites only requested outputs and matches the source's null-certificate dereference behavior via the project's exception convention. The asserted layouts and offsets agree with the pinned structures. I found no blocking correctness issue in this diff.The PR reports focused getter tests and a 2005/2006 full CTest run, with the remaining failure reproduced on main; I did not reproduce that build or test run locally. Current hosted convention, labels, eligibility, and report checks pass; the Linux, Windows, register-context, relinker, write-watch, and ASan jobs are skipped. The overlap report with #10557 is shared build/export/debt files, not the same exports; coordinate those file edits when composing the changes.
Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-10-25T19:22:17Z.
Review: APPROVED
Linux run of
8b44f2b4b1merged ontomainae7d59258e(clean, treec8661df2e8). Ubuntu 24.04 on WSL2, GCC 13.3, Release,BUILD_TESTING=ON, built onlyguest_libressl3_x509_validity_tests.guest_libressl3_x509_validitypasses,--repeat until-fail:3.null certificate, so the new no-output case is pinnedX509_getm_notBeforereadingnotAfter: fails at line 34X509_get0_signaturewritingsig_alginto the signature output: fails at line 101X509_get0_notAftercalling thenotBeforegetter: fails at line 85cert_infonull check: segfaultstools/check_conventions.py --base origin/mainpasses.Checked against LibreSSL 4.0.0 (
x509_set.c150-206,x_x509.c380-388): the getm getters return NULL for a null cert,cert_infoorvalidity, the get0 getters delegate, andX509_get0_signaturewrites only the non-null outputs, in the same(psig, palg, x)order. The only difference is the throw for a null cert with an output requested, and the debt entry says so.Layout: I compiled
offsetofagainst the 4.0.0 headers.x509_sthassig_algat 8 andsignatureat 16 (size 216),X509_CINFhasvalidityat 32 (size 104), andX509_VALis 16 bytes, all matching your static_asserts. The same program against 2.5.4 gives the same offsets for those fields (onlyx509_st's total size differs, 176), so the getters read the right fields either way.Looks good to me. Not run: a title, or the full suite. AI-assisted: yes (Claude Code)