feat(libSceLibreSsl3): implement SSL_get0_verified_chain #23654

Merged
heditrigui merged 1 commit from upstream-pr/23654 into main 2026-11-19 14:56:47 +00:00
heditrigui commented 2026-11-19 11:44:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by heditrigui on 2026-11-19T11:44:07Z.


What

feat(libSceLibreSsl3): implement \SSL_get0_verified_chain.

  • \SSL_get0_verified_chain\ returns the peer's verified X.509 certificate stack from the layer 3 handshake state (\ssl->s3->hs.verifiedChain) following LibreSSL 4.0.0 \ssl/ssl_lib.c.
  • Returns
    ullptr\ when \ssl\ or \ssl->s3\ is null or when no verified chain is present.
  • Per OpenSSL and LibreSSL \get0\ borrow semantics, the returned stack pointer is borrowed from the connection and does not increment certificate reference counts.
  • Added unit tests in \core/libs/prx/libSceLibreSsl3/tests/SslVerifiedChain.cpp\ exercising null pointer checks, state presence validation, verified chain retrieval, and reference count preservation.
  • Added technical debt fragment in \docs/dev/debt/changes/feat-libressl3-ssl-get0-verified-chain.md.

Tested

  • Zero C++ comments across modified and new files.
  • Pure LF line endings confirmed with \git diff --check.
  • Conventions checked with \ ools/check_conventions.py --base main\ (0 errors).
  • Pre-screened against open pull requests with \ ools/pr_overlap.py\ (0 collisions).

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)
  • No notes, investigation .md\ files or images added to the repository
  • 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:5394230424 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23654). Originally posted by [heditrigui](https://github.com/heditrigui) on 2026-11-19T11:44:07Z. --- ### What feat(libSceLibreSsl3): implement \SSL_get0_verified_chain\. - \SSL_get0_verified_chain\ returns the peer's verified X.509 certificate stack from the layer 3 handshake state (\ssl->s3->hs.verifiedChain\) following LibreSSL 4.0.0 \ssl/ssl_lib.c\. - Returns \ ullptr\ when \ssl\ or \ssl->s3\ is null or when no verified chain is present. - Per OpenSSL and LibreSSL \get0\ borrow semantics, the returned stack pointer is borrowed from the connection and does not increment certificate reference counts. - Added unit tests in \core/libs/prx/libSceLibreSsl3/tests/SslVerifiedChain.cpp\ exercising null pointer checks, state presence validation, verified chain retrieval, and reference count preservation. - Added technical debt fragment in \docs/dev/debt/changes/feat-libressl3-ssl-get0-verified-chain.md\. ### Tested - Zero C++ comments across modified and new files. - Pure LF line endings confirmed with \git diff --check\. - Conventions checked with \ ools/check_conventions.py --base main\ (0 errors). - Pre-screened against open pull requests with \ ools/pr_overlap.py\ (0 collisions). ### Checklist - [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 - [x] Unimplemented paths throw (\NotImplemented_nid_no_patch\) - [x] No notes, investigation \.md\ files or images added to the repository - [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
PrivacyOnion commented 2026-11-19 11:59:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-19T11:59:32Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 858c1c3736:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_libressl3_ssl_verified_chain_tests failed to build.
    core/libs/prx/libSceLibreSsl3/tests/SslVerifiedChain.cpp:36:18: error: invalid conversion from ‘void**’ to ‘char**’ [-fpermissive]
    core/libs/prx/libSceLibreSsl3/tests/SslVerifiedChain.cpp:44:29: error: comparison between distinct pointer types ‘char*’ and ‘LibreSsl3X509*’ lacks a cast [-fpermissive]
    

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5974571175 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23654#pullrequestreview-5974571175). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-19T11:59:32Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `858c1c3736`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_libressl3_ssl_verified_chain_tests` failed to build. ``` core/libs/prx/libSceLibreSsl3/tests/SslVerifiedChain.cpp:36:18: error: invalid conversion from ‘void**’ to ‘char**’ [-fpermissive] core/libs/prx/libSceLibreSsl3/tests/SslVerifiedChain.cpp:44:29: error: comparison between distinct pointer types ‘char*’ and ‘LibreSsl3X509*’ lacks a cast [-fpermissive] ``` Requesting changes for the points above.
PrivacyOnion commented 2026-11-19 13:30:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-19T13:30:49Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against dd2e2e84fe:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_libressl3_ssl_verified_chain_tests built cleanly.
  • CTest (guest_libressl3_ssl_verified_chain):
    1/1 Test #4565: guest_libressl3_ssl_verified_chain ...   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp, core/libs/prx/libSceLibreSsl3/include/Api.hpp, core/libs/prx/libSceLibreSsl3/include/Ssl.hpp, core/libs/prx/libSceLibreSsl3/src/SslVerifiedChain.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified SSL_get0_verified_chain_nid_postfix correctly null-checks both ssl and ssl->s3, returning nullptr if either is null.
    • Verified return value retrieves ssl->s3->hs.verifiedChain conforming to LibreSSL ssl/ssl_lib.c get0 borrow semantics without refcount modification.
    • Verified struct LibreSsl3Ssl3State and LibreSsl3Hs memory layout, field alignments, and static_asserts (sizeof 80, offsets 40 and 72) in Ssl.hpp.
    • Verified declaration const LibreSsl3Stack* APS5_VABI SSL_get0_verified_chain_nid_postfix(const LibreSsl3Ssl* ssl) in Api.hpp and removal of the NotImplemented stub in AdditionalExports.cpp.
    • Verified test coverage in tests/SslVerifiedChain.cpp thoroughly validates nullptr inputs, null s3, null chain, and valid chain retrieval without refcount modification.
    • Verified AGENTS.md compliance: no comments in code, correct tech debt fragment in docs/dev/debt/changes/, and CMakeLists.txt test configuration.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5975937866 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23654#pullrequestreview-5975937866). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-19T13:30:49Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `dd2e2e84fe`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_libressl3_ssl_verified_chain_tests` built cleanly. - **CTest** (`guest_libressl3_ssl_verified_chain`): ``` 1/1 Test #4565: guest_libressl3_ssl_verified_chain ... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp`, `core/libs/prx/libSceLibreSsl3/include/Api.hpp`, `core/libs/prx/libSceLibreSsl3/include/Ssl.hpp`, `core/libs/prx/libSceLibreSsl3/src/SslVerifiedChain.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified SSL_get0_verified_chain_nid_postfix correctly null-checks both ssl and ssl->s3, returning nullptr if either is null. - Verified return value retrieves ssl->s3->hs.verifiedChain conforming to LibreSSL ssl/ssl_lib.c get0 borrow semantics without refcount modification. - Verified struct LibreSsl3Ssl3State and LibreSsl3Hs memory layout, field alignments, and static_asserts (sizeof 80, offsets 40 and 72) in Ssl.hpp. - Verified declaration const LibreSsl3Stack* APS5_VABI SSL_get0_verified_chain_nid_postfix(const LibreSsl3Ssl* ssl) in Api.hpp and removal of the NotImplemented stub in AdditionalExports.cpp. - Verified test coverage in tests/SslVerifiedChain.cpp thoroughly validates nullptr inputs, null s3, null chain, and valid chain retrieval without refcount modification. - Verified AGENTS.md compliance: no comments in code, correct tech debt fragment in docs/dev/debt/changes/, and CMakeLists.txt test configuration. Looks Good To Me
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!23654
No description provided.