feat(libSceLibreSsl3): implement X509 public key parameters #10557

Merged
MarcZX10 merged 8 commits from upstream-pr/10557 into main 2026-11-04 04:48:41 +00:00
MarcZX10 commented 2026-10-24 09:49:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T09:49:07Z.


What

Implements X509_PUBKEY_get0_param in libSceLibreSsl3 using the LibreSSL 4.0.0 implementation and structure declarations pinned at ce488b78e0bd994780569df718596b9776ff681a (crypto/asn1/x_pubkey.c, x509_local.h, x509.h and asn1.h). It returns the algorithm OID, encoded public-key bytes and length, and algorithm structure through optional outputs. The key length is written only when the encoded key output is requested, matching the source.

The layouts are guarded by compile-time size and offset assertions. Invalid null arguments and absent nested structures throw std::invalid_argument; these malformed-object cases are not verified on a PS5. Returned pointers are borrowed and remain owned by the input object.

The pending-export count in the technical-debt record decreases from 84 to 83; the remaining PS5 ABI/hardware verification limitation is recorded there.

Tested

Debian Linux, GCC 12.2.0: compiled the implementation and focused test as C++23 translation units, linked them, and ran guest_libressl3_x509_pubkey_param; it passed output selection, borrowed pointer identity, optional outputs, the pk == nullptr length-preservation case, all-null outputs, and invalid argument cases. python3 tools/check_conventions.py --base upstream/main --head HEAD passed. git diff --check passed.

The full CMake build was not run: this checkout is missing the SDL2 submodule and the host lacks XRandR development support, which prevents project configuration. No PS5 hardware or Windows run was available.

Checklist

  • Based on current main (379b1dca32ecc4e3570ad0a53c69f019b70dbe59); no other open PR implements this export
  • One topic: X509_PUBKEY_get0_param; follow-up work belongs in a separate PR
  • No code comments added; remaining ABI uncertainty is recorded in technical debt
  • Other unimplemented paths continue to throw through NotImplemented_nid_no_patch
  • No investigation notes, reports, screenshots or logs added to the repository
  • No third-party code was added; this is a local implementation based on pinned public source
  • Generic behavior, not title-specific
  • Depends on: #10493 (shared CMakeLists.txt and technical-debt insertion points; this PR will rebase after #10493 and preserve both changes)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4994362611 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10557). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T09:49:07Z. --- ### What Implements `X509_PUBKEY_get0_param` in `libSceLibreSsl3` using the LibreSSL 4.0.0 implementation and structure declarations pinned at `ce488b78e0bd994780569df718596b9776ff681a` (`crypto/asn1/x_pubkey.c`, `x509_local.h`, `x509.h` and `asn1.h`). It returns the algorithm OID, encoded public-key bytes and length, and algorithm structure through optional outputs. The key length is written only when the encoded key output is requested, matching the source. The layouts are guarded by compile-time size and offset assertions. Invalid null arguments and absent nested structures throw `std::invalid_argument`; these malformed-object cases are not verified on a PS5. Returned pointers are borrowed and remain owned by the input object. The pending-export count in the technical-debt record decreases from 84 to 83; the remaining PS5 ABI/hardware verification limitation is recorded there. ### Tested Debian Linux, GCC 12.2.0: compiled the implementation and focused test as C++23 translation units, linked them, and ran `guest_libressl3_x509_pubkey_param`; it passed output selection, borrowed pointer identity, optional outputs, the `pk == nullptr` length-preservation case, all-null outputs, and invalid argument cases. `python3 tools/check_conventions.py --base upstream/main --head HEAD` passed. `git diff --check` passed. The full CMake build was not run: this checkout is missing the SDL2 submodule and the host lacks XRandR development support, which prevents project configuration. No PS5 hardware or Windows run was available. ### Checklist - [x] Based on current `main` (`379b1dca32ecc4e3570ad0a53c69f019b70dbe59`); no other open PR implements this export - [x] One topic: `X509_PUBKEY_get0_param`; follow-up work belongs in a separate PR - [x] No code comments added; remaining ABI uncertainty is recorded in technical debt - [x] Other unimplemented paths continue to throw through `NotImplemented_nid_no_patch` - [x] No investigation notes, reports, screenshots or logs added to the repository - [x] No third-party code was added; this is a local implementation based on pinned public source - [x] Generic behavior, not title-specific - [x] Depends on: #10493 (shared `CMakeLists.txt` and technical-debt insertion points; this PR will rebase after #10493 and preserve both changes) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
harisibrar1 commented 2026-10-24 12:28:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-24T12:28:34Z.

Review: COMMENTED


Checked against main 87666fc5d6 and LibreSSL 4.0.0 (libressl/openbsd ce488b78, crypto/asn1/x_pubkey.c, x509_local.h, x509.h, asn1.h):

  • The behaviour matches X509_PUBKEY_get0_param at x_pubkey.c:762-774: every output is optional, *ppklen is written only inside the pk branch, and it returns 1. The LP64 layouts in the static_asserts (X509_PUBKEY 24 bytes with public_key at 8, ASN1_STRING 24 bytes with data at 8, X509_ALGOR 16 bytes) match the pinned headers, and throwing where LibreSSL would dereference NULL looks right to me. It still merges cleanly into current main.
  • One CMake suggestion: this test catches std::invalid_argument thrown from inside libSceLibreSsl3.prx, and the sibling with the same pattern, guest_libressl3_digest_tests, links libc explicitly and calls configure_windows_unwind, while this target does neither. Linking should still work, since libc comes in through the library's PUBLIC libc (core/libs/CMakeLists.txt:170). But configure_windows_unwind is what renames the exe's .eh_frame to .ehfram, and on Windows libc's unwinder only searches .ehfram sections (Unwind.cpp:276/376). I couldn't run this on Windows, but reading the code suggests the catch in the test exe might not be found under the DWARF toolchain. Adding libc and configure_windows_unwind(guest_libressl3_x509_pubkey_param_tests) the way the digest test does would remove that risk.
  • Nit: there's a stray blank line before the new bullet under Functional in docs/dev/debt/libSceLibreSsl3.md.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5638236478 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10557#pullrequestreview-5638236478). Originally posted by [harisibrar1](https://github.com/harisibrar1) on 2026-10-24T12:28:34Z. **Review:** COMMENTED --- Checked against main 87666fc5d6 and LibreSSL 4.0.0 (libressl/openbsd ce488b78, crypto/asn1/x_pubkey.c, x509_local.h, x509.h, asn1.h): - The behaviour matches `X509_PUBKEY_get0_param` at x_pubkey.c:762-774: every output is optional, `*ppklen` is written only inside the `pk` branch, and it returns 1. The LP64 layouts in the static_asserts (X509_PUBKEY 24 bytes with public_key at 8, ASN1_STRING 24 bytes with data at 8, X509_ALGOR 16 bytes) match the pinned headers, and throwing where LibreSSL would dereference NULL looks right to me. It still merges cleanly into current main. - One CMake suggestion: this test catches `std::invalid_argument` thrown from inside libSceLibreSsl3.prx, and the sibling with the same pattern, `guest_libressl3_digest_tests`, links `libc` explicitly and calls `configure_windows_unwind`, while this target does neither. Linking should still work, since libc comes in through the library's `PUBLIC libc` (core/libs/CMakeLists.txt:170). But `configure_windows_unwind` is what renames the exe's `.eh_frame` to `.ehfram`, and on Windows libc's unwinder only searches `.ehfram` sections (Unwind.cpp:276/376). I couldn't run this on Windows, but reading the code suggests the catch in the test exe might not be found under the DWARF toolchain. Adding `libc` and `configure_windows_unwind(guest_libressl3_x509_pubkey_param_tests)` the way the digest test does would remove that risk. - Nit: there's a stray blank line before the new bullet under Functional in docs/dev/debt/libSceLibreSsl3.md. Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
MarcZX10 commented 2026-11-02 04:57:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T04:57:31Z.

Review: COMMENTED


Reviewed — rebase fix confirmed at head, Windows configure passes

The x509 pubkey test is back in the test list at this head, and the hosted Windows check passed, so the reviewer's configure failure is addressed.

What I ran

  • Live head e65e0fab20 (matches batch; a merge commit of main a644edf30c).
  • gh pr view 10557 (headRefOid, statusCheckRollup); gh api GET of comments, reviews and review comments newer than 2026-10-27T00:26:29Z.
  • git show of core/libs/prx/libSceLibreSsl3/CMakeLists.txt at the head.
  • Nothing was built or run.

Results

Check Result Note
eligibility, conventions, library-portability, labels, report SUCCESS hosted
windows SUCCESS hosted; covers the configure failure reported on 2026-10-27
relinker, relinker-asan, register-context, write-watch SKIPPED hosted
linux SKIPPED hosted

Findings

  • oneandonlydean (2026-10-27T09:26:44Z): guest_libressl3_x509_pubkey_param sat inside an ENVIRONMENT_MODIFICATION value at CMakeLists.txt:37.
    • At this head the test is its own entry at lines 32-37, and the ENVIRONMENT_MODIFICATION value on lines 97-98 is only the PATH string. Verified by reading.
  • TechLevelZero's automated AMD GPU comment (2026-11-01T14:13:19Z) reports 1,610 passed, 0 new failures, on a contributor machine. It asks nothing; no reply needed.

Sources

Not verified

  • Windows configure and test run themselves; only the hosted status is read.
  • The AMD GPU result was not reproduced.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5732249521 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10557#pullrequestreview-5732249521). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-02T04:57:31Z. **Review:** COMMENTED --- # Reviewed — rebase fix confirmed at head, Windows configure passes The x509 pubkey test is back in the test list at this head, and the hosted Windows check passed, so the reviewer's configure failure is addressed. ## What I ran - Live head e65e0fab200e7ca4a973e3e7e1559624ad7dc57d (matches batch; a merge commit of main a644edf30c). - gh pr view 10557 (headRefOid, statusCheckRollup); gh api GET of comments, reviews and review comments newer than 2026-10-27T00:26:29Z. - git show of core/libs/prx/libSceLibreSsl3/CMakeLists.txt at the head. - Nothing was built or run. ## Results | Check | Result | Note | |---|---|---| | eligibility, conventions, library-portability, labels, report | SUCCESS | hosted | | windows | SUCCESS | hosted; covers the configure failure reported on 2026-10-27 | | relinker, relinker-asan, register-context, write-watch | SKIPPED | hosted | | linux | SKIPPED | hosted | ## Findings - oneandonlydean (2026-10-27T09:26:44Z): guest_libressl3_x509_pubkey_param sat inside an ENVIRONMENT_MODIFICATION value at CMakeLists.txt:37. - At this head the test is its own entry at lines 32-37, and the ENVIRONMENT_MODIFICATION value on lines 97-98 is only the PATH string. Verified by reading. - TechLevelZero's automated AMD GPU comment (2026-11-01T14:13:19Z) reports 1,610 passed, 0 new failures, on a contributor machine. It asks nothing; no reply needed. ## Sources - https://github.com/boykopovar/AnyPS5/blob/e65e0fab200e7ca4a973e3e7e1559624ad7dc57d/core/libs/prx/libSceLibreSsl3/CMakeLists.txt#L32-L37 - https://github.com/boykopovar/AnyPS5/blob/e65e0fab200e7ca4a973e3e7e1559624ad7dc57d/core/libs/prx/libSceLibreSsl3/CMakeLists.txt#L97-L98 ## Not verified - Windows configure and test run themselves; only the hosted status is read. - The AMD GPU result was not 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!10557
No description provided.