Repository navigation
feat(libSceLibreSsl3): implement the X509 notBefore, notAfter and signature getters - #10491
oneandonlydean merged 12 commits into
Conversation
Progress report (ea3ae18 → a09c1c5)📈 System libraries: 27.89% (+0.02%, +5 implemented functions) ✅ 5 implemented
Changed libraries (implemented exports)
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed head 5a11f928979734bdf574849cbd771c86b892c36a.
I checked the five implementations against the pinned LibreSSL 4.0.0 x509_set.c, x_x509.c, and x509_local.h. The validity getters match the source's null checks and field selection; the get0 getters delegate to their mutable counterparts. X509_get0_signature writes 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.
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
5a11f92 to
a2c3fa4
Compare
|
Rebased on |
|
@alvaroelpob Thanks for moving the declarations; the header part is resolved. The null-certificate case still throws when both outputs are null, while pinned LibreSSL's |
|
Windows run of
Not run: a title. AI-assisted: yes (Claude Code) |
a2c3fa4 to
8b44f2b
Compare
|
@oneandonlydean Followed |
ahmadmuj
left a comment
There was a problem hiding this comment.
Linux run of 8b44f2b4b1 merged onto main ae7d59258e (clean, tree c8661df2e8). Ubuntu 24.04 on WSL2, GCC 13.3, Release, BUILD_TESTING=ON, built only guest_libressl3_x509_validity_tests.
guest_libressl3_x509_validitypasses,--repeat until-fail:3.- Red controls, each rebuilt and run against the PR's test:
- the a2c3fa4 body (throws on any null certificate): aborts at line 108 with
null certificate, so the new no-output case is pinned X509_getm_notBeforereadingnotAfter: fails at line 34X509_get0_signaturewritingsig_alginto the signature output: fails at line 101X509_get0_notAftercalling thenotBeforegetter: fails at line 85- dropping the
cert_infonull check: segfaults
- the a2c3fa4 body (throws on any null certificate): aborts at line 108 with
tools/check_conventions.py --base origin/mainpasses.
Checked against LibreSSL 4.0.0 (x509_set.c 150-206, x_x509.c 380-388): the getm getters return NULL for a null cert, cert_info or validity, the get0 getters delegate, and X509_get0_signature writes 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 offsetof against the 4.0.0 headers. x509_st has sig_alg at 8 and signature at 16 (size 216), X509_CINF has validity at 32 (size 104), and X509_VAL is 16 bytes, all matching your static_asserts. The same program against 2.5.4 gives the same offsets for those fields (only x509_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)
|
@alvaroelpob @oneandonlydean same check as on #10490: firmware 13.42's
|
|
A Windows rerun of the new head
AI-assisted: yes (Claude Code) |
8b44f2b to
db1a624
Compare
db1a624 to
bbd0c33
Compare
✅ AMD GPU test: passedPR head
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (10, not counted against this PR)Validation IDs already present on main (4 IDs in 748 tests)Skipped (10)ReproduceAutomated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
…y for requested outputs
…utput X509_get0_signature call
f929081 to
20496fe
Compare
|
Hi @alvaroelpob, main moved after #10452, so we pushed a merge of main ( |
|
Hi @alvaroelpob, I merged main into your branch to clear the debt-doc conflict (LibreSsl3 pending-exports line now keeps main's EVP_PKEY_size exclusion and your 5, count 56). No changes to your code. |
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=ONonmain379b1dc. 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.maine7e3e9c, head a2c3fa4. The branch still merged cleanly, but after refactor(libs): add full export headers for libs #10706public_headersfails on the merge: the exports kept their(void)stubs ininclude/Api.hppand the test redeclared them. a2c3fa4 (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.main6e775f4, head 8b44f2b, 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 82d32ba, 81d4732 and 8b44f2b 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.main74acfad (after feat(libSceLibreSsl3): implement ASN.1 integer decoding #10948), head db1a624, 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.mainf2d874c (after feat(libSceLibreSsl3): implement ASN.1 integer decoding #10948, feat(libSceLibreSsl3): implement RSA_up_ref #13267, feat(libSceLibreSsl3): name 116 unknown additional exports from their NIDs #13831, feat(libSceLibreSsl3): implement EVP_PKEY_get0_RSA, EVP_PKEY_get0_DSA and EVP_PKEY_get0_DH #13897 and fix(libSceLibreSsl3): return d2i_ASN1_INTEGER errors instead of throwing #14171), head 365d768, 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.main4939814 (after feat(libSceLibreSsl): implement numeric ERR formatting and newest peeking #9535 and feat(libressl3): report OpenSSL version strings #9970), head e1e1ee0, 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.mainb11c7bf (after feat(libSceLibreSsl3): implement X509 public key parameters #10557), head 5f3d95a, 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)