feat(libSceLibreSsl): implement SSL_set_SSL_CTX #23088
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/23088"
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 Callimann8 on 2026-11-18T18:05:26Z.
What
Implements
SSL_set_SSL_CTXin libSceLibreSsl (libSceLibreSsl3 reaches it through its parent forwardWXg9MX8BXPg). The export was aNotImplementedstub. Servers call it from the SNI callback to switch a connection to another context.SSL_set_SSL_CTX(SSL*, SSL_CTX*)sits next toSSL_freeinsrc/SslLifecycle.cppand follows LibreSSL 2.5.4'sSSL_set_SSL_CTX:DuplicateCertificate, thessl_cert_dupportSSL_newuses), the negotiated digest of each of the 7 key slots is copied over from the old holder, and the old holder is freed;SSL_CTX_free, and the new context is returned.Api.hppdeclares the export with its real signature instead of(void).ssl_cert_dup, the digest copy is skipped and the connection is left without a certificate holder.docs/dev/debt/changes/feat-libressl-ssl-set-ssl-ctx.md.Certificate holders that carry a certificate or private key still hit the existing
NotImplementedinDuplicateCertificate, asSSL_newdoes today.Tested
Linux (Ubuntu, GCC), unit test only; nothing checked on a console or in a title.
TestSetSslCtxincore/libs/tests/GuestLibreSslSslLifecycle.cppchecks the null connection throw, that setting the current context changes nothing, that switching to another context moves the reference counts, keepsinitialCtx, installs a fresh certificate holder and carries a negotiated digest over, that a null context goes back to the initial context, and that both contexts are released at the end. The guest-heap tracker'slive.empty()check catches leaks and double frees.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 PrivacyOnion on 2026-11-18T18:09:36Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
2d914921ef:tools/check_conventions.pypassed.guest_libressl_ssl_lifecycle_testsbuilt cleanly.guest_libressl_ssl_lifecycle):core/libs/prx/libSceLibreSsl/Export.cpp,core/libs/prx/libSceLibreSsl/include/Api.hpp,core/libs/prx/libSceLibreSsl/src/SslLifecycle.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T02:33:27Z.
Review: COMMENTED
Reviewed — no blocking findings
The implementation and its lifecycle tests look consistent with the stated behavior; the reported test run was not independently verified.
What I ran
Reviewed head
2d914921efaae289d1d30976847fa0ddd33a7b60. No commands or tests were run; the test result in the PR description is author-reported.Results
Negative control
Not run; no negative control was available in the prepared review materials.
Findings
Blocking
None found in the inspected implementation.
Non-blocking
None.
Sources
The review materials identify
SSL_set_SSL_CTXincore/libs/prx/libSceLibreSsl/src/SslLifecycle.cppand its test incore/libs/tests/GuestLibreSslSslLifecycle.cpp. The diff and relevant lifecycle helpers support the context reference transfer and certificate duplication behavior described in the PR.Not verified
The author reports
ctest -R guest_libressl_ssl_lifecyclepassed, but this was not run during review. The console and title behavior was not checked. Read the prepared description, commit list, manifest, diff, plus relevant ranges ofApi.hpp,SslLifecycle.cpp,Ssl.cpp, and the lifecycle test. The manifest lists five reviewed files;Export.cppand the debt fragment were not read beyond their diff hunks. Full texts were available in the prepared review folder, but not all were inspected.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T06:32:41Z.
Review: DISMISSED
Reviewed — changes requested
Changes are required before merge: preserve the SSL object’s certificate state when a context switch fails.
What I ran
6869c8a3ef6194af723eef040af2fd6495ac6947; the prepared diff identifies basemain.repo_read.py.Results
Findings
Blocking
core/libs/prx/libSceLibreSsl/src/SslLifecycle.cpp:612-613:DuplicateCertificatecan throw for unsupported certificate contents, but this function assignsssl->certonly after the call returns. If duplication throws, the old certificate remains attached while the context switch exits exceptionally. More seriously, when duplication returnsnullptron allocation failure, the function overwritesssl->certand frees the previous certificate, then continues switching contexts. Return without changing state on allocation failure (or otherwise handle failure before replacing/freeing the existing certificate), and add coverage for both failure paths.Non-blocking
None.
Not verified
guest_libressl_ssl_lifecycletest.files.jsonwas not available through the reader; the manifest lists five changed files, all marked included, and each was read.To get this to a good state
Handle certificate duplication failure before changing
ssl->certor releasing its existing certificate, and cover the failure behavior with tests.