fix(libSceLibreSsl3): run d2i_X509_CRL's post-decode step #27637
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/27637"
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 zaidwhy on 2026-11-26T20:23:37Z.
What
After LibreSSL 4.0.0 decodes a CRL, it runs one more step (
crl_cbandcrl_set_issuers) that fills in some fields.d2i_X509_CRLin libSceLibreSsl3 skipped that step. With this change it:hash(it stayed all zeros, so every CRL from one issuer looked the same)EXFLAG_INVALID,EXFLAG_CRITICALandEXFLAG_FRESHESTthe way LibreSSL doesreasontoCRL_REASON_NONE(-1) when it has no reason extension (it was 0, which means "unspecified")idp_reasonstoCRLDP_ALL_REASONSThe 112 unnamed bytes at the end of
LibreSsl3X509Crlare now named fields at the 4.0.0 offsets. The hash is taken over the same bytes LibreSSL re-encodes: the TBS part as received, the rest rebuilt as DER. A CRL with an issuing distribution point extension now throws, because that extension is not decoded yet. That and the other gaps are in the debt fragment.Tested
Ubuntu 26.04 on WSL2, GCC 15.2, Release build with tests.
ctest -R libressl: 219 of 219 pass.guest_libressl3_x509_crlhas new cases for the hash (one checked against Python'shashlib), the cached extensions, the flags and the entry reasons.tools/check_conventions.pypasses. No title or homebrew tested.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-26T20:30:08Z.
Review: COMMENTED
Actionable comments posted: 2
b46a50c0-1e49-4db6-b3b4-633e5bfbe6f0Reviewing files that changed from the base of the PR and between
566e3c6da9and1f832bfdb4.core/libs/prx/libSceLibreSsl3/include/Api.hppcore/libs/prx/libSceLibreSsl3/src/X509Crl.cppcore/libs/prx/libSceLibreSsl3/tests/X509Crl.cppdocs/dev/debt/changes/libressl3-crl-post-decode.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T20:31:42Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: retain
EXFLAG_CRITICALwhen any critical extension requires it, including extensions after the first recognized critical extension.What I ran
Reviewed head
1f832bfdb4b21b8a6fd7ec27b9811297a37f2d9cusing the prepared diff andrepo_read.pysource reader. No build or tests were run.Results
Findings
Blocking
core/libs/prx/libSceLibreSsl3/src/X509Crl.cpp:561-568, the loop stops at the first critical CRL extension, even when its NID is excluded fromCriticalFlag(such asAuthorityKeyIdNid). As a result, a later unsupported critical extension is not flagged. The tests atcore/libs/prx/libSceLibreSsl3/tests/X509Crl.cpp:1513encode this behavior by expecting zero for a CRL with critical authority key ID followed by a critical distribution points extension. Continue scanning after recognized critical extensions and set the flag if any critical extension is outside the excluded set.Non-blocking
None.
Not verified
No build, test suite, console, or Homebrew run was performed. Read
description.md,commits.md,manifest.json,diff.patch; read the complete included changed filesApi.hpp,X509Crl.cpp,tests/X509Crl.cpp, andlibressl3-crl-post-decode.md. No changed files were excluded according to the manifest;files.jsonwas not available in the review folder.To get this to a good state
Continue scanning all CRL extensions when determining
EXFLAG_CRITICAL, and update the test for a recognized critical extension followed by an unsupported critical extension.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T03:30:38Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: continue scanning CRL extensions after an allowed critical extension so later unknown critical extensions set
EXFLAG_CRITICAL.What I ran
Reviewed head
f9f65d3c554251a731c3c615ba0d99ab38527536usingrepo_read.py. No build or tests were run; the test results in the PR description are author-reported.Results
Findings
Blocking
core/libs/prx/libSceLibreSsl3/src/X509Crl.cpp:568unconditionally breaks after the first critical CRL extension, even when that extension is an allowed critical AKID or delta CRL number. Any later unknown critical extension is then skipped andEXFLAG_CRITICALis not set. This can make a CRL appear free of unsupported critical extensions. The new test atcore/libs/prx/libSceLibreSsl3/tests/X509Crl.cpp:445expects that incorrect result for a critical AKID followed by a critical distribution points extension. Continue scanning after allowed critical extensions; stop only after setting the flag or exhausting the list.Non-blocking
None.
Not verified
No build or tests were run. The PR description reports Ubuntu 26.04 on WSL2 with GCC 15.2 and 219 passing
ctest -R libressltests; those results were not independently verified. Read the prepared description, commits, manifest, diff, the changed header, relevant source ranges, test setup and added cases, and debt note. All four changed files are listed as included in the review bundle; only targeted ranges of the source and test files were read.To get this to a good state
Continue scanning past allowed critical extensions and add or update a test showing a later unknown critical extension sets
EXFLAG_CRITICAL. Rerun the reported LibreSSL tests and build on the updated head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T03:49:53Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the documented unsupported extensions and issuer handling are recorded as technical debt.
What I ran
Reviewed head
cca6d882722160288cfbea5ade6186d7d07d9f08using the prepared diff and targeted reads throughrepo_read.py. I did not run tests or builds.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests or build were run. The author reports Ubuntu 26.04 on WSL2 with GCC 15.2, a Release build, 219/219 LibreSSL tests, and convention checks passing; these results were not independently verified. No title or homebrew testing was reported. Read:
review/description.md,review/commits.md,review/manifest.json,review/diff.patch,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/src/X509Crl.cpp, and the relevant targeted portions ofcore/libs/prx/libSceLibreSsl3/tests/X509Crl.cpp. The debt fragmentdocs/dev/debt/changes/libressl3-crl-post-decode.mdwas present in the diff but its full file was not read. No files were excluded by the manifest.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T09:54:35Z.
Review: COMMENTED
The full Linux X509Crl fixture passed with the exact implementation from this head. It checks the derived CRL fields, the revocation-entry reason default and the digest against the input bytes.
AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.