feat(libSceLibreSsl3): implement RSA component ownership setters #14992

Merged
atharvjairath merged 3 commits from upstream-pr/14992 into main 2026-11-06 05:50:43 +00:00
atharvjairath commented 2026-11-02 08:31:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by atharvjairath on 2026-11-02T08:31:30Z.


What

Calls to RSA_set0_key, RSA_set0_factors and RSA_set0_crt_params now transfer BIGNUM ownership into the corresponding RSA fields. Supplying too few mandatory components returns zero before changing the object. Replacing an owned component clears its storage through BN_clear_free. Borrowed static limb storage stays under its original owner’s control.

The implementation uses the 152-byte RSA and 24-byte BIGNUM layouts. The parent library has BIGNUM constructors and destructors. Interoperation across its forwarding exports and these setters still needs verification. LibreSSL 4.0.0 RSA setters · BIGNUM disposal

An omitted component retains the existing field. A null RSA object or a negative owned limb capacity throws before mutation. Console ABI, malformed pointers and aliased ownership remain documented limits.

The source scanner classifies 23/276 bodies as implemented on main and 27/276 on this branch. The difference is the 4 exports above. The scanner classifies source bodies and does not measure firmware compatibility. The additional export inventory has 171 pending entries (161 named, 10 known only by NID).

Integration order is #14992 → #15031 → #15045 → #15119 → #15406. This branch is based directly on main 6d173c1a1978. Each branch keeps its own changes. The order allows the shared CMake registrations and debt counts to be reconciled after each merge.

Tested

Validated head bc7b197f78b9 against main 6d173c1a1978.

  • Linux: GCC 13.3 x86-64 under QEMU 11.0.3, 21 passed, 0 failed, 0 skipped. The upstream mixed-EVP fixture patched and loaded real modules in both library orders.
  • Windows PE: WinLibs 15.2 UCRT under Wine 9 and QEMU 11.0.3, 20 passed, 0 failed, 0 skipped. Both platforms ran the module’s registered direct tests and the owned fixture. The owned fixture completed in 0.0649463 s on Linux and 1.02404 s under Wine. Loader traces identified this branch’s module.
  • Rebuilt LibreSSL3 independently per branch. The common libc, kernel and parent LibreSSL binaries were rebuilt once per platform from sources identical across the five branches. A translation unit including the public LibreSSL3 umbrella twice compiled with warnings treated as errors on both platforms. The focused selection uses the registered timeouts and leaves the optional oracle and separate parent error-string and packaged-NID groups outside this run. Full-product, native Windows and console testing remain outside this run.
  • The first external Windows harness omitted the repository’s libc unwind post-build step. It built liblibc.dll with the .eh_frame section and exception fixtures failed. The corrected harness uses configure_windows_unwind(libc), which produces .ehfram. Windows counts above are from the corrected build.
  • Integration previews on later main 7ad9749ed0 preserved the exact branch and upstream diffs. Runtime results above are pinned to the tested base.
  • Conventions and diff checks passed. The repository-wide public-header audit exited 1 with the same five WebKit declarations reported on a separate snapshot of the tested main commit.
  • The overlap tool exited 2 and reported 54 PRs, including 31 it could not compare cleanly with main. Manual comparison of shared registrations, APIs, debt and export changes found no competing implementation of these exports.

Earlier ownership runs and negative controls are archived at their tested commits. The remaining lifetime gap is a forwarded parent constructor followed by the setter and destructor in the guest.

Both loader runs printed RSA ownership: 144 matrix cases, 39790 checks, 847 cleared allocations, zero live allocations.

Earlier validation on f7212289bbd0 and the historical commits cited below

Current refreshed head f7212289bbd01fd608e290b6cfec264e8be236a7 on frozen main d1ae628bc2f62459cce1e9872ba5632c938c71f2. Only debt documentation conflicted. Every original owned production/API/CMake/fixture addition and deletion is preserved; upstream ASN1_TIME_diff and all main unions remain intact. Prior reviews and CI are pinned to older heads below.

  • Linux GCC 13.3, x86-64 through native ARM QEMU 11.0.3: complete real LibreSSL3 module and all registered modern/crypto fixtures rebuilt, 12/12 passed in 1.08s.
  • Windows PE WinLibs GCC 15.2 UCRT/Wine 9 through native ARM QEMU 11.0.3: real LibreSSL3 module and all registered executables rebuilt serially (-j1), 12/12 passed in 36.97s.
  • The PR’s fixture still reports 144 mask cases / 39,790 checks / 847 cleared allocations / zero live allocations on both platforms (0.0635126s Linux / 3.31712s Windows PE). All 11 LibreSSL3 registrations, including new upstream time/version cases, plus crypto_memcmp are included. Actual registered timeouts are preserved. Loader traces verify each PR’s fixture loads its own rebuilt module.
  • Common libc and parent LibreSSL artifacts are reused from the freshly rebuilt, exact-source-identical d1ae628 integration, with full dependency-input equality and hashes retained. They were not rebuilt separately for each of these four PRs. The separate signature integration ran 44 Linux and 14 focused Windows tests; those are not this PR’s suite counts. This refresh does not rerun the separate parent/error-string/packaged protocol-NID groups.
  • After-commit conventions, diff check, public-header audit and twice-included standalone Linux C++20/-Werror umbrella pass. Exact overlap CLI exits 2, not an automated pass. Every currently reported external peer’s shared payload is manually compared; the report can include this PR’s own old published head, which is the same implementation being refreshed, not a competing duplicate. Full current reports and head/merge-base snapshots are retained below.

These are focused module tests, not independent native Windows, full-product, packaged-module/NID, title/homebrew or physical-console validation. Known unrelated Wine limitations remain unresolved; no assertion, timeout, gate or runtime workaround changed. The default-off oracle was not enabled. Warnings remain. No new native CI result or current approval is inferred from older heads.

Historical native Windows CI job125279575645/run41443267437 audited on main 0278ca983148dbb9b8b54a267b2aeab0ce8aff37 plus OLD head 376db33f6d29241aa5cfdf6cb710bc1e7f5e8683: 1,962 Passed / 952 Skipped / zero Failed across 2,914 unique result rows, 147.19s; all 44 LibreSSL registrations including RSA passed. Separate full-build/runtime/skip-audit/graph steps were skipped. This is pinned native CI unit/runtime evidence, not a run or approval of the refreshed head. Original local Linux 40/40 and Windows PE 11/11 remain archived at 77bf/88e804. The earlier 45-minute cancellation is historical and was superseded by that successful old-head run.

Receipts: /private/tmp/anyps5-advance-20261103-0127/conflict-refresh/14992 and the shared validation-evidence.tar.gz, common-input-equality.json, heads-rebased.json, manual-shared-review.txt, peers-final and reproducible harness/scripts. Previous local/native evidence remains in the linked Nov2 receipts with its original pins.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
Overlap report before the branch refresh was pushed

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.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 14366 docs/dev/debt/libSceLibreSsl3.md L35, L215
PR 14465 docs/dev/debt/libSceLibreSsl3.md L35
PR 14483 docs/dev/debt/libSceLibreSsl3.md L35
PR 14889 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp L259-266
core/libs/prx/libSceLibreSsl3/include/Api.hpp L193-194
docs/dev/debt/libSceLibreSsl3.md L35, L215
PR 14890 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp L6-17
core/libs/prx/libSceLibreSsl3/include/Api.hpp L123-125
docs/dev/debt/libSceLibreSsl3.md L35, L215
PR 14992 BN_clear_free
RSA_set0_crt_params
RSA_set0_factors
RSA_set0_key
core/libs/prx/libSceLibreSsl3/src/RsaSetters.cpp
core/libs/prx/libSceLibreSsl3/tests/RsaSetters.cpp
PR 15289 docs/dev/debt/libSceLibreSsl3.md L35, L75-76
PR 15303 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp L648-655
core/libs/prx/libSceLibreSsl3/include/Api.hpp L288-289
docs/dev/debt/libSceLibreSsl3.md L35, L75-76
PR 15449 docs/dev/debt/libSceLibreSsl3.md L35, L215
PR 15472 docs/dev/debt/libSceLibreSsl3.md L35
PR 15514 docs/dev/debt/libSceLibreSsl3.md L35
PR 15591 docs/dev/debt/libSceLibreSsl3.md L35
PR 15616 docs/dev/debt/libSceLibreSsl3.md L35
PR 15618 docs/dev/debt/libSceLibreSsl3.md L35
PR 15620 docs/dev/debt/libSceLibreSsl3.md L35
PR 15622 docs/dev/debt/libSceLibreSsl3.md L35
PR 15623 docs/dev/debt/libSceLibreSsl3.md L35
PR 15625 docs/dev/debt/libSceLibreSsl3.md L35
PR 15627 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp L14-21
core/libs/prx/libSceLibreSsl3/include/Api.hpp L125-126
docs/dev/debt/libSceLibreSsl3.md L35
PR 15628 docs/dev/debt/libSceLibreSsl3.md L35
PR 15629 docs/dev/debt/libSceLibreSsl3.md L35
PR 15826 docs/dev/debt/libSceLibreSsl3.md L35
PR 15831 docs/dev/debt/libSceLibreSsl3.md L35, L76-77
PR 15854 docs/dev/debt/libSceLibreSsl3.md L35

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.

Pull request Shared files not compared
PR 10452 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 10461 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 10490 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 10491 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 10493 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 10631 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 11146 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
docs/dev/debt/libSceLibreSsl3.md
PR 12315 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 12754 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
core/libs/prx/libSceLibreSsl3/include/Key.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 12928 core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 13486 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 14212 docs/dev/debt/libSceLibreSsl3.md
PR 14499 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 14612 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 14992 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
core/libs/prx/libSceLibreSsl3/include/Key.hpp
core/libs/prx/libSceLibreSsl3/src/RsaSetters.cpp
core/libs/prx/libSceLibreSsl3/tests/RsaSetters.cpp
docs/dev/debt/libSceLibreSsl3.md
PR 15031 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15045 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15119 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15163 core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15406 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15544 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15599 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15601 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
docs/dev/debt/libSceLibreSsl3.md
PR 15631 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15737 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15758 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15760 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15761 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15765 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15770 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15899 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5117308275 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14992). Originally posted by [atharvjairath](https://github.com/atharvjairath) on 2026-11-02T08:31:30Z. --- ### What Calls to `RSA_set0_key`, `RSA_set0_factors` and `RSA_set0_crt_params` now transfer BIGNUM ownership into the corresponding RSA fields. Supplying too few mandatory components returns zero before changing the object. Replacing an owned component clears its storage through `BN_clear_free`. Borrowed static limb storage stays under its original owner’s control. The implementation uses the 152-byte RSA and 24-byte BIGNUM layouts. The parent library has BIGNUM constructors and destructors. Interoperation across its forwarding exports and these setters still needs verification. [LibreSSL 4.0.0 RSA setters](https://github.com/libressl/openbsd/blob/ce488b78e0bd994780569df718596b9776ff681a/src/lib/libcrypto/rsa/rsa_lib.c) · [BIGNUM disposal](https://github.com/libressl/openbsd/blob/ce488b78e0bd994780569df718596b9776ff681a/src/lib/libcrypto/bn/bn_lib.c) An omitted component retains the existing field. A null RSA object or a negative owned limb capacity throws before mutation. Console ABI, malformed pointers and aliased ownership remain documented limits. The source scanner classifies 23/276 bodies as implemented on main and 27/276 on this branch. The difference is the 4 exports above. The scanner classifies source bodies and does not measure firmware compatibility. The additional export inventory has 171 pending entries (161 named, 10 known only by NID). Integration order is #14992 → #15031 → #15045 → #15119 → #15406. This branch is based directly on main `6d173c1a1978`. Each branch keeps its own changes. The order allows the shared CMake registrations and debt counts to be reconciled after each merge. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Validated head `bc7b197f78b9` against main `6d173c1a1978`. - **Linux:** GCC 13.3 x86-64 under QEMU 11.0.3, 21 passed, 0 failed, 0 skipped. The upstream mixed-EVP fixture patched and loaded real modules in both library orders. - **Windows PE:** WinLibs 15.2 UCRT under Wine 9 and QEMU 11.0.3, 20 passed, 0 failed, 0 skipped. Both platforms ran the module’s registered direct tests and the owned fixture. The owned fixture completed in 0.0649463 s on Linux and 1.02404 s under Wine. Loader traces identified this branch’s module. - Rebuilt LibreSSL3 independently per branch. The common libc, kernel and parent LibreSSL binaries were rebuilt once per platform from sources identical across the five branches. A translation unit including the public LibreSSL3 umbrella twice compiled with warnings treated as errors on both platforms. The focused selection uses the registered timeouts and leaves the optional oracle and separate parent error-string and packaged-NID groups outside this run. Full-product, native Windows and console testing remain outside this run. - The first external Windows harness omitted the repository’s libc unwind post-build step. It built liblibc.dll with the .eh_frame section and exception fixtures failed. The corrected harness uses configure_windows_unwind(libc), which produces .ehfram. Windows counts above are from the corrected build. - Integration previews on later main 7ad9749ed031 preserved the exact branch and upstream diffs. Runtime results above are pinned to the tested base. - Conventions and diff checks passed. The repository-wide public-header audit exited 1 with the same five WebKit declarations reported on a separate snapshot of the tested main commit. - The overlap tool exited 2 and reported 54 PRs, including 31 it could not compare cleanly with main. Manual comparison of shared registrations, APIs, debt and export changes found no competing implementation of these exports. Earlier ownership runs and negative controls are archived at their tested commits. The remaining lifetime gap is a forwarded parent constructor followed by the setter and destructor in the guest. Both loader runs printed `RSA ownership: 144 matrix cases, 39790 checks, 847 cleared allocations, zero live allocations`. <details> <summary>Earlier validation on f7212289bbd0 and the historical commits cited below</summary> Current refreshed head `f7212289bbd01fd608e290b6cfec264e8be236a7` on frozen main `d1ae628bc2f62459cce1e9872ba5632c938c71f2`. Only debt documentation conflicted. Every original owned production/API/CMake/fixture addition and deletion is preserved; upstream ASN1_TIME_diff and all main unions remain intact. Prior reviews and CI are pinned to older heads below. - Linux GCC 13.3, x86-64 through native ARM QEMU 11.0.3: complete real LibreSSL3 module and all registered modern/crypto fixtures rebuilt, **12/12 passed in 1.08s**. - Windows PE WinLibs GCC 15.2 UCRT/Wine 9 through native ARM QEMU 11.0.3: real LibreSSL3 module and all registered executables rebuilt serially (`-j1`), **12/12 passed in 36.97s**. - The PR’s fixture still reports **144 mask cases / 39,790 checks / 847 cleared allocations / zero live allocations** on both platforms (0.0635126s Linux / 3.31712s Windows PE). All 11 LibreSSL3 registrations, including new upstream time/version cases, plus crypto_memcmp are included. Actual registered timeouts are preserved. Loader traces verify each PR’s fixture loads its own rebuilt module. - Common libc and parent LibreSSL artifacts are reused from the freshly rebuilt, exact-source-identical `d1ae628` integration, with full dependency-input equality and hashes retained. They were not rebuilt separately for each of these four PRs. The separate signature integration ran 44 Linux and 14 focused Windows tests; those are not this PR’s suite counts. This refresh does not rerun the separate parent/error-string/packaged protocol-NID groups. - After-commit conventions, diff check, public-header audit and twice-included standalone Linux C++20/-Werror umbrella pass. Exact overlap CLI exits **2**, not an automated pass. Every currently reported external peer’s shared payload is manually compared; the report can include this PR’s own old published head, which is the same implementation being refreshed, not a competing duplicate. Full current reports and head/merge-base snapshots are retained below. These are focused module tests, not independent native Windows, full-product, packaged-module/NID, title/homebrew or physical-console validation. Known unrelated Wine limitations remain unresolved; no assertion, timeout, gate or runtime workaround changed. The default-off oracle was not enabled. Warnings remain. No new native CI result or current approval is inferred from older heads. Historical native Windows CI [job125279575645/run41443267437](https://github.com/boykopovar/AnyPS5/actions/runs/41443267437/job/125279575645) audited on main `0278ca983148dbb9b8b54a267b2aeab0ce8aff37` plus OLD head `376db33f6d29241aa5cfdf6cb710bc1e7f5e8683`: 1,962 Passed / 952 Skipped / zero Failed across 2,914 unique result rows, 147.19s; all 44 LibreSSL registrations including RSA passed. Separate full-build/runtime/skip-audit/graph steps were skipped. This is pinned native CI unit/runtime evidence, not a run or approval of the refreshed head. Original local Linux 40/40 and Windows PE 11/11 remain archived at 77bf/88e804. The earlier 45-minute cancellation is historical and was superseded by that successful old-head run. Receipts: `/private/tmp/anyps5-advance-20261103-0127/conflict-refresh/14992` and the shared `validation-evidence.tar.gz`, `common-input-equality.json`, `heads-rebased.json`, `manual-shared-review.txt`, `peers-final` and reproducible harness/scripts. Previous local/native evidence remains in the linked Nov2 receipts with its original pins. </details> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no --> <details> <summary>Overlap report before the branch refresh was pushed</summary> 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**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 14366](https://www.github.com/boykopovar/AnyPS5/pull/14366) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35), [L215](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L215) | | | | [PR 14465](https://www.github.com/boykopovar/AnyPS5/pull/14465) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35) | | | | [PR 14483](https://www.github.com/boykopovar/AnyPS5/pull/14483) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35) | | | | [PR 14889](https://www.github.com/boykopovar/AnyPS5/pull/14889) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp` [L259-266](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp#L259-L266)<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp` [L193-194](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/core/libs/prx/libSceLibreSsl3/include/Api.hpp#L193-L194)<br>`docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35), [L215](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L215) | | | | [PR 14890](https://www.github.com/boykopovar/AnyPS5/pull/14890) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp` [L6-17](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp#L6-L17)<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp` [L123-125](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/core/libs/prx/libSceLibreSsl3/include/Api.hpp#L123-L125)<br>`docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35), [L215](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L215) | | | | [PR 14992](https://www.github.com/boykopovar/AnyPS5/pull/14992) | | `BN_clear_free`<br>`RSA_set0_crt_params`<br>`RSA_set0_factors`<br>`RSA_set0_key` | `core/libs/prx/libSceLibreSsl3/src/RsaSetters.cpp`<br>`core/libs/prx/libSceLibreSsl3/tests/RsaSetters.cpp` | | [PR 15289](https://www.github.com/boykopovar/AnyPS5/pull/15289) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35), [L75-76](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L75-L76) | | | | [PR 15303](https://www.github.com/boykopovar/AnyPS5/pull/15303) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp` [L648-655](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp#L648-L655)<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp` [L288-289](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/core/libs/prx/libSceLibreSsl3/include/Api.hpp#L288-L289)<br>`docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35), [L75-76](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L75-L76) | | | | [PR 15449](https://www.github.com/boykopovar/AnyPS5/pull/15449) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35), [L215](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L215) | | | | [PR 15472](https://www.github.com/boykopovar/AnyPS5/pull/15472) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35) | | | | [PR 15514](https://www.github.com/boykopovar/AnyPS5/pull/15514) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35) | | | | [PR 15591](https://www.github.com/boykopovar/AnyPS5/pull/15591) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35) | | | | [PR 15616](https://www.github.com/boykopovar/AnyPS5/pull/15616) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35) | | | | [PR 15618](https://www.github.com/boykopovar/AnyPS5/pull/15618) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35) | | | | [PR 15620](https://www.github.com/boykopovar/AnyPS5/pull/15620) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35) | | | | [PR 15622](https://www.github.com/boykopovar/AnyPS5/pull/15622) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35) | | | | [PR 15623](https://www.github.com/boykopovar/AnyPS5/pull/15623) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35) | | | | [PR 15625](https://www.github.com/boykopovar/AnyPS5/pull/15625) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35) | | | | [PR 15627](https://www.github.com/boykopovar/AnyPS5/pull/15627) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp` [L14-21](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp#L14-L21)<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp` [L125-126](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/core/libs/prx/libSceLibreSsl3/include/Api.hpp#L125-L126)<br>`docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35) | | | | [PR 15628](https://www.github.com/boykopovar/AnyPS5/pull/15628) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35) | | | | [PR 15629](https://www.github.com/boykopovar/AnyPS5/pull/15629) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35) | | | | [PR 15826](https://www.github.com/boykopovar/AnyPS5/pull/15826) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35) | | | | [PR 15831](https://www.github.com/boykopovar/AnyPS5/pull/15831) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35), [L76-77](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L76-L77) | | | | [PR 15854](https://www.github.com/boykopovar/AnyPS5/pull/15854) | `docs/dev/debt/libSceLibreSsl3.md` [L35](https://github.com/boykopovar/AnyPS5/blob/7ad9749ed0311cc91d69bc7c690d09c92b9d42d0/docs/dev/debt/libSceLibreSsl3.md#L35) | | | 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. | Pull request | Shared files not compared | |---|---| | [PR 10452](https://www.github.com/boykopovar/AnyPS5/pull/10452) | `core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 10461](https://www.github.com/boykopovar/AnyPS5/pull/10461) | `core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 10490](https://www.github.com/boykopovar/AnyPS5/pull/10490) | `core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 10491](https://www.github.com/boykopovar/AnyPS5/pull/10491) | `core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 10493](https://www.github.com/boykopovar/AnyPS5/pull/10493) | `core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 10631](https://www.github.com/boykopovar/AnyPS5/pull/10631) | `core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 11146](https://www.github.com/boykopovar/AnyPS5/pull/11146) | `core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 12315](https://www.github.com/boykopovar/AnyPS5/pull/12315) | `core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 12754](https://www.github.com/boykopovar/AnyPS5/pull/12754) | `core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`core/libs/prx/libSceLibreSsl3/include/Key.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 12928](https://www.github.com/boykopovar/AnyPS5/pull/12928) | `core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 13486](https://www.github.com/boykopovar/AnyPS5/pull/13486) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp`<br>`core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 14212](https://www.github.com/boykopovar/AnyPS5/pull/14212) | `docs/dev/debt/libSceLibreSsl3.md` | | [PR 14499](https://www.github.com/boykopovar/AnyPS5/pull/14499) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 14612](https://www.github.com/boykopovar/AnyPS5/pull/14612) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp`<br>`core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 14992](https://www.github.com/boykopovar/AnyPS5/pull/14992) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp`<br>`core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`core/libs/prx/libSceLibreSsl3/include/Key.hpp`<br>`core/libs/prx/libSceLibreSsl3/src/RsaSetters.cpp`<br>`core/libs/prx/libSceLibreSsl3/tests/RsaSetters.cpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 15031](https://www.github.com/boykopovar/AnyPS5/pull/15031) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp`<br>`core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 15045](https://www.github.com/boykopovar/AnyPS5/pull/15045) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp`<br>`core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 15119](https://www.github.com/boykopovar/AnyPS5/pull/15119) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp`<br>`core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 15163](https://www.github.com/boykopovar/AnyPS5/pull/15163) | `core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 15406](https://www.github.com/boykopovar/AnyPS5/pull/15406) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp`<br>`core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 15544](https://www.github.com/boykopovar/AnyPS5/pull/15544) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp`<br>`core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 15599](https://www.github.com/boykopovar/AnyPS5/pull/15599) | `core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 15601](https://www.github.com/boykopovar/AnyPS5/pull/15601) | `core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 15631](https://www.github.com/boykopovar/AnyPS5/pull/15631) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp`<br>`core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 15737](https://www.github.com/boykopovar/AnyPS5/pull/15737) | `core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 15758](https://www.github.com/boykopovar/AnyPS5/pull/15758) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp`<br>`core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 15760](https://www.github.com/boykopovar/AnyPS5/pull/15760) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp`<br>`core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 15761](https://www.github.com/boykopovar/AnyPS5/pull/15761) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp`<br>`core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 15765](https://www.github.com/boykopovar/AnyPS5/pull/15765) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp`<br>`core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 15770](https://www.github.com/boykopovar/AnyPS5/pull/15770) | `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp`<br>`core/libs/prx/libSceLibreSsl3/CMakeLists.txt`<br>`core/libs/prx/libSceLibreSsl3/include/Api.hpp`<br>`docs/dev/debt/libSceLibreSsl3.md` | | [PR 15899](https://www.github.com/boykopovar/AnyPS5/pull/15899) | `core/libs/prx/libSceLibreSsl3/CMakeLists.txt` | </details>
BunnyFl commented 2026-11-02 11:45:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-02T11:45:10Z.

Review: APPROVED


Looks right against the cited LibreSSL 4.0.0 source (ce488b78).

  • Setters. RSA_set0_key, RSA_set0_factors and RSA_set0_crt_params return 0 before any change when a required component is missing on both sides. Otherwise they free each replaced component and store the supplied one, keeping omitted ones, exactly as in rsa_lib.c.
  • Freeing. In 4.0.0, BN_clear_free is BN_free. It frees the limbs (freezero(d, dmax * 8)) unless BN_FLG_STATIC_DATA (2) is set, then wipes the struct and frees it only when BN_FLG_MALLOCED (1) is set. Your Allocated/StaticData values and the 24-byte {d, top, dmax, neg, flags} layout match.

Tested on Windows 11, WinLibs GCC 15.2.0, Release, with head 77bf9cdd90 merged onto main: guest_libressl3_rsa_setters and public_headers pass. On main all four exports throw, and RsaSetters.cpp is new, so the control is the throwing stubs.

Non-blocking:

  • These free with free_nid_postfix, but libSceLibreSsl3's BN_new/BN_free forward to the parent libSceLibreSsl (ParentExports.cpp), where both still throw. Whatever later implements the parent's BN_new has to allocate the struct and limbs from the same guest heap, with BN_FLG_MALLOCED set, or these setters will free foreign memory. One line in the debt entry would keep that coupling visible.
  • The module is "LibreSsl3", while the entry cites 4.0.0. The BIGNUM layout and these setters are the same in the 3.x series (3.x's BN_free doesn't wipe the limbs, which isn't observable), so the contract holds either way, but naming the firmware's actual LibreSSL version, if known, would help.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5736035265 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14992#pullrequestreview-5736035265). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-02T11:45:10Z. **Review:** APPROVED --- Looks right against the cited LibreSSL 4.0.0 source (`ce488b78`). - **Setters.** `RSA_set0_key`, `RSA_set0_factors` and `RSA_set0_crt_params` return 0 before any change when a required component is missing on both sides. Otherwise they free each replaced component and store the supplied one, keeping omitted ones, exactly as in `rsa_lib.c`. - **Freeing.** In 4.0.0, `BN_clear_free` is `BN_free`. It frees the limbs (`freezero(d, dmax * 8)`) unless `BN_FLG_STATIC_DATA` (2) is set, then wipes the struct and frees it only when `BN_FLG_MALLOCED` (1) is set. Your `Allocated`/`StaticData` values and the 24-byte `{d, top, dmax, neg, flags}` layout match. Tested on Windows 11, WinLibs GCC 15.2.0, Release, with head `77bf9cdd90` merged onto `main`: `guest_libressl3_rsa_setters` and `public_headers` pass. On `main` all four exports throw, and `RsaSetters.cpp` is new, so the control is the throwing stubs. Non-blocking: - These free with `free_nid_postfix`, but libSceLibreSsl3's `BN_new`/`BN_free` forward to the parent libSceLibreSsl (`ParentExports.cpp`), where both still throw. Whatever later implements the parent's `BN_new` has to allocate the struct and limbs from the same guest heap, with `BN_FLG_MALLOCED` set, or these setters will free foreign memory. One line in the debt entry would keep that coupling visible. - The module is "LibreSsl3", while the entry cites 4.0.0. The BIGNUM layout and these setters are the same in the 3.x series (3.x's `BN_free` doesn't wipe the limbs, which isn't observable), so the contract holds either way, but naming the firmware's actual LibreSSL version, if known, would help.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!14992
No description provided.