Skip to content

feat(libSceLibreSsl3): implement X509V3_set_ctx - #15629

Merged
adriadam10 merged 3 commits into
boykopovar:mainfrom
alvaroelpob:feat/libscelibressl3-x509v3-set-ctx
Nov 10, 2026
Merged

adriadam10 merged 3 commits into
boykopovar:mainfrom
alvaroelpob:feat/libscelibressl3-x509v3-set-ctx

Conversation

@alvaroelpob

@alvaroelpob alvaroelpob commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What

Implements X509V3_set_ctx in libSceLibreSsl3. As in LibreSSL 4.0.0 x509_conf.c, it stores the issuer, subject, request, CRL and flags in the caller's 48-byte X509V3_CTX from the public 4.0.0 x509v3.h and leaves db alone.

Tested

Linux x86-64 (WSL2), Release: the full build passes and ctest --test-dir build -j16 passes 3829 of 3829 tests, including the new guest_libressl3_x509v3_context. python3 tools/check_conventions.py --base upstream/main passes. Not run on a console or in a title.

Checklist

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Progress report (acec1ed → 5774baf)

📈 System libraries: 35.91% (+0.0026%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceLibreSsl3 X509V3_set_ctx_nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libSceLibreSsl3 529/680 (77.79%) 530/680 (77.94%) +0.15%

@alvaroelpob
alvaroelpob marked this pull request as ready for review November 3, 2026 23:00

@XairRrR XairRrR left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — approved

X509V3_set_ctx matches the LibreSSL 4.0.0 code the PR cites, and the new test passes on the merged tree. The test also fails when the export is reverted to main's throwing stub. I found no issues.

What I ran

Head 197ead80f3e9cfad89eec9a637c0d4267c4c7e3e, main 1c8c0efc8c41314402e6966da5bef6ea3d639d10, merged with --no-ff into tree a8c7d326a531b6deed1b20325d83a029bc47e166. Debian 13 VM, GCC 14.2.0, Release, Ninja.

git diff --check 1c8c0efc8c41314402e6966da5bef6ea3d639d10...197ead80f3e9cfad89eec9a637c0d4267c4c7e3e
python3 tools/check_conventions.py --base 1c8c0efc8c41314402e6966da5bef6ea3d639d10
# negative control: src/X509V3Context.cpp body replaced by NotImplemented_nid_no_patch(__func__)
ninja -C build -j32 -l32 guest_libressl3_x509v3_context_tests
ctest --test-dir build -R "^guest_libressl3_x509v3_context$" --output-on-failure
# merged file restored from a8c7d326a531b6deed1b20325d83a029bc47e166
ninja -C build -j32 -l32 guest_libressl3_x509v3_context_tests
ctest --test-dir build -R "^guest_libressl3_x509v3_context$" --output-on-failure
git status --porcelain
# cited reference, read from the libressl-openbsd submodule's object store
git show ce488b78e0bd994780569df718596b9776ff681a:src/lib/libcrypto/x509/x509_conf.c | sed -n 428,442p
git show ce488b78e0bd994780569df718596b9776ff681a:src/lib/libcrypto/x509/x509v3.h | sed -n 121,132p

Results

Check Result
git diff --check clean
check_conventions.py All conventions checks passed
Configure / build / libs (script) ok
Selected tests (script) 835 ran, 831 passed, 3 expected skips, 0 new failures, 0 timeouts
Known failure unwrap_self_UnwrapTest_test_new_output_inherits_the_destination_directory_group: fails on main too, unrelated to this PR
guest_libressl3_x509v3_context passed (about 0.01 s)
public_headers passed: "406 libraries, 28302 exports: unique declarations and umbrella coverage verified"
Vulkan validation comparison skipped by the script: the PR changes no AGC driver, shader recompiler or VideoOut files
Cited LibreSSL 4.0.0 source x509_conf.c L430–L440 is X509V3_set_ctx and sets issuer, subject, CRL, request and flags. It does not touch db. x509v3.h L123–L131 is struct v3_ext_ctx { int flags; X509 *issuer_cert; X509 *subject_cert; X509_REQ *subject_req; X509_CRL *crl; void *db; }. This matches the new struct and its static_asserts.

Negative control

I replaced the body of core/libs/prx/libSceLibreSsl3/src/X509V3Context.cpp with NotImplemented_nid_no_patch(__func__), which is what main does for this export. After a rebuild the test failed as expected:

Output
terminate called after throwing an instance of 'std::runtime_error'
  what():  X509V3_set_ctx_nid_postfix not implemented
0% tests passed, 1 tests failed out of 1
	2874 - guest_libressl3_x509v3_context (Subprocess aborted)

I then restored the merged file and rebuilt; the test passed again, and git status --porcelain was empty.

Findings

Blocking

None.

Non-blocking

None.

Notes from reading the code:

  • The repository's pinned libressl-openbsd submodule is an older LibreSSL whose context still has db_meth before db. This does not affect the implementation:
    • The fields it writes are at the same offsets (0–32) in both layouts.
    • It never touches db or db_meth.
    • Only the 48-byte size assertion depends on the version, and the debt entry records that.
  • The null-context throw (core/libs/prx/libSceLibreSsl3/src/X509V3Context.cpp:7) follows the library's existing rule that inputs on which LibreSSL would fault throw instead.
  • The new debt entry and the updated inventory count (174 exports: 164 named, 10 known only by NID) match the export removed from AdditionalExports.cpp.

Not verified

  • Behaviour on a PS5 console, and which LibreSSL version Sony's libSceLibreSsl3 is built from. The debt entry already lists this as open.
  • Windows/MinGW build and the WIN32 PATH setting for the new test.
  • The full test suite: only the tests the script selected and the new test were run.

@alvaroelpob

Copy link
Copy Markdown
Contributor Author

Rebased on main 018cfcb to resolve the new conflicts. Head edcec1c. Full Linux suite: 4168/4168. check_conventions.py passes.

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 17250 X509V3_set_ctx

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.

Pull request Shared files not compared
PR 12315 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 14212 docs/dev/debt/libSceLibreSsl3.md
PR 14465 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15163 core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15737 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15831 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16535 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16586 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16589 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16654 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16689 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16742 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16819 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16848 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16918 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16977 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16979 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16980 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16981 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16996 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17124 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17142 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17147 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17236 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17239 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17241 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17243 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17249 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17250 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17528 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17544 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17621 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17622 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17626 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17842 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17843 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17844 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 18051 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 18052 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md

@adriadam10 adriadam10 self-assigned this Nov 7, 2026
@adriadam10
adriadam10 force-pushed the feat/libscelibressl3-x509v3-set-ctx branch from edcec1c to 41386cd Compare November 7, 2026 12:26
@adriadam10
adriadam10 force-pushed the feat/libscelibressl3-x509v3-set-ctx branch from 41386cd to c2acc30 Compare November 7, 2026 13:41
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 7, 2026
@adriadam10
adriadam10 force-pushed the feat/libscelibressl3-x509v3-set-ctx branch from c2acc30 to e3fde7d Compare November 7, 2026 18:28
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 7, 2026
@adriadam10
adriadam10 force-pushed the feat/libscelibressl3-x509v3-set-ctx branch from e3fde7d to 5774baf Compare November 10, 2026 10:41
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 10, 2026
@adriadam10
adriadam10 merged commit 2c41a03 into boykopovar:main Nov 10, 2026
13 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Rebased on current main: conflicts in the library's CMakeLists.txt, Api.hpp, AdditionalExports.cpp and the debt file, resolved by keeping everything new from main and dropping the X509V3_set_ctx stub. The additional-exports line in docs/dev/debt/libSceLibreSsl3.md is recounted to 92 still-unimplemented (83 named, 9 NID-only). The implementation matches LibreSSL 4.0.0 x509_conf.c and guest_libressl3_x509v3_context pins the fields and the untouched db. Build and library tests pass on the rebased head; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants