feat(libSceLibreSsl3): implement RSA_up_ref #13267
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13267"
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 msbutt1 on 2026-10-30T10:29:19Z.
What
Implements
RSA_up_ref(NIDjmDcorQ80dY) in libSceLibreSsl3.LibreSsl3Rsaininclude/Key.hppfollows the LibreSSL 4.0.0rsa_stlayout: 152 bytes,referencesat offset 104. Unlike libSceLibreSsl'sLibreSslRsa, it has noenginefield and haspssafteriqmp.Retain_nid_no_patchhelper used byEVP_PKEY_up_refandEC_KEY_up_ref: an atomic increment that returnsprevious > 0, matching LibreSSL'sCRYPTO_add(&r->references, 1, ...) > 1in rsa_lib.c. A null key and a count already atINT32_MAXthrow without mutation.Export.cppand the declaration inApi.hpptakesLibreSsl3Rsa*.guest_libressl3_key_referencegains anrsacase, and its shared check now also covers the overflow and null throws for all three retains.EVP_PKEY_up_ref/EC_KEY_up_refdebt entry is extended to RSA: the console layout and retain/release interoperability remain unverified.Overlap: #10490 also defines
LibreSsl3RsainApi.hppwith the same 152-byte layout, collapsing the fields afteriqmpintounsigned char rest[64]. Landing order, agreed with @alvaroelpob: #10490 first. After it merges, this PR rebases, drops its ownLibreSsl3RsafromKey.hpp, and replaces #10490'sunsigned char rest[64]with the named fields afteriqmp(pss,extraData,references,flags,methodModN,methodModP,methodModQ,blinding,mtBlinding), so one definition remains.static_assert(offsetof(LibreSsl3Rsa, references) == 104)moves tosrc/Key.cpp, next to #10490's size and offset checks inKeyComponents.cpp. That version is prepared on #10490 head16858710b4(commit4ca49b48a2): conventions pass, and all libSceLibreSsl3 tests pass on it, including #10490'sguest_libressl3_key_components. The branch is updated once #10490 is inmain.Tested
Ubuntu 22.04, GCC 11.4.0, Release build with
BUILD_TESTING=ON, headf1f3ba8ed4onmain3bc58629fb(same patch-id as the earlier headdd9cf1591b). No title tested.ctest --test-dir build -R "guest_libressl3|guest_crypto_memcmp|^public_headers": 69/69 passed (guest_libressl3_key_reference0.01 s,public_headersand all 64public_headers_compile_*batches).python3 -I tools/check_conventions.py --base origin/main --head HEAD: all checks passed;git diff --checkclean.guest_libressl3_key_reference3/3 ondd9cf1591b, run by @JJenkx.RSA_up_refinsrc/Key.cppmutated,guest_libressl3_key_reference_tests rsa:flagsinstead ofreferencesretain changed bytes outside reference countretain return valueINT32_MAXcheck (fetch_add)retain at maximum count did not throwatomic_refconcurrent count or adjacent bytes changed, 20/20 runsChecklist
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-30T10:35:42Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The current overlap with #10490 leaves duplicate
LibreSsl3Rsadefinitions unless the landing order and resulting single declaration are coordinated.What I ran
Reviewed #13267 head
dd9cf1591b3f9858084f6ab152042d186945416b; its recorded base isdd6cb90fc6bfffdf0787a4d838e2ad4d0eacc209. Currentmainis20d3cd84bc5a9f4a5b1f826cc678849187573d34; the head merges cleanly onto it. I also compared the open #10490 headad00df544b5893dbe5f5db8ac5eabf9d008e735bwith this branch. Environment: Debian 12, x86-64, Python 3.11.2, Git 2.39.5. No build or C++ tests were run locally.Results
checks failedbecause the isolated checkout lacks the local-only ABI and test-quality helper scripts. I ran those two focused helpers separately against this exact head. The initial GitHub-mode precheck could not complete because the livemainadvanced while the PR's recorded base remaineddd6cb90f; I then ran local mode against currentmain.CMakeLists.txtregistersGuestLibreSsl3KeyReference.cpp; the warning is a false positive.0d31a3a8c8fe089e0bc252a8980a88b07f9e8054.docs/dev/debt/libSceLibreSsl3.md; the headers auto-merged. Inspection of the merged tree showsLibreSsl3Rsadefined in bothApi.hppandKey.hpp. No compilation was run.Unedited check output
Diff check produced no output.
Conventions:
ABI audit summary:
Test-quality heuristic:
Precheck output:
Current-main merge preview:
Pairwise #10490/#13267 merge preview:
Findings
Blocking
#10490's current
Api.hppincludesKey.hppand then definesLibreSsl3Rsa; #13267 adds another definition of the same type toKey.hpp. The two heads therefore produce a duplicate type definition when integrated, even though their individual branches are each mergeable. The PR description recognizes that whichever change lands second must retain the named fields, but neither PR currently declares the agreed order. Please coordinate the order with #10490's author, keep the type defined in one header in the resulting branch, and declare the dependency on the checklist of the PR that follows, asCONTRIBUTING.mdrequires.Non-blocking
No additional confirmed findings in the
RSA_up_refimplementation or its reference-count tests.Sources
LibreSsl3Rsadefinition at its reviewed head.Api.hppincludesKey.hppand defines the same type at its current head.main.Not verified
No local build, C++ test run, Windows or Linux runtime test, title/homebrew run, or PS5 console behavior. The hosted Windows/product checks were not present in the current check snapshot. The broad
pr_overlap.pyscan was interrupted; the known overlap with #10490 was inspected directly.To get this to a good state
Coordinate and declare the landing order with #10490, remove the duplicate
LibreSsl3Rsadefinition from the second branch while preserving the named fields needed byRSA_up_ref, and obtain fresh CI. I will rerun the same relevant checks on the updated head.