feat(libSceLibreSsl3): implement SSL_set_info_callback #16979

Merged
GalaxyGamingFR merged 1 commit from upstream-pr/16979 into main 2026-11-12 17:44:39 +00:00
GalaxyGamingFR commented 2026-11-08 03:52:03 +00:00 (Migrated from github.com)

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


What

Implement SSL_set_info_callback 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. Upstream only stores the callback in ssl->info_callback.
  • LibreSsl3Ssl in Ssl.hpp previously stopped after the fields the existing retains and SSL_get_client_random read (184 bytes). It now runs through info_callback of the ssl_st LP64 layout, 320 bytes, with the callback at 312. The existing asserts are kept, and new ones pin initial_ctx (224), min_tls_version (240), quic_transport_params (280) and info_callback (312), so a wrong field in the middle fails to compile. Nothing in the tree allocates an SSL by sizeof, so the larger size changes no existing behaviour.
  • Api.hpp now declares it as void SSL_set_info_callback(LibreSsl3Ssl* ssl, LibreSsl3InfoCallback callback), with LibreSsl3InfoCallback as void (*)(const LibreSsl3Ssl*, int type, int value), matching upstream's prototype.
  • A null SSL throws std::invalid_argument, where upstream would dereference it.

The gap is recorded in docs/dev/debt/libSceLibreSsl3.md: no handshake runs here, so the callback is never called, and the console layout is not measured. The export inventory is updated (138 exports, 128 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. No title or homebrew, and not built on Linux or macOS.

  • The test passes. The new CheckInfoCallback fills a guarded SSL with 0x5A, sets a callback and checks that only the 8 bytes at offset 312 changed and now hold the callback. It then sets a null callback and checks that those bytes are cleared, and checks that a null SSL throws.
  • Two deliberate bugs make the test fail: storing the callback in handshake_func (offset 304), and not throwing on a null SSL.
  • -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 SSL_set_info_callback just before opening this one, and none implements it. #16586, #16588, #16589, #16848, #16918 and #16977 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: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5208424710 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16979). Originally posted by [GalaxyGamingFR](https://github.com/GalaxyGamingFR) on 2026-11-08T03:52:03Z. --- ### What Implement `SSL_set_info_callback` 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#L3275-L3279), the revision the library's debt file already uses. Upstream only stores the callback in `ssl->info_callback`. - `LibreSsl3Ssl` in `Ssl.hpp` previously stopped after the fields the existing retains and `SSL_get_client_random` read (184 bytes). It now runs through `info_callback` of the [`ssl_st`](https://github.com/libressl/openbsd/blob/ce488b78e0bd994780569df718596b9776ff681a/src/lib/libssl/ssl_local.h#L862-L1070) LP64 layout, 320 bytes, with the callback at 312. The existing asserts are kept, and new ones pin `initial_ctx` (224), `min_tls_version` (240), `quic_transport_params` (280) and `info_callback` (312), so a wrong field in the middle fails to compile. Nothing in the tree allocates an `SSL` by `sizeof`, so the larger size changes no existing behaviour. - `Api.hpp` now declares it as `void SSL_set_info_callback(LibreSsl3Ssl* ssl, LibreSsl3InfoCallback callback)`, with `LibreSsl3InfoCallback` as `void (*)(const LibreSsl3Ssl*, int type, int value)`, matching upstream's prototype. - A null SSL throws `std::invalid_argument`, where upstream would dereference it. The gap is recorded in `docs/dev/debt/libSceLibreSsl3.md`: no handshake runs here, so the callback is never called, and the console layout is not measured. The export inventory is updated (138 exports, 128 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. No title or homebrew, and not built on Linux or macOS. - The test passes. The new `CheckInfoCallback` fills a guarded SSL with `0x5A`, sets a callback and checks that only the 8 bytes at offset 312 changed and now hold the callback. It then sets a null callback and checks that those bytes are cleared, and checks that a null SSL throws. - Two deliberate bugs make the test fail: storing the callback in `handshake_func` (offset 304), and not throwing on a null SSL. - `-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 `SSL_set_info_callback` just before opening this one, and none implements it. #16586, #16588, #16589, #16848, #16918 and #16977 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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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!16979
No description provided.