feat(libressl3): implement EVP_PKEY_get0_RSA, EVP_PKEY_get0_DSA and EVP_PKEY_get0_DH #12582

Closed
PrivacyOnion wants to merge 3 commits from upstream-pr/12582 into main
PrivacyOnion commented 2026-10-28 21:21:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-10-28T21:21:58Z.


What

  • Declare NID constants NidRsaEncryption (6), NidDhKeyAgreement (28), NidDsa (116), and NidRsassaPss (912) in core/libs/prx/libSceLibreSsl3/include/Key.hpp.
  • Implement EVP_PKEY_get0_RSA, EVP_PKEY_get0_DSA, and EVP_PKEY_get0_DH in core/libs/prx/libSceLibreSsl3/src/Key.cpp, returning the underlying key pointer from LibreSsl3EvpPkey when the key type matches or nullptr on mismatch, following LibreSSL 4.0.0. Null key pointers throw std::invalid_argument.
  • Update declarations in core/libs/prx/libSceLibreSsl3/include/Api.hpp and remove stubs from core/libs/prx/libSceLibreSsl3/Export.cpp.
  • Record technical debt in docs/dev/debt/libSceLibreSsl3.md noting unmodeled ERR and omitted EVPerror codes.
  • Expand core/libs/tests/GuestLibreSsl3KeyReference.cpp to verify valid key pointer retrieval, type filtering, and null key exception handling.

Tested

Windows 11, verified guest_libressl3_key_reference covering key retrieval and null argument validation for EVP_PKEY_get0_RSA, EVP_PKEY_get0_DSA, and EVP_PKEY_get0_DH.

Ran locally on 937943669c:

$ ctest --test-dir build -R '^guest_libressl3_key_reference$' --output-on-failure
    Start 2225: guest_libressl3_key_reference
1/1 Test #2225: guest_libressl3_key_reference ....   Passed    0.02 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   0.14 sec

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: #12580
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5057896777 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12582). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-10-28T21:21:58Z. --- ### What - Declare NID constants `NidRsaEncryption` (6), `NidDhKeyAgreement` (28), `NidDsa` (116), and `NidRsassaPss` (912) in `core/libs/prx/libSceLibreSsl3/include/Key.hpp`. - Implement `EVP_PKEY_get0_RSA`, `EVP_PKEY_get0_DSA`, and `EVP_PKEY_get0_DH` in `core/libs/prx/libSceLibreSsl3/src/Key.cpp`, returning the underlying key pointer from `LibreSsl3EvpPkey` when the key type matches or `nullptr` on mismatch, following [LibreSSL 4.0.0](https://github.com/libressl/openbsd/blob/ce488b78e0bd994780569df718596b9776ff681a/src/lib/libcrypto/evp/p_lib.c#L630-L750). Null key pointers throw `std::invalid_argument`. - Update declarations in `core/libs/prx/libSceLibreSsl3/include/Api.hpp` and remove stubs from `core/libs/prx/libSceLibreSsl3/Export.cpp`. - Record technical debt in `docs/dev/debt/libSceLibreSsl3.md` noting unmodeled `ERR` and omitted `EVPerror` codes. - Expand `core/libs/tests/GuestLibreSsl3KeyReference.cpp` to verify valid key pointer retrieval, type filtering, and null key exception handling. ### 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. --> Windows 11, verified `guest_libressl3_key_reference` covering key retrieval and null argument validation for `EVP_PKEY_get0_RSA`, `EVP_PKEY_get0_DSA`, and `EVP_PKEY_get0_DH`. Ran locally on `937943669c`: ``` $ ctest --test-dir build -R '^guest_libressl3_key_reference$' --output-on-failure Start 2225: guest_libressl3_key_reference 1/1 Test #2225: guest_libressl3_key_reference .... Passed 0.02 sec 100% tests passed, 0 tests failed out of 1 Total Test time (real) = 0.14 sec ``` ### 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: #12580 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-28 21:29:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T21:29:35Z.

Review: CHANGES_REQUESTED


The implementation and focused accessor tests look internally consistent, but the PR needs an explicit landing order with the other open libSceLibreSsl3 reference-count changes before approval. I fetched the exact current heads and checked pairwise merge previews: #12582 conflicts with #12578 and #12580 in Key.cpp, GuestLibreSsl3KeyReference.cpp, and docs/dev/debt/libSceLibreSsl3.md. All three PR descriptions currently say Depends on: none.

Please agree which PR lands first, restack the later changes as needed, and record the resulting order in each affected Depends on checklist. This is a repository coordination requirement; I am not reporting a functional defect in the accessors here. Hosted Windows is still running; Ubuntu/macOS and product test jobs are not complete or are skipped.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5689941042 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12582#pullrequestreview-5689941042). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T21:29:35Z. **Review:** CHANGES_REQUESTED --- The implementation and focused accessor tests look internally consistent, but the PR needs an explicit landing order with the other open `libSceLibreSsl3` reference-count changes before approval. I fetched the exact current heads and checked pairwise merge previews: #12582 conflicts with #12578 and #12580 in `Key.cpp`, `GuestLibreSsl3KeyReference.cpp`, and `docs/dev/debt/libSceLibreSsl3.md`. All three PR descriptions currently say `Depends on: none`. Please agree which PR lands first, restack the later changes as needed, and record the resulting order in each affected `Depends on` checklist. This is a repository coordination requirement; I am not reporting a functional defect in the accessors here. Hosted Windows is still running; Ubuntu/macOS and product test jobs are not complete or are skipped.
MarcZX10 commented 2026-10-28 21:36:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T21:36:10Z.

Review: CHANGES_REQUESTED


Re-checked — changes requested

The accessor implementation and focused tests look internally consistent. This PR still needs an explicit order with #12578 and #12580: exact-head pairwise merge previews conflict in files both changes edit, but this PR currently says Depends on: none.

What I ran

  • Compared #12582 head dd47c78d6d72d3d88b2d21ccac72ffd8adb193c3 with #12578 head 00b24c75b4be4b3ee7ed97013e4ea4a7a21b3afe and #12580 head e5f35a2407c01477085fc0d9aa78ddbba669fda7.
  • Generated pairwise merge previews against current main 319621ba2e578bd053b0baba2877fe70520e0737.
  • Refreshed hosted checks.

Results

Check Result
#12582 + #12578 conflict in shared implementation, test, and debt files
#12582 + #12580 conflict in shared implementation, test, and debt files
Current #12582 hosted policy checks pass
Current #12582 Windows workflow in progress at latest check
Linux/product and specialized jobs skipped

Findings

Blocking

Please record an agreed dependency/landing order or restack this PR so its relationship to the two open sibling changes is explicit. The merge previews conflict in:

  • core/libs/prx/libSceLibreSsl3/src/Key.cpp
  • core/libs/tests/GuestLibreSsl3KeyReference.cpp
  • docs/dev/debt/libSceLibreSsl3.md

Non-blocking

I found no separate functional blocker in the implementation or focused tests. This review is requesting changes for integration clarity only.

Sources

Not verified

I did not independently rerun the focused C++ tests. Hosted Linux/product checks were skipped.

To get this to a good state

Set the intended order in the PR body/checklist and declare the predecessor dependency, or restack and update the affected diffs so the pairwise merge previews are clean.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5690009359 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12582#pullrequestreview-5690009359). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T21:36:10Z. **Review:** CHANGES_REQUESTED --- # Re-checked — changes requested The accessor implementation and focused tests look internally consistent. This PR still needs an explicit order with #12578 and #12580: exact-head pairwise merge previews conflict in files both changes edit, but this PR currently says `Depends on: none`. ## What I ran - Compared #12582 head `dd47c78d6d72d3d88b2d21ccac72ffd8adb193c3` with #12578 head `00b24c75b4be4b3ee7ed97013e4ea4a7a21b3afe` and #12580 head `e5f35a2407c01477085fc0d9aa78ddbba669fda7`. - Generated pairwise merge previews against current `main` `319621ba2e578bd053b0baba2877fe70520e0737`. - Refreshed hosted checks. ## Results | Check | Result | |---|---| | #12582 + #12578 | conflict in shared implementation, test, and debt files | | #12582 + #12580 | conflict in shared implementation, test, and debt files | | Current #12582 hosted policy checks | pass | | Current #12582 Windows workflow | in progress at latest check | | Linux/product and specialized jobs | skipped | ## Findings **Blocking** Please record an agreed dependency/landing order or restack this PR so its relationship to the two open sibling changes is explicit. The merge previews conflict in: - `core/libs/prx/libSceLibreSsl3/src/Key.cpp` - `core/libs/tests/GuestLibreSsl3KeyReference.cpp` - `docs/dev/debt/libSceLibreSsl3.md` **Non-blocking** I found no separate functional blocker in the implementation or focused tests. This review is requesting changes for integration clarity only. ## Sources - [#12578](https://github.com/boykopovar/AnyPS5/pull/12578) - [#12580](https://github.com/boykopovar/AnyPS5/pull/12580) - [#12582](https://github.com/boykopovar/AnyPS5/pull/12582) ## Not verified I did not independently rerun the focused C++ tests. Hosted Linux/product checks were skipped. ## To get this to a good state Set the intended order in the PR body/checklist and declare the predecessor dependency, or restack and update the affected diffs so the pairwise merge previews are clean.
MarcZX10 commented 2026-10-30 07:17:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T07:17:17Z.

Review: APPROVED


Re-checked — new head, looks good

I reviewed exact head 937943669c354a2b630e12b34002db5d8d26ef7f; the declared order is now #12578 → #12580 → #12582, and the accessor/type checks and reference-count tests match the implementations in the stacked diff. The author reports guest_libressl3_key_reference passing on this exact head; hosted Windows, conventions, labels, and report checks remain pending, while Linux and specialized jobs are skipped. I did not build or run CTest locally, and console layouts/error-queue behavior remain unverified as recorded in the debt entry.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5709197725 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12582#pullrequestreview-5709197725). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-30T07:17:17Z. **Review:** APPROVED --- # Re-checked — new head, looks good I reviewed exact head `937943669c354a2b630e12b34002db5d8d26ef7f`; the declared order is now #12578 → #12580 → #12582, and the accessor/type checks and reference-count tests match the implementations in the stacked diff. The author reports `guest_libressl3_key_reference` passing on this exact head; hosted Windows, conventions, labels, and report checks remain pending, while Linux and specialized jobs are skipped. I did not build or run CTest locally, and console layouts/error-queue behavior remain unverified as recorded in the debt entry.
MarcZX10 commented 2026-10-30 07:33:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T07:33:07Z.

Review: CHANGES_REQUESTED


Re-checked — new head, changes requested

The declared dependency order is clear, but the live branch is not stacked on #12580 and the combined merge preview conflicts in three files.

What I ran

I checked PR head 937943669c354a2b630e12b34002db5d8d26ef7f against current main at f7f03daf52f11191174b1be089a56e268390a707. The individual PR merges cleanly onto main; the blocker below is the integration of the declared dependency stack. Environment: Linux, Git.

git merge-base --is-ancestor refs/review/pr-12580 refs/review/pr-12582
git merge-tree --write-tree --name-only --no-messages refs/review/pr-12580 refs/review/pr-12582
git diff --check refs/remotes/upstream/main...refs/review/pr-12582
python3 tools/check_conventions.py --base refs/remotes/upstream/main --head refs/review/pr-12582

Results

Check Result
Dependency ancestry Fails: #12580's live head is not an ancestor of #12582's live head.
Combined #12580 + #12582 merge preview Conflicts in Key.cpp, GuestLibreSsl3KeyReference.cpp, and docs/dev/debt/libSceLibreSsl3.md.
git diff --check against main Reports an added blank line at EOF in the debt file.
Repository conventions 0 errors; one existing debt-length warning (1,115 characters).
Individual #12582 merge onto current main Clean.
Build or CTest Not run locally. The author reports the focused CTest on this head; I have not independently verified that run. Windows CI is still in progress; policy checks pass and unrelated product jobs are skipped.
Unedited command output
$ git merge-base --is-ancestor refs/review/pr-12580 refs/review/pr-12582
(no output; exit status 1)

$ git merge-tree --write-tree --name-only --no-messages refs/review/pr-12580 refs/review/pr-12582
df1feee819a536e9b0425c174b74d00ade791ad4
core/libs/prx/libSceLibreSsl3/src/Key.cpp
core/libs/tests/GuestLibreSsl3KeyReference.cpp
docs/dev/debt/libSceLibreSsl3.md
(exit status 1)

$ git diff --check refs/remotes/upstream/main...refs/review/pr-12582
docs/dev/debt/libSceLibreSsl3.md:210: new blank line at EOF.

$ python3 tools/check_conventions.py --base refs/remotes/upstream/main --head refs/review/pr-12582
1 findings, 0 errors; GitHub shows at most 10 error annotations, the job summary lists all

Findings

Blocking

  • The declared stack does not integrate as submitted. #12582 lists Depends on: #12580, but its commit graph contains separate copies of the earlier SSL_CTX_up_ref and X509_STORE_up_ref commits rather than #12580's live head as an ancestor. Combining the current #12580 and #12582 heads conflicts in the three files above, so the stated landing order cannot be applied cleanly. After #12580 is merged, restack #12582 on the resulting main, retain the EVP accessor change, resolve any resulting conflicts, and rerun the focused test and checks on the new head.

Non-blocking

  • Remove the extra blank line at the end of docs/dev/debt/libSceLibreSsl3.md so git diff --check is clean.

Not verified

  • I did not build or run CTest locally. The author-reported focused CTest and the in-progress Windows CI are not independent local results.
  • I did not verify behavior on Windows, macOS, or console hardware.

To get this to a good state

Please restack this PR after #12580 lands, keep the dependency field aligned with the resulting branch, remove the trailing blank line, and rerun the focused test. I will re-check the new head, dependency merge preview, and the same applicable checks.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5709331762 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12582#pullrequestreview-5709331762). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-30T07:33:07Z. **Review:** CHANGES_REQUESTED --- # Re-checked — new head, changes requested The declared dependency order is clear, but the live branch is not stacked on #12580 and the combined merge preview conflicts in three files. ## What I ran I checked PR head `937943669c354a2b630e12b34002db5d8d26ef7f` against current `main` at `f7f03daf52f11191174b1be089a56e268390a707`. The individual PR merges cleanly onto `main`; the blocker below is the integration of the declared dependency stack. Environment: Linux, Git. ```sh git merge-base --is-ancestor refs/review/pr-12580 refs/review/pr-12582 git merge-tree --write-tree --name-only --no-messages refs/review/pr-12580 refs/review/pr-12582 git diff --check refs/remotes/upstream/main...refs/review/pr-12582 python3 tools/check_conventions.py --base refs/remotes/upstream/main --head refs/review/pr-12582 ``` ## Results | Check | Result | |---|---| | Dependency ancestry | Fails: #12580's live head is not an ancestor of #12582's live head. | | Combined #12580 + #12582 merge preview | Conflicts in `Key.cpp`, `GuestLibreSsl3KeyReference.cpp`, and `docs/dev/debt/libSceLibreSsl3.md`. | | `git diff --check` against main | Reports an added blank line at EOF in the debt file. | | Repository conventions | 0 errors; one existing debt-length warning (1,115 characters). | | Individual #12582 merge onto current main | Clean. | | Build or CTest | Not run locally. The author reports the focused CTest on this head; I have not independently verified that run. Windows CI is still in progress; policy checks pass and unrelated product jobs are skipped. | <details> <summary>Unedited command output</summary> ```text $ git merge-base --is-ancestor refs/review/pr-12580 refs/review/pr-12582 (no output; exit status 1) $ git merge-tree --write-tree --name-only --no-messages refs/review/pr-12580 refs/review/pr-12582 df1feee819a536e9b0425c174b74d00ade791ad4 core/libs/prx/libSceLibreSsl3/src/Key.cpp core/libs/tests/GuestLibreSsl3KeyReference.cpp docs/dev/debt/libSceLibreSsl3.md (exit status 1) $ git diff --check refs/remotes/upstream/main...refs/review/pr-12582 docs/dev/debt/libSceLibreSsl3.md:210: new blank line at EOF. $ python3 tools/check_conventions.py --base refs/remotes/upstream/main --head refs/review/pr-12582 1 findings, 0 errors; GitHub shows at most 10 error annotations, the job summary lists all ``` </details> ## Findings ### Blocking - **The declared stack does not integrate as submitted.** #12582 lists `Depends on: #12580`, but its commit graph contains separate copies of the earlier `SSL_CTX_up_ref` and `X509_STORE_up_ref` commits rather than #12580's live head as an ancestor. Combining the current #12580 and #12582 heads conflicts in the three files above, so the stated landing order cannot be applied cleanly. After #12580 is merged, restack #12582 on the resulting `main`, retain the EVP accessor change, resolve any resulting conflicts, and rerun the focused test and checks on the new head. ### Non-blocking - Remove the extra blank line at the end of `docs/dev/debt/libSceLibreSsl3.md` so `git diff --check` is clean. ## Not verified - I did not build or run CTest locally. The author-reported focused CTest and the in-progress Windows CI are not independent local results. - I did not verify behavior on Windows, macOS, or console hardware. ## To get this to a good state Please restack this PR after #12580 lands, keep the dependency field aligned with the resulting branch, remove the trailing blank line, and rerun the focused test. I will re-check the new head, dependency merge preview, and the same applicable checks.

Pull request closed

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!12582
No description provided.