feat(libSceLibreSsl): implement UI_METHOD creation and its opener, writer, reader and closer accessors #10376
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10376"
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 alvaroelpob on 2026-10-23T20:03:28Z.
What
Implements
UI_create_method,UI_destroy_method,UI_method_set_opener,UI_method_set_writer,UI_method_set_reader,UI_method_set_closerand the four matchingUI_method_get_exports in libSceLibreSsl. All ten threw and were declared without parameters.The module is LibreSSL 2.5.4 (firmware 13.40 measurements in #8981). Signatures and behaviour follow that release's
ui_lib.candui.h:UI_METHOD* UI_create_method(char* name)ui_method_st(56 bytes, the field order of that release'sui_locl.h) from the guest heap, with a guest-heap copy ofnamewhen it is not null; null if the method can't be allocated, and a null name if only the copy failsvoid UI_destroy_method(UI_METHOD*)int UI_method_set_opener/writer/reader/closer(UI_METHOD*, fn)fn UI_method_get_opener/writer/reader/closer(UI_METHOD*)The callbacks are only stored, never called. The exports that would run a method are
UI_OpenSSLandENGINE_load_private_key;UI_newandUI_processaren't exported. Those, along withUI_get0_user_data,UI_get_input_flags,UI_get_string_typeandUI_set_result, which only make sense inside a running method, still throw.UI_destroy_method(NULL)dereferences null in LibreSSL, so it throws here.The debt entry records the source and what is unverified, and the pending-export count drops from 357 to 347.
Tested
Ubuntu (WSL2, kernel 6.18), GCC 15.2.0, Release, full build with
BUILD_TESTING=ONonmain3c44638fc. There is one commit per function:UI_create_method,UI_destroy_method, then each setter followed by its getter (opener, writer, reader, closer). Each commit adds that function with its test block and debt update. Each was built and itsguest_libressl_uitest andcheck_conventions.pyrun on its own.New
guest_libressl_uitest:UI_destroy_method(NULL)throws.On
mainthe first call throws.ctest --test-dir build -R guest_libressl: 6/6 pass.Full
ctest -j16at the last commit: 1991/1993 pass.agc_driver_multisample_retirementfails the same way onmainon this machine.agc_driver_sgpr_pattern_fill_keysfails only under parallel load onmaintoo, and passes when run alone.Not tested: Windows, a title.
Rebased on
main1e740a23a3(after #9033), head e354256104: the conflicts were only theadd_librarysource list, the end of the test block, the pending-export count and the last debt entry; both sides are kept and the count is 357 minus this PR's exports. Full build andctest -j16: 2043/2044 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.Rebased on
maine7e3e9c198, head 8e0c682151, to resolve the conflict from #9529 on the sharedCMakeLists.txtand debt-file lines; both sides are kept and the count is 353 minus this PR's exports. 8e0c682151 (refactor(libSceLibreSsl): declare the UI_METHOD exports in the public header) puts the real signatures and their structs inlibSceLibreSsl/include/Api.hppand drops the test's redeclarations, whichpublic_headersrequires since #10706. Full build andctest -j16: 2202/2203 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.Rebased on
mainae7d59258e(after #9949), head 2009c40e1f, to resolve the conflicts withmainon the sharedCMakeLists.txtand debt-file lines; both sides are kept and the count is 342 minus this PR's exports. Full build andctest -j16: 2275/2276 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.Rebased on
main2dbe9b99f5(after #9745, #9870 and #11111), head f9fdb8652c, to resolve the conflicts withmainon the sharedCMakeLists.txtand debt-file lines; both sides are kept and the count is 340 minus this PR's exports. Full build andctest -j16: 2370/2371 pass;agc_driver_multisample_retirementfails the same way on thatmain.check_conventions.py --base upstream/mainpasses.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 copilot-pull-request-reviewer[bot] on 2026-10-23T20:03:34Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T20:07:17Z.
Review: DISMISSED
I reviewed the exact head 6d974fc6a6590e758faaa5530f23b8e784b152d0. The LibreSSL 2.5.4 UI method fields, guest allocation, setters/getters and focused test coverage are clearly documented. Before merge, the required shared-file coordination is unresolved: direct
git merge-tree --write-treechecks show content conflicts with open #9529 and #10373 incore/libs/prx/libSceLibreSsl/CMakeLists.txtanddocs/dev/debt/libSceLibreSsl.md, and a debt-file conflict with #10071. This PR currently saysDepends on: none. CONTRIBUTING asks authors to agree which overlapping PR lands first and record that dependency. Please coordinate the order with those authors, update the checklist, and confirm the combined test registrations and all debt entries/counts are retained. The conflicts are in shared integration files; I found no conflicting UI export implementation in this check.Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-10-25T18:48:44Z.
Review: APPROVED
Reviewed head 8e0c682151d0, merged locally onto main
a7a2eece49(Linux, GCC 13.3, Ninja, Release).What I ran:
ctest -R libressl: 11/11 pass,guest_libressl_uiincluded.guest_libressl_ui_testsbinary against main'slibSceLibreSsl.prx(58c9977e3b, no LibreSSL or libc changes sincea7a2eec) aborts withUI_create_method_nid_postfix not implemented.libcrypto.abuilt from the release tarball): one probe calls the 2.5.4 functions on aUI_METHOD, the other calls these exports onLibreSslUiMethod, with the same inputs. It covers sizeof and every field offset (56; 0, 8, 16, 24, 32, 40, 48), the bytes after create, after setting all 4 callbacks and after clearing 2, the setter returns, the getters, null-method set/get (-1 and null), and a null and an empty name. Output is identical, 8/8 lines.tools/check_conventions.py --base origin/mainpasses on the merge and on the head;git diff --checkis clean.Sources: 2.5.4
crypto/ui/ui_lib.c(UI_create_methodtoUI_method_get_closer) andui_locl.h(struct ui_method_st). Each export writes and reads the right field. Create matches calloc + strdup, including a null name when the copy fails. Destroy frees the name and then the method. Throwing on a null destroy fits CONTRIBUTING, because 2.5.4 dereferences the pointer there.Export.cpp drops exactly these 10 stubs. Each one is declared once in
include/Api.hpp. The 5 otherUI_stubs still throw.The only thing left is the rebase: the debt file conflicts with main on the pending count. With main's 345 minus these 10, the count is 335, and that matches the 335
NotImplemented_nid_no_patchstubs left in Export.cpp after my merge. Everything else merges cleanly.Not tested: console behaviour, Windows or macOS, or a full ctest run.