feat(libSceLibreSsl3): implement four libtls CA and verification settings #15303

Merged
hyvvs merged 11 commits from upstream-pr/15303 into main 2026-11-07 01:13:28 +00:00
hyvvs commented 2026-11-02 23:03:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hyvvs on 2026-11-02T23:03:39Z.


What

Add four source-backed libSceLibreSsl3 libtls configuration exports: tls_config_set_ca_mem, tls_config_set_protocols, tls_config_verify_client and tls_config_insecure_noverifyname. CA memory is copied into config-owned storage and replaced/cleared according to OpenBSD tls_config.c and tls_set_mem; a null CA pointer clears the buffer and succeeds even with a positive length. The remaining three functions assign the protocol bitmask and the client-certificate and hostname-verification settings using public libtls signatures.

Depends on #15289: this branch descends from that PR's current merged-upstream head, including its follow-up key-memory fix. Its TlsConfig storage and lifetime come from #15289, and this PR adds four exports to the same module. Until #15289 merges, GitHub's base-main diff also includes its ten functions; review the four-function delta here. This PR adds exactly 4 more implemented exports, advancing libSceLibreSsl3 from 29/270 to 33/270 at the current upstream base.

TLS transport, certificate parsing and cipher validation remain unimplemented; tls_config_set_cert_mem, tls_config_set_ciphers, handshake, read and write continue throwing. tls_config_set_cert_mem requires immediate certificate parsing and validation, so it deliberately remains a stub until a proper certificate backend exists. tls_config_parse_protocols also remains a throwing stub in this branch: the same export is already implemented and claimed by PR #15045. Native PS5 ABI/error strings remain unverified and are documented in debt.

Tested

  • Windows WinLibs GCC 15.2: built LibTls.cpp into an actual DLL/import library and linked LibTlsSettings.cpp as a separate guest executable; passed. Tests include compile-time SysV prototypes and 8,192 CA-memory ownership/copying and configuration-setting iterations.
  • Ubuntu WSL2 GCC: same implementation and test with -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer; ASAN_OPTIONS=detect_leaks=1:halt_on_error=1 and UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1; passed.
  • core/libs/tests/test_public_headers.py --audit-only: 405 libraries, 27,952 exports verified. Affected public-header compile batches 49, 50, 51 all passed.
  • python tools/check_conventions.py --base upstream/main: passed. git diff --check: passed. python tools/progress.py --module libSceLibreSsl3: 33/270, exactly four additional functional exports; debt table has 161 remaining entries.
  • Full CMake/CTest is unavailable in this fresh worktree because third-party submodules are uninitialized. The focused test is registered with real libSceLibreSsl3 and libc target links.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: #15289
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5128836481 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15303). Originally posted by [hyvvs](https://github.com/hyvvs) on 2026-11-02T23:03:39Z. --- ### What Add **four** source-backed `libSceLibreSsl3` libtls configuration exports: `tls_config_set_ca_mem`, `tls_config_set_protocols`, `tls_config_verify_client` and `tls_config_insecure_noverifyname`. CA memory is copied into config-owned storage and replaced/cleared according to [OpenBSD `tls_config.c`](https://github.com/openbsd/src/blob/master/lib/libtls/tls_config.c) and `tls_set_mem`; a null CA pointer clears the buffer and succeeds even with a positive length. The remaining three functions assign the protocol bitmask and the client-certificate and hostname-verification settings using public libtls signatures. **Depends on #15289:** this branch descends from that PR's current merged-upstream head, including its follow-up key-memory fix. Its `TlsConfig` storage and lifetime come from #15289, and this PR adds four exports to the same module. Until #15289 merges, GitHub's base-main diff also includes its ten functions; [review the four-function delta here](https://github.com/hyvvs/AnyPS5/compare/feat/libressl3-libtls-config...feat/libressl3-libtls-settings). This PR adds exactly **4 more implemented exports**, advancing `libSceLibreSsl3` from **29/270 to 33/270** at the current upstream base. TLS transport, certificate parsing and cipher validation remain unimplemented; `tls_config_set_cert_mem`, `tls_config_set_ciphers`, handshake, read and write continue throwing. `tls_config_set_cert_mem` requires immediate certificate parsing and validation, so it deliberately remains a stub until a proper certificate backend exists. `tls_config_parse_protocols` also remains a throwing stub in this branch: the same export is already implemented and claimed by [PR #15045](https://github.com/boykopovar/AnyPS5/pull/15045). Native PS5 ABI/error strings remain unverified and are documented in debt. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> - Windows WinLibs GCC 15.2: built `LibTls.cpp` into an actual DLL/import library and linked `LibTlsSettings.cpp` as a separate guest executable; **passed**. Tests include compile-time SysV prototypes and 8,192 CA-memory ownership/copying and configuration-setting iterations. - Ubuntu WSL2 GCC: same implementation and test with `-fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer`; `ASAN_OPTIONS=detect_leaks=1:halt_on_error=1` and `UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1`; **passed**. - `core/libs/tests/test_public_headers.py --audit-only`: **405 libraries, 27,952 exports** verified. Affected public-header compile batches 49, 50, 51 all passed. - `python tools/check_conventions.py --base upstream/main`: passed. `git diff --check`: passed. `python tools/progress.py --module libSceLibreSsl3`: **33/270**, exactly four additional functional exports; debt table has 161 remaining entries. - Full CMake/CTest is unavailable in this fresh worktree because third-party submodules are uninitialized. The focused test is registered with real `libSceLibreSsl3` and `libc` target links. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: #15289 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!15303
No description provided.