Skip to content

feat(libSceLibreSsl3): implement session time and version accessors - #15119

Merged
oneandonlydean merged 4 commits into
boykopovar:mainfrom
atharvjairath:feat/libressl3-session-metadata
Nov 6, 2026
Merged

oneandonlydean merged 4 commits into
boykopovar:mainfrom
atharvjairath:feat/libressl3-session-metadata

Conversation

@atharvjairath

@atharvjairath atharvjairath commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

What

SSL_SESSION_get_timeout, SSL_SESSION_set_time and SSL_SESSION_get_protocol_version now access the session fields directly. The timeout and time fields preserve signed 64-bit guest values on Windows as well as Linux. The setter writes eight bytes and returns the assigned value. A null timeout or set-time input returns zero. A null version input throws.

The selected version, timeout and time offsets are 0, 168 and 176. LibreSSL 2.5.4 has different time-field offsets. BunnyFl reported matching accesses in firmware 13.42 disassembly. Session allocation, serialization, expiry and TLS resumption remain open integration questions. LibreSSL 4.0.0 accessors · Session layout · BunnyFl’s firmware evidence

The prior layout uses offsets 144 and 152 for timeout and time. The reported firmware entries are 0xf2130, 0xf2150 and 0xf2170 respectively. The reviewer also reported native Windows fixture results from an older integration. Contributor report

The source scanner classifies 23/276 bodies as implemented on main and 26/276 on this branch. The difference is the 3 exports above. The scanner classifies source bodies and does not measure firmware compatibility. The additional export inventory has 172 pending entries (162 named, 10 known only by NID).

Integration order is #14992 → #15031 → #15045 → #15119 → #15406. This branch is based directly on main 6d173c1a1978. Each branch keeps its own changes. The order allows the shared CMake registrations and debt counts to be reconciled after each merge.

Tested

Validated head 1f3df99f818c against main 6d173c1a1978.

  • Linux: GCC 13.3 x86-64 under QEMU 11.0.3, 15 passed, 0 failed, 0 skipped. The upstream mixed-EVP fixture patched and loaded real modules in both library orders.
  • Windows PE: WinLibs 15.2 UCRT under Wine 9 and QEMU 11.0.3, 14 passed, 0 failed, 0 skipped. Both platforms ran the module’s registered direct tests and the owned fixture. The owned fixture completed in 0.0676087 s on Linux and 1.01638 s under Wine. Loader traces identified this branch’s module.
  • Rebuilt LibreSSL3 independently per branch. The common libc, kernel and parent LibreSSL binaries were rebuilt once per platform from sources identical across the five branches. A translation unit including the public LibreSSL3 umbrella twice compiled with warnings treated as errors on both platforms. The focused selection uses the registered timeouts and leaves the optional oracle and separate parent error-string and packaged-NID groups outside this run. Full-product, native Windows and console testing remain outside this run.
  • The first external Windows harness omitted the repository’s libc unwind post-build step. It built liblibc.dll with the .eh_frame section and exception fixtures failed. The corrected harness uses configure_windows_unwind(libc), which produces .ehfram. Windows counts above are from the corrected build.
  • Integration previews on later main 7ad9749 preserved the exact branch and upstream diffs. Runtime results above are pinned to the tested base.
  • Conventions and diff checks passed. The repository-wide public-header audit exited 1 with the same five WebKit declarations reported on a separate snapshot of the tested main commit.
  • The overlap tool exited 2 and reported 54 PRs, including 31 it could not compare cleanly with main. Manual comparison of shared registrations, APIs, debt and export changes found no competing implementation of these exports.

BunnyFl’s earlier review attributed native fixture results to an older commit. The current results above are from the local Linux and Windows PE runs.

Both loader runs printed session metadata: 7296 cases, 80274 checks.

Earlier validation on 521ec17 and the historical commits cited below

Current refreshed head 521ec17923ddf932adbdf44701e15c4d7553a61c on frozen main d1ae628bc2f62459cce1e9872ba5632c938c71f2. Only debt documentation conflicted. Every original owned production/API/CMake/fixture addition and deletion is preserved; upstream ASN1_TIME_diff and all main unions remain intact. Prior reviews and CI are pinned to older heads below.

  • Linux GCC 13.3, x86-64 through native ARM QEMU 11.0.3: complete real LibreSSL3 module and all registered modern/crypto fixtures rebuilt, 12/12 passed in 0.79s.
  • Windows PE WinLibs GCC 15.2 UCRT/Wine 9 through native ARM QEMU 11.0.3: real LibreSSL3 module and all registered executables rebuilt serially (-j1), 12/12 passed in 36.61s.
  • The PR’s fixture still reports 7,296 cases / 80,274 checks on both platforms (0.0484608s Linux / 3.42574s Windows PE). All 11 LibreSSL3 registrations, including new upstream time/version cases, plus crypto_memcmp are included. Actual registered timeouts are preserved. Loader traces verify each PR’s fixture loads its own rebuilt module.
  • Common libc and parent LibreSSL artifacts are reused from the freshly rebuilt, exact-source-identical d1ae628 integration, with full dependency-input equality and hashes retained. They were not rebuilt separately for each of these four PRs. The separate signature integration ran 44 Linux and 14 focused Windows tests; those are not this PR’s suite counts. This refresh does not rerun the separate parent/error-string/packaged protocol-NID groups.
  • After-commit conventions, diff check, public-header audit and twice-included standalone Linux C++20/-Werror umbrella pass. Exact overlap CLI exits 2, not an automated pass. Every currently reported external peer’s shared payload is manually compared; the report can include this PR’s own old published head, which is the same implementation being refreshed, not a competing duplicate. Full current reports and head/merge-base snapshots are retained below.

These are focused module tests, not independent native Windows, full-product, packaged-module/NID, title/homebrew or physical-console validation. Known unrelated Wine limitations remain unresolved; no assertion, timeout, gate or runtime workaround changed. The default-off oracle was not enabled. Warnings remain. No new native CI result or current approval is inferred from older heads.

Historical native Windows CI job125440772243/run41490727885 audited on main a4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8 plus OLD implementation head efef6f4e260633e683b66b4d7d35f6999af59910: 2,010 Passed / 957 Skipped / zero Failed across 2,967 unique rows, 141.61s; all 46 LibreSSL registrations including session metadata passed. Separate full-build/runtime/skip-audit/graph steps were skipped. This pinned native CI unit/runtime evidence does not validate the refreshed head. Original local Linux 43/43 and Windows PE 13/13 at efef/b28 and four rejected external mutation controls remain archived. BunnyFl’s later review approves OLD documentation head f3bbebc3e8629e114cbf61cc1bf44d322ef6f13e and confirms attribution wording/conventions; it is not approval of this rebase. The f3bb Windows check succeeded, but its logs were not audited here and no additional runtime coverage is claimed.

Receipts: /private/tmp/anyps5-advance-20261103-0127/conflict-refresh/15119 and the shared validation-evidence.tar.gz, common-input-equality.json, heads-rebased.json, manual-shared-review.txt, peers-final and reproducible harness/scripts. Previous local/native evidence remains in the linked Nov2 receipts with its original pins.

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: feat(libSceLibreSsl3): implement TLS protocol list parsing #15045
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
Overlap report before the branch refresh was pushed

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 14366 docs/dev/debt/libSceLibreSsl3.md L35, L215
PR 14465 docs/dev/debt/libSceLibreSsl3.md L35
PR 14483 docs/dev/debt/libSceLibreSsl3.md L35
PR 14889 docs/dev/debt/libSceLibreSsl3.md L35, L215
PR 14890 docs/dev/debt/libSceLibreSsl3.md L32, L35, L215
PR 15119 SSL_SESSION_get_protocol_version
SSL_SESSION_get_timeout
SSL_SESSION_set_time
core/libs/prx/libSceLibreSsl3/src/SessionMetadata.cpp
core/libs/prx/libSceLibreSsl3/tests/SessionMetadata.cpp
PR 15289 docs/dev/debt/libSceLibreSsl3.md L35
PR 15303 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp L218-225
core/libs/prx/libSceLibreSsl3/include/Api.hpp L183-184
docs/dev/debt/libSceLibreSsl3.md L35
PR 15449 docs/dev/debt/libSceLibreSsl3.md L35, L215
PR 15472 docs/dev/debt/libSceLibreSsl3.md L31-32, L35
PR 15514 docs/dev/debt/libSceLibreSsl3.md L35
PR 15591 docs/dev/debt/libSceLibreSsl3.md L35
PR 15616 docs/dev/debt/libSceLibreSsl3.md L31-32, L35
PR 15618 docs/dev/debt/libSceLibreSsl3.md L31-32, L35
PR 15620 docs/dev/debt/libSceLibreSsl3.md L31-32, L35
PR 15622 docs/dev/debt/libSceLibreSsl3.md L31-32, L35
PR 15623 docs/dev/debt/libSceLibreSsl3.md L31-32, L35
PR 15625 docs/dev/debt/libSceLibreSsl3.md L31-32, L35
PR 15627 docs/dev/debt/libSceLibreSsl3.md L31-32, L35
PR 15628 docs/dev/debt/libSceLibreSsl3.md L31-32, L35
PR 15629 docs/dev/debt/libSceLibreSsl3.md L31-32, L35
PR 15826 docs/dev/debt/libSceLibreSsl3.md L35
PR 15831 docs/dev/debt/libSceLibreSsl3.md L35
PR 15854 docs/dev/debt/libSceLibreSsl3.md L35

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 10452 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 10461 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 10490 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 10491 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 10493 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 10631 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 11146 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
docs/dev/debt/libSceLibreSsl3.md
PR 12315 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 12754 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 12928 core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 13486 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 14212 docs/dev/debt/libSceLibreSsl3.md
PR 14499 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 14612 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 14992 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 15031 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 15045 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 15119 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
core/libs/prx/libSceLibreSsl3/src/SessionMetadata.cpp
core/libs/prx/libSceLibreSsl3/tests/SessionMetadata.cpp
docs/dev/debt/libSceLibreSsl3.md
PR 15163 core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15406 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 15544 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 15599 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15601 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
docs/dev/debt/libSceLibreSsl3.md
PR 15631 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 15737 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15758 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 15760 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 15761 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 15765 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 15770 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 15899 core/libs/prx/libSceLibreSsl3/CMakeLists.txt

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Progress report (5637403 → 9ce9113)

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

✅ 3 implemented
Library Name
libSceLibreSsl3 SSL_SESSION_get_protocol_version_nid_postfix
libSceLibreSsl3 SSL_SESSION_get_timeout_nid_postfix
libSceLibreSsl3 SSL_SESSION_set_time_nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libSceLibreSsl3 63/284 (22.18%) 66/284 (23.24%) +1.06%

@BunnyFl BunnyFl 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.

Looks right, and the layout matches the PS5 module, not only LibreSSL 4.0.0. Firmware 13.42's system/common/lib/libSceLibreSsl3.sprx (sha256 ee2c529c87fe21b7ef1e5f13d10c47ee90944f52a1f848fe0995e031817c2c3a), disassembly only. These are the whole functions:

f2130: SSL_SESSION_get_timeout (0JcHkrKJ9iw)
f2130: test %rdi,%rdi ; je f213d        null -> 0
f2135: mov 0xa8(%rdi),%rax ; ret        64-bit at 168

f2150: SSL_SESSION_set_time (XG3hIzt9VXY)
f2150: test %rdi,%rdi ; je f2160        null -> 0
f2155: mov %rsi,%rax
f2158: mov %rsi,0xb0(%rdi) ; ret        64-bit store at 176, returns the new time

f2170: SSL_SESSION_get_protocol_version (0BW+8jTsY54)
f2170: mov (%rdi),%eax ; ret            32-bit at 0, no null check

So the offsets, the null results, the return of set_time and the 32-bit version read all match. The null protocol-version throw stands in for a console fault, as the entry says.

Tested natively on Windows 11, WinLibs GCC 15.2.0 (not Wine), with this head merged onto main: guest_libressl3_session_metadata and public_headers pass. With main's AdditionalExports.cpp and Api.hpp, the new test doesn't compile against the old parameterless stubs.

Non-blocking: the debt entry says "console layout/revision ... are unverified". The listing above settles the three fields for 13.42, so that part could narrow to what's still open: lifecycle interoperability, resumption, serialization and expiry.

@BunnyFl BunnyFl 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.

Re-checked at f3bbebc3e8: the only change is the debt wording, and the new "Session metadata fields" entry states my 13.42 reading correctly (0xf2130 64-bit read at 168 with null giving 0, 0xf2150 64-bit store at 176 returning the time with null giving 0, 0xf2170 32-bit read at 0 with no null check). check_conventions.py passes at this head.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 2, 2026
@atharvjairath
atharvjairath force-pushed the feat/libressl3-session-metadata branch from f3bbebc to 521ec17 Compare November 3, 2026 05:48
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 3, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 5, 2026
@atharvjairath
atharvjairath force-pushed the feat/libressl3-session-metadata branch from 521ec17 to 1f3df99 Compare November 5, 2026 09:57
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 5, 2026
@oneandonlydean oneandonlydean self-assigned this Nov 6, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Hi @atharvjairath, we merged current main into this branch (merge commit 24d1fb6) to clear conflicts in docs/dev/debt/libSceLibreSsl3.md with the LibreSSL exports that landed (RSA_get0_factors/crt_params and others): Additional exports are now 170 (160 named) and the NID-names line reads 110 of the 126. Thanks!

Keeps the session metadata test target beside the TLS protocol, RSA setter and pkey query targets from main, and recounts the LibreSSL debt figures for both sets of exports.
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 6, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Hi @atharvjairath,

main moved again and conflicted with this PR in the libSceLibreSsl3 CMakeLists.txt and its debt doc, where other PRs added their own source and test blocks and changed the same export counts. I merged main into your branch (merge commit 9ce9113, no force-push, your commits are untouched). Your session metadata block and the new TLS protocol, RSA setter and pkey query blocks are all kept. The export counts now read 160 remaining callable exports (150 named, 10 known only by NID) and 103 of the 126 NID-only exports carrying names, counted on the merged tree. The libressl3 tests build and pass on the merge (29 of 29).

Nothing needs doing on your side.

@oneandonlydean
oneandonlydean merged commit 9ade3ed into boykopovar:main Nov 6, 2026
12 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.

3 participants