Skip to content

feat(libSceLibreSsl3): return from the error-string and digest loaders - #17246

Merged
oneandonlydean merged 39 commits into
boykopovar:mainfrom
fishingpvalues:feat/libressl3-error-string-loaders
Nov 17, 2026
Merged

oneandonlydean merged 39 commits into
boykopovar:mainfrom
fishingpvalues:feat/libressl3-error-string-loaders

Conversation

@fishingpvalues

@fishingpvalues fishingpvalues commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

What

feat(libSceLibreSsl3): return from the error-string and digest loaders. ERR_load_X509_strings, ERR_load_PEM_strings and OpenSSL_add_all_digests are void (void) in LibreSSL, and in firmware 13.42 libSceLibreSsl3.sprx each body is a lone ret (0xc37b0, 0x989d0 and 0x10100, read from the disassembly, not run on a console), so they return without loading anything. The implementations live in src/ErrorStringLoaders.cpp, the exports leave AdditionalExports.cpp, their declarations become void in include/Api.hpp, and the Silent stubs section of docs/dev/debt/libSceLibreSsl3.md records why the tables they would fill are not modelled.

#15591 no longer implements these three: at its head 925b6e1c71 it covers only four SSL_* exports, so this PR goes first. Both PRs still edit the Additional exports count line in docs/dev/debt/libSceLibreSsl3.md; if #15591 merges second it will recount that line from the merged AdditionalExports.cpp. This branch is based on main bfdb58119e.

Tested

Linux x86-64 (Debian 13, glibc 2.41, GCC 14.2.0), Release, BUILD_TESTING=ON, base main f9c2d92b91:

  • cmake --build build --target guest_libressl3_error_string_loaders_tests --parallel 8: passed.
  • ctest --test-dir build -R '^guest_libressl3_error_string_loaders$' --output-on-failure: 1/1 passed.
  • python3 tools/check_conventions.py --base origin/main: all checks passed.
  • Merged main f9c2d92b91 and resolved the technical-debt inventory conflicts; rebuilt and reran the test.
  • Not run: Windows, a console or a title.

Checklist

  • Based on current main; mergeable with the current tip; no other open PR implements the same functions (feat(libSceLibreSsl3): return from four calls as firmware 13.42 does #15591 now covers four SSL_* exports only)
  • 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

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Progress report (bf02f97 → 32c166e)

📈 System libraries: 42.03% (+0.01%, +3 implemented functions)

✅ 3 implemented
Library Name
libSceLibreSsl3 ERR_load_PEM_strings_nid_postfix
libSceLibreSsl3 ERR_load_X509_strings_nid_postfix
libSceLibreSsl3 OpenSSL_add_all_digests_nid_postfix
⚪ 3 behaviourally empty (constant return or throw)
Library Name
libSceLibreSsl3 ERR_load_PEM_strings_nid_postfix
libSceLibreSsl3 ERR_load_X509_strings_nid_postfix
libSceLibreSsl3 OpenSSL_add_all_digests_nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libSceLibreSsl3 562/706 (79.60%) 565/706 (80.03%) +0.42%

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 8, 2026
@fishingpvalues
fishingpvalues force-pushed the feat/libressl3-error-string-loaders branch from 8d21f0c to cccda26 Compare November 8, 2026 16:11
@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 22316 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp L85-90

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 12315 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16981 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17621 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17622 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17626 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 8, 2026

@gabichuuuuu gabichuuuuu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read against the LibreSSL in 3rdparty/libressl-openbsd (078b3d1d), which is what this module follows. I haven't built or run this branch.

The three functions are empty bodies. In LibreSSL they do work. ERR_load_X509_strings and ERR_load_PEM_strings register the reason strings (x509/x509_err.c, pem/pem_err.c). OpenSSL_add_all_digests registers the digests that EVP_get_digestbyname looks up (evp/c_all.c).

Returning without doing either is a silent stub, which CONTRIBUTING doesn't allow unless the debt file lists it under Silent stubs.

  • If the module's error strings and digest lookup don't depend on registration, because the tables are always populated, the debt entry should say that and point to where.
  • Otherwise these should throw until registration exists.

Debt file: compared with main, this branch's docs/dev/debt/libSceLibreSsl3.md drops a BIO_meth line that main now has (src/BioMethod.cpp, #15761), and it repeats the new bullet on two consecutive lines. It looks rebased from an older copy of the file.

@fishingpvalues
fishingpvalues force-pushed the feat/libressl3-error-string-loaders branch from cccda26 to 60643e4 Compare November 8, 2026 16:39
@fishingpvalues

Copy link
Copy Markdown
Contributor Author

Both points addressed in 60643e4.

  • ERR_load_X509_strings and ERR_load_PEM_strings now throw NotImplemented_nid_no_patch: this port has no error-string table (ERR_load_crypto_strings is empty in Export.cpp, ERR_lib_error_string/ERR_reason_error_string throw), and firmware 13.42 gives numeric-only texts for all 917 table codes (#9535).
  • OpenSSL_add_all_digests stays a no-op, with the debt entry saying why and where: EVP_get_digestbyname in src/DigestNames.cpp resolves a static name table and never reads the OBJ_NAME registry that evp/c_all.c fills, so registration cannot change its result.
  • docs/dev/debt/libSceLibreSsl3.md rebuilt from main: the BIO_meth bullet is back, the duplicated bullet is gone, and the inventory is 115/106 with the three rows removed.

Tested on Linux x86-64, Release, BUILD_TESTING=ON: guest_libressl3_error_string_loaders 1/1 passed, guest_libressl3_digest_names passed, python3 tools/check_conventions.py --base origin/main passed. Not run: Windows, console or a title.

@BunnyFl

BunnyFl commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

@fishingpvalues, a heads-up on overlap: #15591 (open since 2026-11-03) implements the same three exports, together with four SSL_* ones (its files). tools/pr_overlap.py on #15591's head lists this PR under "Same exports" for ERR_load_PEM_strings, ERR_load_X509_strings and OpenSSL_add_all_digests. Both PRs change their declarations in core/libs/prx/libSceLibreSsl3/include/Api.hpp and remove their placeholders from AdditionalExports.cpp.

The two differ in behaviour. Here, ERR_load_X509_strings and ERR_load_PEM_strings keep throwing and only OpenSSL_add_all_digests returns. In #15591 all three return, because in firmware 13.42 system/common/lib/libSceLibreSsl3.sprx (sha256 ee2c529c87fe21b7ef1e5f13d10c47ee90944f52a1f848fe0995e031817c2c3a) each body (0x989d0, 0xc37b0, 0x10100) is a lone ret, read from disassembly and not run on a console:

989d0: ret    ; ERR_load_PEM_strings
c37b0: ret    ; ERR_load_X509_strings
10100: ret    ; OpenSSL_add_all_digests

A lone ret is enough there because LibreSSL declares all three void (void) (pem.h:463, x509.h:940, evp.h:744). The full Source section is in #15591's description.

Whichever merges second will conflict on these lines. Also, if #15591 merges first, this PR's test, which expects the first two to throw, would fail. Could we agree on an order? If you're happy for #15591 to go first, this PR could drop the three, or depend on it with Depends on: #15591. If you have evidence that the two loaders do more than return, please say so and I'll re-check #15591.

AI-assisted: yes.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 8, 2026
@fishingpvalues
fishingpvalues force-pushed the feat/libressl3-error-string-loaders branch from 60643e4 to cccda26 Compare November 8, 2026 17:33
Firmware 13.42 gives each of the three a lone `ret` body, and LibreSSL declares them `void (void)`; they load nothing here because no table they fill is modelled.
@fishingpvalues
fishingpvalues force-pushed the feat/libressl3-error-string-loaders branch from cccda26 to 7e9ad1b Compare November 8, 2026 17:44
@fishingpvalues fishingpvalues changed the title feat(libSceLibreSsl3): implement error-string and digest loaders feat(libSceLibreSsl3): return from the error-string and digest loaders Nov 8, 2026
@fishingpvalues

Copy link
Copy Markdown
Contributor Author

Thanks — the firmware evidence settles it, and I have no evidence the loaders do more than return. All three are void (void) with a lone ret now, so this PR and #15591 agree on behaviour.

Changed in 7e9ad1b9e3 (rebased onto main ef9ab2ea44; the debt-file conflict is resolved):

  • ERR_load_X509_strings, ERR_load_PEM_strings and OpenSSL_add_all_digests return from src/ErrorStringLoaders.cpp, with void declarations in Api.hpp; the three throwers leave AdditionalExports.cpp.
  • The debt entry sits under Silent stubs and cites the disassembly at 0xc37b0, 0x989d0 and 0x10100. Also fixed there: a duplicated entry, and the inventory count (117 → 114 unimplemented, 105 named and 9 by NID) with the BIO_meth_* and EVP_PKEY_get0_EC_KEY rows that main already implemented.

Order: this PR is three one-line bodies plus a focused test and a debt entry, so it is cheapest to merge first and let #15591 drop three duplicated lines. If you would rather #15591 went first, say so and I will rebase this down to the test and the debt entry only — Depends on: #15591 then becomes accurate.

Tested: cmake --build build --target guest_libressl3_error_string_loaders_tests --parallel 4 passed, ctest --test-dir build -R '^guest_libressl3_error_string_loaders$' --output-on-failure 1/1 passed, python3 tools/check_conventions.py --base origin/main passed.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 8, 2026
@fishingpvalues

Copy link
Copy Markdown
Contributor Author

Addressed in d1dbb051.

  • docs/dev/debt/libSceLibreSsl3.md (Silent stubs) now records why returning is the implemented behaviour and not an unmodelled table: EVP_get_digestbyname resolves from the always-populated static table in src/DigestNames.cpp; ERR_load_crypto_strings is empty (Export.cpp); ERR_lib_error_string, ERR_func_error_string and ERR_reason_error_string throw (AdditionalExports.cpp). It keeps the firmware 13.42 lone-ret evidence and names the LibreSSL registration sites (x509/x509_err.c, pem/pem_err.c, evp/c_all.c).
  • The debt file keeps main's BIO_meth bullet and has one Silent stubs bullet. The duplicate bullet and the missing BIO_meth entry were in the reviewed pre-rebase commit; the rebased head and this commit retain main's line.
  • tests/ErrorStringLoaders.cpp now checks EVP_get_digestbyname("SHA256") before and after the three loaders, exercising the no-registration claim.

Tested on Linux x86-64, Release, BUILD_TESTING=ON:

  • cmake --build build --target guest_libressl3_error_string_loaders_tests --parallel 4
  • ctest --test-dir build -R '^guest_libressl3_error_string_loaders$' --output-on-failure: 1/1 passed.
  • python3 tools/check_conventions.py --base origin/main: all checks passed.

Windows, a console and titles were not run.

@fishingpvalues

Copy link
Copy Markdown
Contributor Author

Merged origin/main at bfdb58119e into the branch in 1e08539fd4 (main had not touched the PR files, so the merge was clean), and added e2fbe722f1.

  • Scope unchanged: the three void loader bodies in src/ErrorStringLoaders.cpp, their Api.hpp declarations, the removed AdditionalExports.cpp throwers, the focused test, and the Silent stubs debt entry.
  • Trimmed the debt entry from 1263 to 970 characters, which clears the debt-length warning; python3 tools/check_conventions.py --base origin/main now reports All conventions checks passed.

Tested on Linux x86-64, Release, BUILD_TESTING=ON:

  • cmake --build build --target guest_libressl3_error_string_loaders_tests --parallel 4
  • ctest --test-dir build -R '^guest_libressl3_(error_string_loaders|digest_names)$' --output-on-failure: 2/2 passed.
  • python3 tools/check_conventions.py --base origin/main: passed, no findings.

Windows, a console and titles were not run.

BunnyFl added a commit to BunnyFl/AnyPS5 that referenced this pull request Nov 8, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BunnyFl

BunnyFl commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

@fishingpvalues, thanks for checking the firmware and for rebuilding the debt entry. Agreed: this PR goes first. #15591 no longer touches the three loaders. At its head 925b6e1c71 they are back to main's throwing placeholders, int declarations and debt-table rows, and its test no longer calls them. #15591 now covers only the four SSL_* exports.

tools/pr_overlap.py --branch feat/libressl3-trivial-returns --jobs 8 on that head lists no shared export with this PR any more. The two still both edit the "Additional exports" count line in docs/dev/debt/libSceLibreSsl3.md, as every libSceLibreSsl3 PR does. Whichever merges second recounts it from the merged AdditionalExports.cpp, and #15591 will do that if this one lands first.

AI-assisted: yes.

@fishingpvalues

Copy link
Copy Markdown
Contributor Author

Re-checked at e2fbe722f1; no code change was needed. The review points are already covered: the three loaders return from src/ErrorStringLoaders.cpp, Api.hpp declares them void, and the Silent stubs debt entry explains why registration has no observable effect here and records the firmware ret bodies.

Updated the description to match #15591 at 925b6e1c71: it no longer implements these three, so this PR goes first. The shared Additional exports count line stays for #15591 to recount if it lands second.

Linux x86-64, Release, BUILD_TESTING=ON:

  • cmake --build build --target guest_libressl3_error_string_loaders_tests --parallel 4: passed.
  • ctest --test-dir build -R "^guest_libressl3_(error_string_loaders|digest_names)$" --output-on-failure: 2/2 passed.
  • python3 tools/check_conventions.py --base origin/main: passed.

Windows CI passed; all completed checks green.

AI-assisted: yes.

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 9, 2026
bayessawitcoming and others added 3 commits November 13, 2026 17:20
…string-loaders

* origin/main: (40 commits)
  fix(libkernel): guard pthread create guest name (boykopovar#18547)
  fix(libc): guard backtrace guest outputs (boykopovar#18537)
  fix(tools): reject duplicate advisor JSON keys (boykopovar#17990)
  fix(libc): compute exp2l with FreeBSD msun's ld80 code as the bundled libc.prx does (boykopovar#11266)
  feat(libSceNKWebKit): implement PAL::fileSizeDescription (boykopovar#19460)
  feat(libSceNpMatching2): answer 29 calls before initialization as firmware 13.42 does
  fix(libSceNetCtl): keep errno across the host interface query
  fix(libkernel): drop a datagram whose receive faulted on macOS
  docs(libSceSystemLogger2): record the silent Terminate stub and shorten the debt entry
  feat(libSceRegMgr): implement the removed-range key calls as firmware 13.42 does
  feat(libSceSystemLogger2): implement the lifecycle, timestamp and event validation
  feat(libSceNpCppWebApi): return the Matchmaking string members by address
  ci: re-run checks (output_fifo_macos fix landed on main as 584b350 via boykopovar#19406)
  fix(libc): preserve internal C++ assertion diagnostics
  fix(libSceUsbd): copy lists, timeouts, and descriptors via GuestCopyIn/Out
  feat(libSceKeyboard): forward the debug init, open and close calls as firmware 13.42 does
  fix(libSceCesCs): copy profile sheets and contexts via GuestCopyIn/Out
  fix(libc): keep the guest heap alive through static finalization
  fix(libSceRtc): copy parse inputs via GuestCopyIn/Out and preserve errno
  fix(libSceNKWebKit): run a permission request's decision handler once with libc++
  ...

# Conflicts:
#	core/libs/prx/libSceLibreSsl3/CMakeLists.txt
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 13, 2026
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 14, 2026
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 15, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 16, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 16, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 17, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

The three no-op loaders look right, but the CMakeLists.txt in this head drops three things that main still has, which looks like a merge-main slip: the src/EvpCipherUpdate.cpp entry in target_sources, the guest_libressl3_evp_cipher_update test, and the guest_libressl3_pkey_mac_key test. EvpCipherUpdate.cpp is still in the tree, and the windows build fails with "EvpCipherUpdate.cpp defines APS5_VABI functions but no target compiles it". Please restore those three entries and keep the new ErrorStringLoaders ones. Once the windows build is green I expect to pass it again.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 17, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

The CMake registrations are back, thanks to your last commit. One more thing: the new debt entry mentioned EVP_get_digestbyname in its text, and a fragment already on main changes the entry by that name, so the debt fold check matched two entries and failed. I pushed 74bb3b0, which rewords that sentence ("the digest lookup by name uses the static table"). No change is needed from you.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 17, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

Head 74bb3b04c4f4b31513c4795510ec52886c45df6e, base main. No build and no test run here. I read the diff for all six files and searched the repository at the head with the reader (repo_read.py search and repo_read.py cat).

Results

Check Result Note
Loader declarations and definitions match passed Header, src/ErrorStringLoaders.cpp and the test agree
Other references to the three loaders passed Only the header, the new source, the test and the debt doc
Doc claims about existing code passed DigestNames.cpp, Export.cpp and ErrorStrings.cpp do what the doc says
Build and CTest of the new target not run The author reports a pass; I did not repeat it
tools/check_conventions.py not run The author reports a pass; I did not repeat it

Findings

Blocking

None.

Non-blocking

  • docs/dev/debt/libSceLibreSsl3.md:10: the entry sits under ### Functional (heading at line 8). The house rule in CONTRIBUTING.md and the PR checklist put silent stubs under Silent stubs. These loaders are silent no-ops, so the entry belongs there. The PR checklist line "silent stubs are listed under Silent stubs" is therefore not met as written.
  • core/libs/prx/libSceLibreSsl3/tests/ErrorStringLoaders.cpp:23: the test only checks that the digest lookup returns the same pointer before and after the loader calls. It does not check anything the loaders do, so it would pass if they did nothing at all. It only shows that calling them does not crash.

Not verified

  • The build and the CTest target are not run here. The author-reported pass is not something I performed.
  • The description says this PR edits the Additional exports count line in the debt doc. The diff shows no change to a count line. I did not confirm whether the count needs updating.
  • Export binding: I checked that no other source names the three loaders. I did not check how the export table is generated from AdditionalExports.cpp and Api.hpp.
  • The firmware 13.42 disassembly claims (0xc37b0, 0x989d0, 0x10100) are not verified. Nothing here runs on a console.
  • The Silent stubs heading in the debt doc was not located in the lines I read.
  • Files read: ErrorStringLoaders.cpp and tests/ErrorStringLoaders.cpp (new files, read in full from the diff); the diffs of AdditionalExports.cpp, CMakeLists.txt, include/Api.hpp and docs/dev/debt/libSceLibreSsl3.md; the head of include/Api.hpp (lines 1–30), AdditionalExports.cpp (lines 1–20), Export.cpp (lines 20–32) and the debt doc (lines 1–40). Not read in full: AdditionalExports.cpp (219 lines), CMakeLists.txt (934 lines), include/Api.hpp (466 lines) and the debt doc (187 lines).

To get this to a good state

Nothing is required.

Optional:

  • Move the ERR_load_X509_strings entry from Functional into Silent stubs.
  • Make the test check something the loaders are meant to do, or say in the test that it only checks for no crash.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 17, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 17, 2026
@oneandonlydean
oneandonlydean merged commit a8ffa86 into boykopovar:main Nov 17, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants