feat(libSceLibreSsl3): implement EVP_PKEY_get0_RSA, EVP_PKEY_get0_DSA and EVP_PKEY_get0_DH #13897

Merged
gazaret merged 1 commit from upstream-pr/13897 into main 2026-11-01 07:24:25 +00:00
gazaret commented 2026-10-31 11:49:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gazaret on 2026-10-31T11:49:46Z.


What

Implements EVP_PKEY_get0_RSA, EVP_PKEY_get0_DSA and EVP_PKEY_get0_DH in libSceLibreSsl3, which were (void) throwing stubs. They follow LibreSSL 4.0.0's p_lib.c, the version the existing 32-byte LibreSsl3EvpPkey layout and EVP_PKEY_up_ref already follow:

  • a key of the matching type returns its inner key pointer without taking a reference: EVP_PKEY_RSA (6) or EVP_PKEY_RSA_PSS (912) for get0_RSA, EVP_PKEY_DSA (116) for get0_DSA and EVP_PKEY_DH (28) for get0_DH;
  • a key of another type throws. LibreSSL queues EVP_R_EXPECTING_AN_RSA_KEY, EVP_R_EXPECTING_A_DSA_KEY or EVP_R_EXPECTING_A_DH_KEY and returns NULL there, but the LibreSSL3 error queue is not modelled (the debt file already notes this for the integer decoder);
  • a null key throws, as EVP_PKEY_up_ref does, where LibreSSL dereferences it.

The public declarations in libSceLibreSsl3/include/Api.hpp take LibreSsl3EvpPkey* and return LibreSsl3Rsa*, or void* for DSA and DH, which have no layout here yet. The code is in its own src/PkeyGetters.cpp, since several open pull requests change src/Key.cpp. The pending-exports count in docs/dev/debt/libSceLibreSsl3.md drops from 80 to 77, and a new entry records the gaps above.

Tested

Ubuntu 22.04 (WSL2), GCC 13.4, Release, on main cbed915291, full BUILD_TESTING=ON build:

  • New guest_libressl3_pkey_getters: RSA and RSA-PSS keys give their RSA pointer, DSA and DH keys give theirs, a matching key with no inner key gives NULL, and the reference counts are unchanged. Passes 3 of 3 runs. The throwing paths are not asserted.
  • ctest -R 'libressl3|public_headers|patched_librar|nid_': 86 of 86 pass.
  • tools/check_conventions.py --base origin/main: no findings.
  • Open pull requests were checked for these three functions: none implements them. A test merge with each of the 34 open pull requests that change libSceLibreSsl3 or its debt file is clean.
  • No title tested.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5097233303 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13897). Originally posted by [gazaret](https://github.com/gazaret) on 2026-10-31T11:49:46Z. --- ### What Implements `EVP_PKEY_get0_RSA`, `EVP_PKEY_get0_DSA` and `EVP_PKEY_get0_DH` in libSceLibreSsl3, which were `(void)` throwing stubs. They follow [LibreSSL 4.0.0's `p_lib.c`](https://github.com/libressl/openbsd/blob/ce488b78e0bd994780569df718596b9776ff681a/src/lib/libcrypto/evp/p_lib.c#L630-L751), the version the existing 32-byte `LibreSsl3EvpPkey` layout and `EVP_PKEY_up_ref` already follow: - a key of the matching type returns its inner key pointer without taking a reference: `EVP_PKEY_RSA` (6) or `EVP_PKEY_RSA_PSS` (912) for `get0_RSA`, `EVP_PKEY_DSA` (116) for `get0_DSA` and `EVP_PKEY_DH` (28) for `get0_DH`; - a key of another type throws. LibreSSL queues `EVP_R_EXPECTING_AN_RSA_KEY`, `EVP_R_EXPECTING_A_DSA_KEY` or `EVP_R_EXPECTING_A_DH_KEY` and returns NULL there, but the LibreSSL3 error queue is not modelled (the debt file already notes this for the integer decoder); - a null key throws, as `EVP_PKEY_up_ref` does, where LibreSSL dereferences it. The public declarations in `libSceLibreSsl3/include/Api.hpp` take `LibreSsl3EvpPkey*` and return `LibreSsl3Rsa*`, or `void*` for DSA and DH, which have no layout here yet. The code is in its own `src/PkeyGetters.cpp`, since several open pull requests change `src/Key.cpp`. The pending-exports count in `docs/dev/debt/libSceLibreSsl3.md` drops from 80 to 77, and a new entry records the gaps above. ### Tested Ubuntu 22.04 (WSL2), GCC 13.4, Release, on `main` cbed915291, full `BUILD_TESTING=ON` build: - New `guest_libressl3_pkey_getters`: RSA and RSA-PSS keys give their RSA pointer, DSA and DH keys give theirs, a matching key with no inner key gives NULL, and the reference counts are unchanged. Passes 3 of 3 runs. The throwing paths are not asserted. - `ctest -R 'libressl3|public_headers|patched_librar|nid_'`: 86 of 86 pass. - `tools/check_conventions.py --base origin/main`: no findings. - Open pull requests were checked for these three functions: none implements them. A test merge with each of the 34 open pull requests that change libSceLibreSsl3 or its debt file is clean. - No title tested. ### 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 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-31 11:52:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T11:52:27Z.

Review: APPROVED


Reviewed — looks good

The three getters return the correctly type-checked inner key pointer without changing its reference count, and I found no blocking issue in the exact diff.

What I ran

Reviewed head 9a3778c35fdf9b70cdb73ab18d5d332c98142684 against PR base 5de1621ff13712e8b3a6d70a2487b008d9ee80c3; the merge preview is clean. Environment: Debian Linux x86_64, Python 3.11.2. No local build or C++ test was run.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13897
python3 tools/pr_abi_audit.py --base 5de1621ff13712e8b3a6d70a2487b008d9ee80c3 --head 9a3778c35fdf9b70cdb73ab18d5d332c98142684 --json

Results

Check Result
Diff and conventions Passed.
Current-main merge preview Clean against 5de1621ff13712e8b3a6d70a2487b008d9ee80c3.
ABI audit Passed with one declaration and definition for each getter; no findings.
Duplicate-work check Open PR #10490 changes lower-level RSA/DSA/DH component getters, not these EVP_PKEY_get0_* functions.
Focused C++ test and related CTest suite Author reports 3/3 focused runs and 86/86 related tests passed in Ubuntu 22.04 WSL2 with GCC 13.4; not independently run here.
Hosted checks Eligibility, intake, conventions, portability, labels and report passed. Windows was still running; Linux and specialized jobs were skipped.
Unedited local check output
All conventions checks passed.
  "status": "passed",
  "findings": [],

Sources

Not verified

I did not run a local build, the C++ test, Windows tests, or console behavior. The precheck could not run its test-quality helper because it is absent from the isolated PR checkout; the separate ABI audit completed successfully. The hosted Windows job was still in progress at the final status check; the author-reported WSL2 results were not independently reproduced.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5722596925 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13897#pullrequestreview-5722596925). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T11:52:27Z. **Review:** APPROVED --- # Reviewed — looks good The three getters return the correctly type-checked inner key pointer without changing its reference count, and I found no blocking issue in the exact diff. ## What I ran Reviewed head `9a3778c35fdf9b70cdb73ab18d5d332c98142684` against PR base `5de1621ff13712e8b3a6d70a2487b008d9ee80c3`; the merge preview is clean. Environment: Debian Linux x86_64, Python 3.11.2. No local build or C++ test was run. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13897 python3 tools/pr_abi_audit.py --base 5de1621ff13712e8b3a6d70a2487b008d9ee80c3 --head 9a3778c35fdf9b70cdb73ab18d5d332c98142684 --json ``` ## Results | Check | Result | |---|---| | Diff and conventions | Passed. | | Current-main merge preview | Clean against `5de1621ff13712e8b3a6d70a2487b008d9ee80c3`. | | ABI audit | Passed with one declaration and definition for each getter; no findings. | | Duplicate-work check | Open PR #10490 changes lower-level RSA/DSA/DH component getters, not these `EVP_PKEY_get0_*` functions. | | Focused C++ test and related CTest suite | Author reports 3/3 focused runs and 86/86 related tests passed in Ubuntu 22.04 WSL2 with GCC 13.4; not independently run here. | | Hosted checks | Eligibility, intake, conventions, portability, labels and report passed. Windows was still running; Linux and specialized jobs were skipped. | <details><summary>Unedited local check output</summary> ```text All conventions checks passed. ``` ```text "status": "passed", ``` ```text "findings": [], ``` </details> ## Sources - [LibreSSL 4.0.0 getter implementations](https://github.com/libressl/openbsd/blob/ce488b78e0bd994780569df718596b9776ff681a/src/lib/libcrypto/evp/p_lib.c#L629-L751) - [Reviewed getter implementations and type checks](https://github.com/boykopovar/AnyPS5/blob/9a3778c35fdf9b70cdb73ab18d5d332c98142684/core/libs/prx/libSceLibreSsl3/src/PkeyGetters.cpp) - [Reviewed test cases](https://github.com/boykopovar/AnyPS5/blob/9a3778c35fdf9b70cdb73ab18d5d332c98142684/core/libs/prx/libSceLibreSsl3/tests/PkeyGetters.cpp) ## Not verified I did not run a local build, the C++ test, Windows tests, or console behavior. The precheck could not run its test-quality helper because it is absent from the isolated PR checkout; the separate ABI audit completed successfully. The hosted Windows job was still in progress at the final status check; the author-reported WSL2 results were not independently reproduced.
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!13897
No description provided.