Repository navigation
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
Conversation
…lssl-sslctx-fields # Conflicts: # core/libs/prx/libSceLibreSsl/CMakeLists.txt # docs/dev/debt/libSceLibreSsl.md
…SSL_CTX_set_msg_callback, SSL_CTX_set_verify and SSL_CTX_set_session_id_context
Progress report (a0a8b1b → 300af5c)📈 System libraries: 26.83% (+0.02%, +8 implemented functions) ✅ 8 implemented
Changed libraries (implemented exports)
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed the PR-specific SslCtx.cpp behavior against pinned LibreSSL 2.5.4 ssl_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 base SSL_CTX layout dependency #10483 has a current review and remains open as a stack prerequisite.
Local checks on the submitted tree:
- GCC 12.2 syntax-only compilation of
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.
|
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.
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.
|
|
A Windows run of this head, since the description doesn't cover Windows: Windows 11 Home 10.0.26200, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release.
AI-assisted: yes (Claude Code) |
|
@ahmadmuj One change in the tests: please remove the two loops that require unsupported commands to throw, at Please keep the supported-command, error-queue and full-buffer regressions and the real invalid-argument tests. #10483 still needs to land first. |
|
@AdnanKhan-ak47 thanks for the merge offer. I merged it myself in the end so the branch stays merge-commit only: head is now 0211156, with |
# Conflicts: # docs/dev/debt/libSceLibreSsl.md
✅ AMD GPU test: passedPR head
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (9, not counted against this PR)Validation IDs already present on main (8 IDs in 731 tests)Skipped (9)ReproduceAutomated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
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)