feat(libSceLibreSsl): implement SSL_CTX_ctrl, SSL_CTX_callback_ctrl, SSL_CTX_set_msg_callback, SSL_CTX_set_verify and SSL_CTX_set_session_id_context #11138
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11138"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-10-25T19:26:31Z.
What
Implements
SSL_CTX_ctrl,SSL_CTX_callback_ctrl,SSL_CTX_set_msg_callback,SSL_CTX_set_verifyandSSL_CTX_set_session_id_contextin libSceLibreSsl, which threw and were declared without parameters.SSL_CTX_ctrlis whatSSL_CTX_set_options,set_mode,set_session_cache_mode,set_read_aheadand friends expand to, so it's the one most TLS setup code hits.This stacks on #10483 and uses its
LibreSslCtx/LibreSslCtxInternal. The diff carries #10483's commits (a local merge withmain) until it merges. #10483's functions and test are unchanged;LibreSslCtxInternalgoes frombeforeQuietShutdown[292] / quietShutdown / rest[168]to everyssl_ctx_internal_stfield named at its offset.quietShutdownstays at 292 and the size stays 464. The slots #10485 uses keep its names (newSessionCb24,appVerifyCallback48, ...alpnSelectCbArg408), so its planned move onto #10483's types is a type swap.Behaviour follows LibreSSL 2.5.4
ssl_lib.cands3_lib.c(SSL_CTX_ctrlfalls through tossl3_ctx_ctrl, the same for the callback version):long SSL_CTX_ctrl(SSL_CTX*, int cmd, long larg, void* parg)pargreturns 48, a length other than 48 queues0x14FFF145and returns 0), extra chain certs get. Commands 2, 5, 6 and 7 queue0x14FFF042and return 0; 1 returns 0. Commands not in 2.5.4's switch return 0, as that release doeslong SSL_CTX_callback_ctrl(SSL_CTX*, int cmd, void (*)(void))0x14FFF042, returns 0; anything else 0void SSL_CTX_set_msg_callback(SSL_CTX*, cb)internal->msg_callback = cbvoid SSL_CTX_set_verify(SSL_CTX*, int mode, cb)verify_mode = mode,internal->default_verify_callback = cbint SSL_CTX_set_session_id_context(SSL_CTX*, const unsigned char*, unsigned int)0x14FFF111and returns 0 with no write; else copies, sets the length, returns 1. Bytes past the new length are kept, as in 2.5.4Throws: control commands 3, 4, 14, 20, 83, 91, 92, 94, 118 and callback commands 6 and 7 (they use cert, session table, DH, ECDH, stack or group state no export builds yet), a null context, a null internal state (2.5.4 reads
ctx->internal->certon entry for every command), a null output for command 82, and a null session ID with a nonzero length. Errors go through the existingLibreSslPutError_nid_no_patchasSSLerrorxdoes (lib 20, function 0xfff), and the ERR debt entry lists the three additional SSL_CTX producers.The debt entry records the source and the throwing commands. The merged branch has 181 pending exports; main has 191.
Tested
Ubuntu 24.04 on WSL2, GCC 13.3, Release. Head
300af5cbcef1merges maina0a8b1b1733cand #104832c6493028f9f.The selected build passes. Ordinary LibreSSL tests pass: 60/60. Public headers pass: 65/65. Conventions and whitespace checks pass.
SslCtx.cppand both context tests are byte-identical to the published head. The merge removes duplicate parent layout definitions and keeps the expanded fields. The parent offsets and structure size stay unchanged. Earlier differential and mutation checks are not repeated.No console, title, Windows or macOS run. No full build, full ctest, patched or oracle run.
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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T19:30:35Z.
Review: APPROVED
Reviewed the PR-specific
SslCtx.cppbehavior against pinned LibreSSL 2.5.4ssl_lib.c/s3_lib.c, with #10483 as the declared layout dependency. I checked the command dispatch and return conventions for option/mode masks, read-ahead and cache settings, session counters, fragment bounds, ticket-key buffer length, callback setters, session-id context length, and the explicitly unsupported commands. The source-derived error reasons and the throw-vs-return boundaries are documented in the PR and debt entry. The baseSSL_CTXlayout dependency #10483 has a current review and remains open as a stack prerequisite.Local checks on the submitted tree:
SslCtx.cpp,GuestLibreSslSslCtx.cpp, andGuestLibreSslSslCtxFields.cpp: passed.python3 tools/check_conventions.py --base upstream/main --head HEAD: passed.The PR reports a byte-for-byte differential against real LibreSSL 2.5.4 for the context and internal layouts, command results, changed bytes and error queue, plus focused regression and mutation tests. Hosted eligibility, conventions, intake, labels and report pass; product/library build jobs are skipped. I did not independently run the LibreSSL runtime differential in this environment. No blocking issue found in this PR-specific change.