feat(libSceLibreSsl3): implement SSL_set_quic_transport_params #16981

Closed
GalaxyGamingFR wants to merge 3 commits from upstream-pr/16981 into main
GalaxyGamingFR commented 2026-11-08 03:57:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by GalaxyGamingFR on 2026-11-08T03:57:53Z.


What

Implement SSL_set_quic_transport_params in libSceLibreSsl3, replacing its parameterless throwing placeholder in AdditionalExports.cpp.

  • Source: LibreSSL 4.0.0 at ce488b78 ssl_lib.c, the revision the library's debt file already uses. As upstream does, it zeroes and frees the previous quic_transport_params (freezero), clears both fields, copies the new parameters into a fresh malloc buffer and stores them with their length, returning 1. A failed allocation returns 0 with the fields cleared.
  • The parameters and their length are at offsets 280 and 288 of LibreSsl3Ssl, the layout #16979 extends to 320 bytes, so this PR depends on #16979. It does not depend on #16980.
  • Api.hpp now declares it as int SSL_set_quic_transport_params(LibreSsl3Ssl* ssl, const std::uint8_t* params, std::size_t paramsLength), matching upstream.
  • Memory goes through libc's malloc_nid_postfix and free_nid_postfix, as Asn1Values.cpp already does. An empty list calls malloc(0) like upstream, so its result depends on libc.
  • A null SSL, and null parameters with a nonzero length, throw std::invalid_argument without changing the SSL, where upstream would dereference them.

The gap is recorded in docs/dev/debt/libSceLibreSsl3.md: no QUIC handshake runs here, so the parameters are never sent, an SSL whose parameters came from another allocator cannot be passed, and the console layout is not measured. The export inventory is updated (137 exports, 127 named).

No title's trace or disassembly was used, and the export was not measured on a PS5.

Tested

Windows 11, WinLibs GCC 15.2.0 UCRT. This is not a full CMake build. I compiled tests/GuestLibreSsl3Ssl.cpp with libSceLibreSsl3's Ssl.cpp, Key.cpp, X509.cpp, Asn1Values.cpp and IntegerDecoder.cpp and libSceLibreSsl's Error.cpp into one executable, with APS5_VABI defined empty, a one-line NotImplementedAt_nid_no_patch that throws, and malloc/calloc/free shims over the C runtime. No title or homebrew, and not built on Linux or macOS.

  • The test passes. The new CheckQuicTransportParams fills a guarded SSL with 0x5A (parameter pointer null) and checks that a 6-byte list, then a 4-byte replacement, each return 1 and change only the 16 bytes at offsets 280 and 288, which then hold a new buffer with the same bytes. It then checks that null parameters with a length, and a null SSL, throw, the first without changing the SSL. The zeroing before free is not observable through the test's allocator shim, so it is not tested.
  • Three deliberate bugs make the test fail: storing the caller's pointer instead of a copy, dropping the null-parameter check (it crashes), and returning 0 on success.
  • -Wall -Wextra is clean for the changed files, and python tools/check_conventions.py --base origin/main passes.

I searched open and merged pull requests for quic_transport_params just before opening this one, and none implements it. #16586, #16588, #16589, #16848, #16918, #16977 and #16980 change the same export inventory count, so whichever lands later needs a one-line rebase.

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
  • Generic behaviour, not specific to one title
  • Depends on: #16979 (this branch contains its commit; the diff to review is the last commit)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5208464442 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16981). Originally posted by [GalaxyGamingFR](https://github.com/GalaxyGamingFR) on 2026-11-08T03:57:53Z. --- ### What Implement `SSL_set_quic_transport_params` in `libSceLibreSsl3`, replacing its parameterless throwing placeholder in `AdditionalExports.cpp`. - Source: LibreSSL 4.0.0 at [`ce488b78` `ssl_lib.c`](https://github.com/libressl/openbsd/blob/ce488b78e0bd994780569df718596b9776ff681a/src/lib/libssl/ssl_lib.c#L3620-L3636), the revision the library's debt file already uses. As upstream does, it zeroes and frees the previous `quic_transport_params` (`freezero`), clears both fields, copies the new parameters into a fresh `malloc` buffer and stores them with their length, returning 1. A failed allocation returns 0 with the fields cleared. - The parameters and their length are at offsets 280 and 288 of `LibreSsl3Ssl`, the layout #16979 extends to 320 bytes, so this PR depends on #16979. It does not depend on #16980. - `Api.hpp` now declares it as `int SSL_set_quic_transport_params(LibreSsl3Ssl* ssl, const std::uint8_t* params, std::size_t paramsLength)`, matching upstream. - Memory goes through libc's `malloc_nid_postfix` and `free_nid_postfix`, as `Asn1Values.cpp` already does. An empty list calls `malloc(0)` like upstream, so its result depends on libc. - A null SSL, and null parameters with a nonzero length, throw `std::invalid_argument` without changing the SSL, where upstream would dereference them. The gap is recorded in `docs/dev/debt/libSceLibreSsl3.md`: no QUIC handshake runs here, so the parameters are never sent, an SSL whose parameters came from another allocator cannot be passed, and the console layout is not measured. The export inventory is updated (137 exports, 127 named). No title's trace or disassembly was used, and the export was not measured on a PS5. ### Tested Windows 11, WinLibs GCC 15.2.0 UCRT. This is not a full CMake build. I compiled `tests/GuestLibreSsl3Ssl.cpp` with libSceLibreSsl3's `Ssl.cpp`, `Key.cpp`, `X509.cpp`, `Asn1Values.cpp` and `IntegerDecoder.cpp` and libSceLibreSsl's `Error.cpp` into one executable, with `APS5_VABI` defined empty, a one-line `NotImplementedAt_nid_no_patch` that throws, and `malloc`/`calloc`/`free` shims over the C runtime. No title or homebrew, and not built on Linux or macOS. - The test passes. The new `CheckQuicTransportParams` fills a guarded SSL with `0x5A` (parameter pointer null) and checks that a 6-byte list, then a 4-byte replacement, each return 1 and change only the 16 bytes at offsets 280 and 288, which then hold a new buffer with the same bytes. It then checks that null parameters with a length, and a null SSL, throw, the first without changing the SSL. The zeroing before `free` is not observable through the test's allocator shim, so it is not tested. - Three deliberate bugs make the test fail: storing the caller's pointer instead of a copy, dropping the null-parameter check (it crashes), and returning 0 on success. - `-Wall -Wextra` is clean for the changed files, and `python tools/check_conventions.py --base origin/main` passes. I searched open and merged pull requests for `quic_transport_params` just before opening this one, and none implements it. #16586, #16588, #16589, #16848, #16918, #16977 and #16980 change the same export inventory count, so whichever lands later needs a one-line rebase. ### Checklist - [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 - [x] Generic behaviour, not specific to one title - [x] Depends on: #16979 (this branch contains its commit; the diff to review is the last commit) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-11-21 12:22:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T12:22:48Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the setter’s ownership and replacement behavior are consistent with the stated LibreSSL implementation.

What I ran

Reviewed head 858a6e5c739eace343ec09084301bbcf7fe5d433 using the prepared diff and pinned source reader (repo_read.py). No commands or tests were run by me; the description reports a targeted Windows test and convention check.

Results

Check Result Note
Diff and changed source review passed Six changed files read
Tests and build not run Author-reported results only
Console behavior not run Layout and allocator interoperability remain unverified

Findings

Blocking

None.

Non-blocking

None.

Not verified

The author’s reported test output and convention check were not independently reproduced. Console layout and allocator interoperability, QUIC handshake behavior, and the zero-before-free behavior were not verified. All six changed files listed in the manifest were read; no files were excluded in the manifest.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6005153379 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16981#pullrequestreview-6005153379). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T12:22:48Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the setter’s ownership and replacement behavior are consistent with the stated LibreSSL implementation. ## What I ran Reviewed head `858a6e5c739eace343ec09084301bbcf7fe5d433` using the prepared diff and pinned source reader (`repo_read.py`). No commands or tests were run by me; the description reports a targeted Windows test and convention check. ## Results | Check | Result | Note | |---|---|---| | Diff and changed source review | passed | Six changed files read | | Tests and build | not run | Author-reported results only | | Console behavior | not run | Layout and allocator interoperability remain unverified | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The author’s reported test output and convention check were not independently reproduced. Console layout and allocator interoperability, QUIC handshake behavior, and the zero-before-free behavior were not verified. All six changed files listed in the manifest were read; no files were excluded in the manifest. ## To get this to a good state Nothing is required.

Pull request closed

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!16981
No description provided.