Repository navigation
fix(libSceLibreSsl3): use the X509v3 extension table of LibreSSL 4.0.0 - #25122
Merged
oneandonlydean merged 1 commit intoNov 21, 2026
Merged
oneandonlydean merged 1 commit into
oneandonlydean merged 1 commit into
Conversation
X509V3_EXT_d2i and X509V3_EXT_conf_nid carried the 42 extensions of the 3.4.1 ext_dat.h. The switch of X509V3_EXT_get_nid in 4.0.0 has no method for sxnet, id-pkix-OCSP-noCheck and proxyCertInfo, and has the three Certificate Transparency extensions. The three removed NIDs now behave as extensions without a method. The precertificate poison decodes NULL to the value 1 and is built as 05 00. The two SCT list extensions queue X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED in the builder and throw in the decoder, which does not model SCT lists. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
PrivacyOnion
approved these changes
Nov 21, 2026
PrivacyOnion
left a comment
Contributor
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 4ce7c920b3:
- Conventions:
tools/check_conventions.pypassed. - Build:
guest_libressl3_x509v3_ext_conf_nid_tests,guest_libressl3_x509v3_ext_d2i_testsbuilt cleanly. - CTest (
guest_libressl3_x509v3_ext_d2i,guest_libressl3_x509v3_ext_conf_nid):1/2 Test #4745: guest_libressl3_x509v3_ext_d2i ........ Passed 0.19 sec 2/2 Test #4750: guest_libressl3_x509v3_ext_conf_nid ... Passed 0.26 sec 100% tests passed, 0 tests failed out of 2 - Negative control: with
core/libs/prx/libSceLibreSsl3/src/X509V3ExtConfNid.cpp,core/libs/prx/libSceLibreSsl3/src/X509V3ExtD2i.cppreverted tomainand the new tests kept, the suite fails:Restoring the change makes it pass again.1/2 Test #4750: guest_libressl3_x509v3_ext_conf_nid ...Subprocess aborted***Exception: 0.49 sec 2/2 Test #4745: guest_libressl3_x509v3_ext_d2i ........Subprocess aborted***Exception: 0.58 sec 0% tests passed, 2 tests failed out of 2 - Code reading:
- Verified IsStandardExtension and Methods arrays: both updated consistently to LibreSSL 4.0.0 NIDs (removed 143, 369, 663; added 1018, 1019, 1021) preserving table length 42 and static_assert.
- Checked X509V3ExtConfNid.cpp: PlainExtension handles NID 1018 and 1021 by emitting ExtensionSettingNotSupported (103) and returning nullptr, and NID 1019 builds DER NULL tag (0x05, 0x00) matching OpenBSD/LibreSSL s2i_poison behavior.
- Checked X509V3ExtD2i.cpp: NewNull safely checks ASN.1 header (tag class 0, NullTag 5, indefinite/constructed rules, primitive requirement, length 0 emitting NullIsWrongLength 144) and returns dummy non-null pointer (uintptr_t 1) without memory leak.
- Verified AGENTS.md compliance: technical debt fragment docs/dev/debt/changes/fix-libressl3-x509v3-ext-method-table.md added, no code comments added, and unimplemented SCT list decoders correctly route to NotImplemented_nid_no_patch via Decoder::Unsupported.
- Verified unit test coverage in X509V3ExtConfNid.cpp and X509V3ExtD2i.cpp: both success and error/malformed branches (constructed, non-zero length, truncated, invalid tag) are thoroughly asserted.
Looks Good To Me
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
X509V3_EXT_d2iandX509V3_EXT_conf_nidinlibSceLibreSsl3decide which extensions they know from a list of 42 NIDs. That list is theext_dat.htable of the bundled 3.4.1 submodule. LibreSSL 4.0.0, the reference of this library, no longer has that file: the list is theswitchofX509V3_EXT_get_nid, and it differs by six NIDs (I compared the two lists entry by entry againstobj_mac.num; there is no other difference):sxnetid-pkix-OCSP-noCheckproxyCertInfoct_x509v3.c)What a caller sees:
X509V3_EXT_d2ion 143, 369, 663NotImplementedx509_lib.c: no method)X509V3_EXT_conf_nidon 143, 369, 663NotImplementedX509V3_R_UNKNOWN_EXTENSION(x509_conf.cL128-L131)X509V3_EXT_d2ion 1019 with value05 00ASN1_NULL_it)X509V3_EXT_conf_nidon 1019UNKNOWN_EXTENSION05 00, whatever the string (s2i_poison)X509V3_EXT_conf_nidon 1018, 1021UNKNOWN_EXTENSIONX509V3_R_EXTENSION_SETTING_NOT_SUPPORTED: these methods have nov2i,s2iorr2i(x509_conf.cL159-L163)X509V3_EXT_d2ion 1018, 1021NotImplemented: the source decodes an SCT list, which this library does not modelThe poison decoder follows the
NULLrules oftasn_dec.c: wrong tag, bad header and a length past the input fail with their reason andERR_R_NESTED_ASN1_ERROR; a constructed form fails withASN1_R_TYPE_NOT_PRIMITIVE; a content that is not empty fails withASN1_R_NULL_IS_WRONG_LENGTH.Both tables stay at 42 entries. The debt fragment records the change and the SCT gap.
Tested
Windows 11, MinGW GCC 15.2. Not tested on a console.
TestMethodTableinguest_libressl3_x509v3_ext_d2iand inguest_libressl3_x509v3_ext_conf_nid: for each of the six NIDs, the return value and the whole error queue through both exports; for 1019, the value returned, each malformedNULLwith its queue, and a round trip (the extension built byX509V3_EXT_conf_niddecodes to 1 throughX509V3_EXT_d2i); an unchanged extension still works. One existing line that expected 369 to throw now uses 371.main, both tests stop on theNotImplementedexception of the first 143 case; with the change they pass.NULLdecoder and its reason; the builder's reason changed or missing; the three new builder cases falling back to the default; the poison bytes changed.python tools/check_conventions.py --base origin/main,python tools/debt_fold.py --checkandpython core/libs/tests/test_public_headers.py --audit-onlypass.Not verified. The expected queues come from reading the source, not from running a LibreSSL 4.0.0 binary.
Overlap (
python tools/pr_overlap.py --branch fix/libressl3-x509v3-ext-method-table):X509V3ExtD2i.cpp, fix(libSceLibreSsl3): wrap X509V3_EXT_conf_nid ASN1 values in SEQWRAP, SETWRAP, BITWRAP and OCTWRAP #24770 and fix(libSceLibreSsl3): copy X509V3_EXT_conf_nid's value string in through a checked guest copy #23385 inX509V3ExtConfNid.cpp); the tool merges them with this branch without a conflict. fix(libSceLibreSsl3): decode constructed strings in X509V3_EXT_d2i #24677 renames a helper of the decoder, so the newNULLdecoder does not call it and compiles before and after that PR.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)