feat(libSceLibreSsl): implement the OCSP status and reason strings #9949

Merged
wrocketdev merged 3 commits from upstream-pr/9949 into main 2026-10-25 18:49:28 +00:00
wrocketdev commented 2026-10-22 23:34:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by wrocketdev on 2026-10-22T23:34:13Z.


What

Implements OCSP_response_status_str, OCSP_cert_status_str and OCSP_crl_reason_str in libSceLibreSsl. Each one maps a 64-bit long code to a static string, using the tables in LibreSSL's ocsp_prn.c. These tables have not changed from revision 1.8 (2015) to 1.12 (2025), so the module's unknown LibreSSL version does not matter here. A value that is not in a table returns (UNKNOWN), as LibreSSL's table2string does. The three stubs are removed from Export.cpp, and the gap (strings not measured on the console) is recorded in docs/dev/debt/libSceLibreSsl.md.

Tested

macOS 26 arm64 (AppleClang, -std=c++20 -Wall -Wextra -Werror): built src/Ocsp.cpp with the new GuestLibreSslOcsp.cpp test, natively and outside the CMake tree. It passes: every code of each table, the gaps (response 4, reason 7), negative values, values above 32 bits and the int64 limits. The full x86-64 Linux/Windows build and ctest were not run on this machine. tools/check_conventions.py --base origin/main passes. tools/pr_overlap.py reports no shared exports; the only conflict is the pending-export count line in the debt file, which every open libSceLibreSsl PR edits.

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

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4975561724 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9949). Originally posted by [wrocketdev](https://github.com/wrocketdev) on 2026-10-22T23:34:13Z. --- ### What Implements `OCSP_response_status_str`, `OCSP_cert_status_str` and `OCSP_crl_reason_str` in libSceLibreSsl. Each one maps a 64-bit `long` code to a static string, using the tables in LibreSSL's [ocsp_prn.c](https://github.com/libressl/openbsd/blob/2e2c612066aa993717528a0249c15c51128d61cb/src/lib/libcrypto/ocsp/ocsp_prn.c). These tables have not changed from revision 1.8 (2015) to 1.12 (2025), so the module's unknown LibreSSL version does not matter here. A value that is not in a table returns `(UNKNOWN)`, as LibreSSL's `table2string` does. The three stubs are removed from `Export.cpp`, and the gap (strings not measured on the console) is recorded in `docs/dev/debt/libSceLibreSsl.md`. ### Tested macOS 26 arm64 (AppleClang, `-std=c++20 -Wall -Wextra -Werror`): built `src/Ocsp.cpp` with the new `GuestLibreSslOcsp.cpp` test, natively and outside the CMake tree. It passes: every code of each table, the gaps (response 4, reason 7), negative values, values above 32 bits and the `int64` limits. The full x86-64 Linux/Windows build and `ctest` were not run on this machine. `tools/check_conventions.py --base origin/main` passes. `tools/pr_overlap.py` reports no shared exports; the only conflict is the pending-export count line in the debt file, which every open libSceLibreSsl PR edits. ### 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 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-22 23:36:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T23:36:26Z.

Review: APPROVED


Reviewed the complete diff against the cited LibreSSL OCSP tables and behavior. The three mappings, gaps (response status 4 and CRL reason 7), and fallback match the reference. I compiled the submitted and with g++ 12 in C++20 mode using and ran the focused test successfully. The PR's conventions, intake, and labels checks also pass; full hosted Linux/Windows jobs are not present under the repository's PR workflow policy.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5622212234 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9949#pullrequestreview-5622212234). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T23:36:26Z. **Review:** APPROVED --- Reviewed the complete diff against the cited LibreSSL OCSP tables and behavior. The three mappings, gaps (response status 4 and CRL reason 7), and fallback match the reference. I compiled the submitted and with g++ 12 in C++20 mode using and ran the focused test successfully. The PR's conventions, intake, and labels checks also pass; full hosted Linux/Windows jobs are not present under the repository's PR workflow policy.
MarcZX10 commented 2026-10-22 23:36:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T23:36:49Z.

Review: APPROVED


Clarification on my review note: I compiled the submitted Ocsp.cpp and GuestLibreSslOcsp.cpp with g++ 12 using C++20, -Wall, -Wextra, and -Werror, then ran the resulting focused OCSP test successfully. The OCSP mappings and unknown-value behavior match the cited LibreSSL implementation.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5622214663 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9949#pullrequestreview-5622214663). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T23:36:49Z. **Review:** APPROVED --- Clarification on my review note: I compiled the submitted Ocsp.cpp and GuestLibreSslOcsp.cpp with g++ 12 using C++20, -Wall, -Wextra, and -Werror, then ran the resulting focused OCSP test successfully. The OCSP mappings and unknown-value behavior match the cited LibreSSL implementation.
MarcZX10 commented 2026-10-23 00:29:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T00:29:18Z.

Review: APPROVED


Reviewed the table mappings, signed 64-bit interface, unknown-value behavior, test coverage, and overlap report. The mappings match the cited LibreSSL OCSP tables; missing codes and out-of-range values return (UNKNOWN). I independently compiled the exact-head Ocsp.cpp and GuestLibreSslOcsp.cpp with GCC 12.2 using -std=c++20 -Wall -Wextra -Werror, then ran the resulting test executable successfully. The author’s macOS test also covers each table code and 64-bit boundaries. Hosted conventions/intake/labels checks pass; full Linux/Windows product builds were not run. Approved at head 0a6d367787643c41a3b2ffa5c47e8946c1bc30f8.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5622549323 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9949#pullrequestreview-5622549323). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T00:29:18Z. **Review:** APPROVED --- Reviewed the table mappings, signed 64-bit interface, unknown-value behavior, test coverage, and overlap report. The mappings match the cited LibreSSL OCSP tables; missing codes and out-of-range values return `(UNKNOWN)`. I independently compiled the exact-head `Ocsp.cpp` and `GuestLibreSslOcsp.cpp` with GCC 12.2 using `-std=c++20 -Wall -Wextra -Werror`, then ran the resulting test executable successfully. The author’s macOS test also covers each table code and 64-bit boundaries. Hosted conventions/intake/labels checks pass; full Linux/Windows product builds were not run. Approved at head 0a6d367787643c41a3b2ffa5c47e8946c1bc30f8.
ahmadmuj commented 2026-10-25 18:47:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-10-25T18:47:02Z.

Review: APPROVED


Reviewed head 00843ba7d261 merged onto main a7a2eece499e (clean merge-tree), Linux x86_64, GCC 13.3.

What I ran:

  • Diff against real LibreSSL 2.5.4: compiled src/Ocsp.cpp unchanged next to OCSP_*_str from a 2.5.4 libcrypto.a, compared the strings for every value in -100000..100000, each 2^k / -2^k with low bits 0..9, INT64_MIN/MAX neighbours, random high words over low codes 0..9, and 10M random int64s. 10,211,577 values per function, 0 mismatches. Only 0-3,5,6 / 0-2 / 0-6,8 give a non-(UNKNOWN) string on both sides, so the gaps at response 4 and reason 7 are right.
  • CMake build of the merged tree: ctest -R "guest_libressl|^public_headers", 76/76 pass, guest_libressl_ocsp included. tools/check_conventions.py --base main passes.
  • Mutation check: I made TableToString compare only the low 32 bits. guest_libressl_ocsp then aborts on OCSP_response_status_str(4294967296), so the test catches a long truncated to int.

Sources: tables and table2string(long, ...) in 2.5.4 ocsp_prn.c (rev 1.8) and the codes in ocsp.h. The pending-export count is 342 in both Export.cpp and the debt line after the merge (345 on main).

No findings. Not checked: anything on a console or with a real title, and the claim in the debt entry that ocsp_prn.c is unchanged up to rev 1.12.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5644708723 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9949#pullrequestreview-5644708723). Originally posted by [ahmadmuj](https://github.com/ahmadmuj) on 2026-10-25T18:47:02Z. **Review:** APPROVED --- Reviewed head `00843ba7d261` merged onto main `a7a2eece499e` (clean merge-tree), Linux x86_64, GCC 13.3. What I ran: - Diff against real LibreSSL 2.5.4: compiled `src/Ocsp.cpp` unchanged next to `OCSP_*_str` from a 2.5.4 `libcrypto.a`, compared the strings for every value in -100000..100000, each 2^k / -2^k with low bits 0..9, INT64_MIN/MAX neighbours, random high words over low codes 0..9, and 10M random int64s. 10,211,577 values per function, 0 mismatches. Only 0-3,5,6 / 0-2 / 0-6,8 give a non-`(UNKNOWN)` string on both sides, so the gaps at response 4 and reason 7 are right. - CMake build of the merged tree: `ctest -R "guest_libressl|^public_headers"`, 76/76 pass, `guest_libressl_ocsp` included. `tools/check_conventions.py --base main` passes. - Mutation check: I made `TableToString` compare only the low 32 bits. `guest_libressl_ocsp` then aborts on `OCSP_response_status_str(4294967296)`, so the test catches a `long` truncated to `int`. Sources: tables and `table2string(long, ...)` in 2.5.4 `ocsp_prn.c` (rev 1.8) and the codes in `ocsp.h`. The pending-export count is 342 in both Export.cpp and the debt line after the merge (345 on main). No findings. Not checked: anything on a console or with a real title, and the claim in the debt entry that ocsp_prn.c is unchanged up to rev 1.12.
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!9949
No description provided.