Repository navigation
feat(libSceLibreSsl3): implement X509V3_EXT_conf_nid - #22761
oneandonlydean merged 4 commits into
Conversation
PrivacyOnion
left a comment
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against ef1a146967:
- Conventions:
tools/check_conventions.pypassed. - Build:
guest_libressl3_x509v3_ext_conf_nid_testsbuilt cleanly. - CTest (
guest_libressl3_x509v3_ext_conf_nid):1/1 Test #4441: guest_libressl3_x509v3_ext_conf_nid ... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 - Negative control: with
core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/src/X509V3ExtConfNid.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass. - Code reading:
- core/libs/prx/libSceLibreSsl3/src/X509V3ExtConfNid.cpp: BuildExtension verifies der.size() <= INT32_MAX, checks allocations from malloc_nid_postfix and calloc_nid_postfix, properly cleans up via free_nid_postfix / ASN1_OCTET_STRING_free_nid_postfix on partial allocation failure, and avoids memory leaks.
- core/libs/prx/libSceLibreSsl3/src/X509V3ExtConfNid.cpp: ParseHex, ParseIntegerLiteral, Base128, and AddDecimal handle hex and decimal decoding, boundary conditions, zero inputs, negative numbers, and odd-digit hex errors with exact LibreSSL error queuing.
- core/libs/prx/libSceLibreSsl3/src/X509V3ExtConfNid.cpp: PlainExtension handles NIDs 71 (nsCertType), 83 (keyUsage), and 126 (extendedKeyUsage), properly distinguishing unknown non-extension NIDs (UnknownExtension) from unknown extension names (UnknownExtensionName), and delegating unsupported standard extensions to NotImplemented_nid_no_patch.
- core/libs/prx/libSceLibreSsl3/src/X509V3ExtConfNid.cpp: ParseAsn1 and EncodeString properly implement BOOLEAN, INTEGER, ENUMERATED, NULL, OBJECT, OCTETSTRING, BITSTRING, IA5STRING, and UTF8String with FORMAT modifiers (ASCII, UTF8, HEX, BITLIST) and reject malformed/unsupported combinations.
- docs/dev/debt/changes/feat-libressl3-x509v3-ext-conf-nid.md and AGENTS.md compliance: verifies technical debt fragment follows repository rules, removes export TKGJOgbeyuA, contains no prohibited code comments, and adds no illegal files.
Looks Good To Me
PrivacyOnion
left a comment
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against f3cb56f01b:
- Conventions:
tools/check_conventions.pypassed. - Build:
guest_libressl3_x509v3_ext_conf_nid_testsbuilt cleanly. - CTest (
guest_libressl3_x509v3_ext_conf_nid):1/1 Test #4444: guest_libressl3_x509v3_ext_conf_nid ... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 - Negative control: with
core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/src/X509V3ExtConfNid.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass. - Code reading:
- Verified core/libs/prx/libSceLibreSsl3/src/X509V3ExtConfNid.cpp: BuildExtension checks der.size() against INT32_MAX and checks all allocations from malloc_nid_postfix / calloc_nid_postfix, cleaning up properly on partial failures.
- Verified core/libs/prx/libSceLibreSsl3/src/X509V3ExtConfNid.cpp: ParseHex, ParseIntegerLiteral, Base128, and AddDecimal correctly handle hex and decimal decoding, boundary conditions, zero inputs, negative numbers, and odd-digit hex errors with exact LibreSSL error queuing.
- Verified core/libs/prx/libSceLibreSsl3/src/X509V3ExtConfNid.cpp: PlainExtension handles NIDs 71 (nsCertType), 83 (keyUsage), and 126 (extendedKeyUsage), correctly distinguishing non-extension NIDs (UnknownExtension) from unknown extension names (UnknownExtensionName) and delegating unsupported standard extensions to NotImplemented_nid_no_patch.
- Verified core/libs/prx/libSceLibreSsl3/src/X509V3ExtConfNid.cpp: ParseAsn1 and EncodeString properly implement BOOLEAN, INTEGER, ENUMERATED, NULL, OBJECT, OCTETSTRING, BITSTRING, IA5STRING, and UTF8String with FORMAT modifiers (ASCII, UTF8, HEX, BITLIST) and reject malformed/unsupported combinations.
- Verified AGENTS.md compliance: docs/dev/debt/changes/feat-libressl3-x509v3-ext-conf-nid.md correctly documents the debt fragment, removes export TKGJOgbeyuA, no forbidden code comments are present, and no extraneous files are added.
Looks Good To Me
|
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.
|
|
Tested
AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports. |
PrivacyOnion
left a comment
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 5ce43c3e46:
- Conventions:
tools/check_conventions.pypassed. - Build:
guest_libressl3_x509v3_ext_conf_nid_testsbuilt cleanly. - CTest (
guest_libressl3_x509v3_ext_conf_nid):1/1 Test #4463: guest_libressl3_x509v3_ext_conf_nid ... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 - Negative control: with
core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/src/X509V3ExtConfNid.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass. - Code reading:
- Verified memory allocation safety in BuildExtension (X509V3ExtConfNid.cpp:665-689): checked der.size() boundary against INT32_MAX, validated malloc_nid_postfix and calloc_nid_postfix return pointers, and verified full cleanup of intermediate buffers via ASN1_OCTET_STRING_free_nid_postfix / free_nid_postfix on partial allocation failure.
- Verified hex, integer, and decimal conversion functions (ParseHex, ParseIntegerLiteral, Base128, AddDecimal, DecimalBytes) in X509V3ExtConfNid.cpp for boundary handling, empty string guards, odd-character count detection, and exact LibreSSL error queuing (OddNumberOfDigits, IllegalHexDigit).
- Verified PlainExtension handling for standard NIDs (71 nsCertType, 83 keyUsage, 126 extendedKeyUsage) in X509V3ExtConfNid.cpp: properly rejects unknown extensions with UnknownExtension or UnknownExtensionName error codes and routes unhandled standard extensions to NotImplemented_nid_no_patch(func).
- Verified ParseAsn1 and EncodeString handling for supported types (BOOLEAN, INTEGER, ENUMERATED, NULL, OBJECT, OCTETSTRING, BITSTRING, IA5STRING, UTF8String) and FORMAT modifiers (ASCII, UTF8, HEX, BITLIST) against LibreSSL 4.0.0 behavior, confirming proper rejection of unsupported tags and invalid encodings.
- Verified strict AGENTS.md compliance: confirmed docs/dev/debt/changes/feat-libressl3-x509v3-ext-conf-nid.md correctly tracks functional addition and removal of export TKGJOgbeyuA, no forbidden code comments exist, and no unauthorized files or silent success stubs were added.
Looks Good To Me
What
Implements the
X509V3_EXT_conf_nidexport (TKGJOgbeyuA) asX509V3_EXT_conf_nid_nid_postfixin a newsrc/X509V3ExtConfNid.cpp, following LibreSSL 4.0.0x509_conf.c(X509V3_EXT_conf_nid,X509V3_EXT_nconf_nid,v3_check_critical,v3_check_generic,v3_generic_extension,do_ext_nconf),v3_utl.c(string_to_hex,s2i_ASN1_INTEGER,X509V3_parse_list) andasn1_gen.c(ASN1_generate_v3).Handled:
critical,prefixes, then aDER:prefix: the hex bytes (with:separators, optional) becomethe extension's octet value.
ASN1:prefix: BOOLEAN, INTEGER, ENUMERATED, NULL, OBJECT, OCTET STRING, BIT STRING,IA5String and UTF8String, with the
ASCII,UTF8,HEXandBITLISTFORMAT:modifiers.ASN1:INTEGER:5produces02 01 05; OIDs accept dotted-decimal text and short/long names.nsCertType(71),keyUsage(83) andextendedKeyUsage(126): bit names fromthe reference tables (short and long spellings) and OID lists.
0/1, and the valueis a fresh octet string. A null value, an unknown NID, malformed hex and malformed
ASN1:textreturn null.
Other standard-extension NIDs with a plain value, other
ASN1:tags, theIMP/EXP/SEQWRAP/SETWRAP/BITWRAP/OCTWRAPmodifiers, and a non-nullconfholding an@sectionvalue throwNotImplemented_nid_no_patch(__func__). The@sectionpath needs the CONF layout, which the portdoes not have. This implements the minimal text-to-DER it needs and does not depend on or copy
#21702 (
src/X509Add1ExtI2d.cpp).Also: one declaration in
include/Api.hpp, the stub removed fromAdditionalExports.cpp, CMakewiring for
guest_libressl3_x509v3_ext_conf_nid[_tests], and one debt fragment that adds theFunctional bullet and removes the
TKGJOgbeyuAinventory row (git grep -l 'TKGJOgbeyuA' origin/main -- docs/dev/debt/changes/found no other pending fragment claiming it).Tested
No CMake/Ninja build exists on this host, so no ctest run.
clang++ -target x86_64-apple-darwin -std=c++20 -fsyntax-only -w -I core/libs -I core/libs/prx/libSceLibreSsl3/include -I 3rdparty -I /Users/dfischer/workdir/AnyPS5/3rdparty/mbedtls/include -I .onsrc/X509V3ExtConfNid.cppandtests/X509V3ExtConfNid.cpp: clean.src/Objects.cppandlibSceLibreSsl/src/ObjectTable.cppwith small stubs for the heap, theobject tables' added-object calls,
OBJ_sn2nid, the error queue and the extension/octet-stringfrees, plus a minimal
prx/libc/libc.hppshim (this arm64 host'slong doublefails the realheader's x86-64 static assertion, so only the harness shims it). Output:
libSceLibreSsl3 X509V3_EXT_conf_nid tests passed.python3 /tmp/anyps5-tools/cmake_wiring.py core/libs/prx/libSceLibreSsl3/CMakeLists.txt: nounregistered test properties, no duplicate targets.
python3 tools/debt_fold.py --check: passes, and--show libSceLibreSsl3removes theTKGJOgbeyuArow.python3 tools/check_conventions.py --base origin/main: "All conventions checks passed."*.cpp,*.hpp,*.md.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)