Skip to content

feat(libSceLibreSsl3): implement the SSL_CTX, SSL, SSL_SESSION and X509 retains, the SSL_CTX version bounds, SSL_get_client_random and X509_get_version - #12754

Merged
oneandonlydean merged 3 commits into
boykopovar:mainfrom
Lindamea1:feat/libressl3-ssl-x509-objects
Nov 6, 2026

Conversation

@Lindamea1

@Lindamea1 Lindamea1 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What

On main, libSceLibreSsl3 exports these eight LibreSSL calls as stubs that throw (Export.cpp L279-L307, L364-L367, L379-L382). This PR implements them with LibreSSL 4.0.0 behaviour, the version of the firmware module (OpenSSL_version(0) measured in #8981). Names and NIDs are unchanged; the stubs are replaced by src/Key.cpp, src/Ssl.cpp and src/X509.cpp.

SSL_CTX_up_ref, its guest_libressl3_key_reference case and the LibreSsl3SslCtx struct in include/Key.hpp come from #12578. PrivacyOnion closed that pull request unmerged on 31 October, together with 28 other pull requests of theirs and without a comment. No other open PR implements the call and the version bounds need the struct, so this PR keeps that commit under their authorship and no longer depends on #12578. Its code is unchanged by the rebase; only its debt lines were merged with main. This PR's own change is the last commit. It appends the SSL_CTX members the version bounds need to that struct, with their static_assert lines.

Export NID Behaviour
int SSL_up_ref(SSL*) lHGGE+Ubycs adds 1 to the int32 count at offset 176; returns 1 if the new count is above 1, else 0
int SSL_SESSION_up_ref(SSL_SESSION*) MOISxAYBtc0 the same, count at offset 184
int X509_up_ref(X509*) HrCznvA8AQk the same, count at offset 28
int SSL_CTX_up_ref(SSL_CTX*) AmNeqCMs2oU the same, count at offset 40
int SSL_CTX_set_min_proto_version(SSL_CTX*, uint16_t) NG+D00RsX1Y below
int SSL_CTX_set_max_proto_version(SSL_CTX*, uint16_t) mF9+FT4UKSE below
size_t SSL_get_client_random(const SSL*, unsigned char*, size_t) 1sWluYvAfBM below
long X509_get_version(const X509*) gg2cJQtaEns below
  • Retains: the four retains use Retain_nid_no_patch of the merged EVP_PKEY_up_ref (feat(libressl3): retain EVP and EC key references #11165), moved from src/Key.cpp into include/Reference.hpp (inline; the overflow message no longer says "key"). SSL_CTX_up_ref stays in src/Key.cpp, next to the merged EVP_PKEY_up_ref, EC_KEY_up_ref and RSA_up_ref, which use the moved helper too. It adds atomically. In 4.0.0, CRYPTO_add is CRYPTO_add_lock (crypto.h L207-L208), which adds under the library's own pthread mutexes and calls no locking callbacks (crypto_lock.c L24-L96). A null object and a count of INT32_MAX throw without changing memory, as in the merged retains: upstream dereferences the null object, and its signed add at INT32_MAX is undefined behaviour. BunnyFl's native run of the firmware module for feat(libressl3): retain EVP and EC key references #11165 showed that the module wraps EVP_PKEY and EC_KEY counts at INT32_MAX (comment); the SSL and X509 counts were not measured.
  • Version bounds follow ssl_version_set_min and ssl_version_set_max on ctx->method. Version 0 stores the method bound in min_tls_version (offset 128) or max_tls_version (130) and 0 in min_proto_version (132) or max_proto_version (134), and returns 1. For a DTLS method (any nonzero dtls), 0xFEFF and 0xFEFD map to TLS 1.1 and 1.2 and every other nonzero value returns 0. A TLS method takes the value as a plain number, so there a DTLS value, numerically above every TLS version, fails as a minimum and is lowered to the method maximum as a maximum. The call returns 0 when the method range is inverted, when the value and the stored opposite TLS bound are inverted, or when the two ranges do not meet. Otherwise a minimum below the method minimum is raised to it, or a maximum above the method maximum is lowered to it. For a DTLS method the result is converted back to the DTLS form, and the call returns 0 if it has none. Then both fields are stored and the call returns 1. A call that returns 0 writes nothing and queues no error. A null context or method throws; upstream dereferences both.
  • SSL_get_client_random: a null out returns 32 without reading the SSL. Otherwise it copies min(32, max_out) bytes from s->s3->client_random (s3 at offset 56 of SSL, client_random at 40 of SSL3_STATE) and returns the count. A null SSL throws. A null s3 throws only when there is something to copy, since a 0-byte copy reads nothing.
  • X509_get_version returns ASN1_INTEGER_get(x->cert_info->version) with the 4.0.0 rules, as a 64-bit value on every host, including Windows, where long is 32 bits. A null version gives 0. A negative length gives -1 with no error. A type other than 2 or 0x102 gives -1 and queues ERR_PACK(13, 0xfff, 225) (0x0DFFF0E1). Every byte is read, so leading zeros are accepted; a byte that would overflow 64 bits gives -1 with 0x0DFFF0DF (ASN1_R_TOO_LARGE), as does a positive value above INT64_MAX. A negative magnitude above 2^63 gives -1 with 0x0DFFF0E0 (ASN1_R_TOO_SMALL). A null certificate or cert_info, and null data with a positive length, throw.
  • Error queue: X509_get_version is the first libSceLibreSsl3 export that queues errors (the merged d2i_ASN1_INTEGER does not, debt line 9). It queues through LibreSslPutError_nid_no_patch into the libSceLibreSsl queue. On Linux and macOS, the ERR_get_error of a libSceLibreSsl3 importer resolves to libSceLibreSsl by dependency lookup and reads that queue. On Windows, a scoped import searches only the named module and libc (WindowsEntryStubBuilder.cpp L171-L200), and the merged feat(libSceLibreSsl3): complete callable declarations and parent forwarding #12369 forwards libSceLibreSsl3's ERR_get_error to libSceLibreSsl (ParentExports.cpp L234-L235), so the importer reads that queue there too. feat(libSceLibreSsl3): complete callable declarations and parent forwarding #12369's debt entry lists that forwarding as unverified at runtime on Windows, and I have not run it.

include/Ssl.hpp and include/X509.hpp declare the 4.0.0 prefixes of SSL_METHOD, SSL, SSL3_STATE, SSL_SESSION, X509 and X509_CINF. The SSL_CTX prefix is LibreSsl3SslCtx in include/Key.hpp, extended to the version bounds at 128-135; the setters read its const void* method as SSL_METHOD. The fields are fixed-width, so the offsets also hold with the 32-bit long of MinGW, and every offset used has a static_assert. No constructor of these objects is implemented in either LibreSSL library (SSL_CTX_new, SSL_new and d2i_X509 throw in libSceLibreSsl), so all of them are caller-owned here, as for the merged EVP_PKEY_up_ref.

References, LibreSSL 4.0.0 (libressl-v4.0.0, ce488b78e0bd):

The code is written from the behaviour above; no upstream source is copied.

Gaps, as three new entries in docs/dev/debt/libSceLibreSsl3.md:

  • SSL_CTX_up_ref, feat(libressl3): retain SSL_CTX references #12578's entry: the console layout and retain/release interoperability are unverified. The count at offset 40 follows 4.0.0, and null contexts and signed-counter overflow, undefined upstream, throw without changing memory.
  • The SSL offsets are inferred from 4.0.0 and not measured on the firmware module. A libSceLibreSsl3 importer reaches the 2.5.4 constructor stubs of libSceLibreSsl, by dependency lookup on Linux and macOS and through feat(libSceLibreSsl3): complete callable declarations and parent forwarding #12369's forwarding on Windows, and 2.5.4 lays out the SSL_METHOD, SSL_CTX, SSL and SSL_SESSION objects these calls read differently, so every SSL call here would misread a 2.5.4 object once those constructors are implemented. Signed-counter overflow at INT32_MAX and null objects, undefined upstream, throw without changing memory.
  • X509_get_version queues its errors in the libSceLibreSsl queue without file or line, while the firmware module keeps its own queue.

The pending-export count in the same file goes from 80 to 72. python3 tools/progress.py --module libSceLibreSsl3 goes from libraries 12/270 (4.44%) to libraries 20/270 (7.41%).

Firmware evidence: the SSL offsets (SSL_CTX 40 and 128-135, SSL 56 and 176, SSL3_STATE 40, SSL_SESSION 184) would be settled by a native run of the firmware libSceLibreSsl3.sprx on module-created objects, like BunnyFl's for #11165 (comment), for example SSL_CTX_new(TLS_client_method()) followed by these calls. If review wants that first, the X509 pair can go in its own pull request: src/X509.cpp, include/X509.hpp, include/Reference.hpp with the src/Key.cpp change, the X509 cases of the test, the third debt entry, and its own lines in CMakeLists.txt, Api.hpp, Export.cpp and on line 5 of the debt file.

No title is known to import these functions; this is coverage, and it unblocks nothing while the constructors throw. They are TLS client calls of code built against LibreSSL 2.9 or later. LibreSSL 2.7 and 2.8 already export the other seven, but define X509_get_version as a macro over ASN1_INTEGER_get (2.8.0 x509.h L592); 2.9.0 makes it a function (x509_set.c L90-L94).

Overlap, checked at 15:36Z on 31 October with this branch against main 474030e and the 1,670 open PR heads fetched then:

Lines this branch shares with those it could compare:

#9571 merges with this branch without a conflict. It gives LibreSslPutError_nid_no_patch an optional file and line, which the three-argument call here still compiles against. It also implements libSceLibreSsl3's ERR_peek_last_error on the libSceLibreSsl queue, so after it that call also sees X509_get_version errors, as ERR_peek_error already does.

Proposed order: this PR before #12945; the others in any order. This PR needs nothing from those, and I rebase it onto each one that lands before it.

Tested

Linux (Gentoo, kernel 7.2.8, AMD Ryzen 7 9800X3D), GCC 16.2.1, Ninja, Release build with BUILD_TESTING=ON.

Current head, 34728c573e, on main 474030e, with #12578's commit as 3e2103d0f3:

  • This branch conflicted with main in include/Key.hpp, src/Key.cpp, GuestLibreSsl3KeyReference.cpp and the debt file after feat(libSceLibreSsl3): implement RSA_up_ref #13267 (RSA_up_ref), and feat(libressl3): retain SSL_CTX references #12578 was closed, so I rebased both commits onto main. Against the previous head 0ee29b8d1b, the added and removed lines of both commits are unchanged outside docs/. The resolutions keep RSA_up_ref and SSL_CTX_up_ref side by side in those files and recount line 5 of the debt file. The rebase also drops the blank line that feat(libressl3): retain SSL_CTX references #12578's rebase left at the end of the debt file, and SSL_CTX_up_ref's entry now cites ssl_local.h at the 4.0.0 commit its label names. feat(libSceLibreSsl3): implement EVP_CIPHER_key_length and EVP_CIPHER_iv_length #13659 (EVP_CIPHER_key_length, EVP_CIPHER_iv_length) landed in this library afterwards and rebased without a conflict. Its two exports came from the additional export inventory, so line 5 stays at 72.
  • CI test selection (the steps below): 648 of 3062 tests selected, 648/648 passed, none skipped, with public_headers, guest_crypto_memcmp and the seven guest_libressl3_* tests.
  • python3 tools/check_test_registration.py build: passed (1632 test executables, none built and not run).
  • python3 tools/check_conventions.py --base 474030e584, also with this title and description: passed.
  • NID-patched build/core/libs/libs/libSceLibreSsl3.prx: the eight NIDs are exported at the addresses of their _nid_postfix definitions. The inline helper is not among the library's 397 defined dynamic symbols.
  • MinGW-w64 syntax check (the command below) of Export.cpp, Key.cpp, Ssl.cpp, X509.cpp, GuestLibreSsl3Ssl.cpp and GuestLibreSsl3KeyReference.cpp: no diagnostics. This is not a Windows build or run.
  • The pull request's Windows CI job on this head, merged onto main 474030e: 2524 tests, 0 failed, 894 skipped. guest_libressl3_ssl, guest_libressl3_key_reference, guest_crypto_memcmp and the other five guest_libressl3_* tests passed.

Previous head, 0ee29b8d1b, on #12578's ced92ec4ed (main f7f03da), with the same code and tests:

  • The pull request's Windows CI job passed: it merges the head onto main f911371 and builds everything, but it runs none of the LibreSSL tests.
  • CI test selection (the steps below): 629 of 2977 tests selected, 629/629 passed, none skipped, with all five libSceLibreSsl3 tests (guest_crypto_memcmp among them). This ran before the last amend, which changed only the debt file.
  • python3 tools/check_test_registration.py build: passed (1579 test executables, none built and not run).
  • python3 tools/check_conventions.py --base upstream/main, also with that head's title and description: passed.
  • NID-patched build/core/libs/libs/libSceLibreSsl3.prx: the seven NIDs, and feat(libressl3): retain SSL_CTX references #12578's SSL_CTX_up_ref, are exported at the addresses of their _nid_postfix definitions. The inline helper is not among the library's 397 defined dynamic symbols.
  • MinGW-w64 syntax check (the command below) of Export.cpp, Key.cpp, Ssl.cpp, X509.cpp, GuestLibreSsl3Ssl.cpp and GuestLibreSsl3KeyReference.cpp: no warnings. This is not a Windows build or run.

Earlier head, 48bc460a1d (#12578's 00b24c75b4 and this commit, on main 319621b), with the same code and tests:

  • ctest --test-dir build -R 'guest_libressl3_ssl|guest_libressl3_key_reference|public_headers' --output-on-failure -j8 --timeout 300: 67/67 passed (public_headers and its 64 compile batches, guest_libressl3_key_reference with feat(libressl3): retain SSL_CTX references #12578's SSL_CTX_up_ref case on the extended struct and the moved helper, and guest_libressl3_ssl).
  • python3 tools/check_test_registration.py build: passed (1516 test executables, none built and not run).
  • CI test selection (tools/select_tests.py dump, select with the changed files, ninja -f select.ninja selected, select_tests.py ctest): 491 of 2746 tests selected, 491/491 passed.
  • python3 tools/check_conventions.py --base 319621ba2, also with that head's title and description: passed.
  • Merged into main 3a2b919 without conflicts and rebuilt: ctest -R 'guest_libressl3|public_headers', 69/69 passed; CI test selection on the merge, 580 of 2858 tests selected, all five libSceLibreSsl3 tests (with guest_crypto_memcmp) among them, 580/580 passed.
  • The new guest_libressl3_ssl test (core/libs/tests/GuestLibreSsl3Ssl.cpp):
    • Each retain on a guarded object with counts -2, 0, 1, 37 and INT32_MAX - 1: the return value, and only the four count bytes at the stated offset change. Then 4 threads × 1000 retains give exactly 4001.
    • 44 version-bound cases on TLS- and DTLS-client-like methods. They cover version 0, raising and lowering to the method bounds, each failing condition of the clamp on its own, DTLS values on a TLS method (both setters, 0xFEFF and 0xFEFD) and TLS values on a DTLS method, a clamped result with no DTLS form, a dtls flag of -1, and the opposite bound read from the TLS field. Each case checks the return value and every byte of the guarded context, so a failing call writes nothing.
    • SSL_get_client_random with a null output (also with a null SSL) and with limits 0, 1, 10, 31, 32, 33, 64 and SIZE_MAX: the count, the bytes taken from offset 40 of the state, and an untouched tail. A 0-byte copy with a null s3 returns 0.
    • X509_get_version on 22 integers (null, empty, negative length, leading zeros, big-endian order, INT64_MAX, INT64_MIN, negative zero, wrong types, each overflow): the value, the exact error code and that nothing else is queued.
    • It has no assertion that only checks for a throw.
  • The test rejects wrong implementations. I compiled it with 33 mutated copies of Ssl.cpp, X509.cpp and Reference.hpp against the built libSceLibreSsl, libc and libkernel, and every one aborted. The mutants dropped each clamp condition, read the opposite bound from the proto field, mapped or rejected DTLS values on a TLS method, used a wrong count field, copied the server random, ignored max_out, added the 2.5.4 eight-byte limit, changed an error reason or the library, and so on. The unmodified sources passed.
  • NID-patched build/core/libs/libs/libSceLibreSsl3.prx: the seven NIDs, and feat(libressl3): retain SSL_CTX references #12578's SSL_CTX_up_ref, are exported at the addresses of their _nid_postfix definitions. The library has 88 defined dynamic symbols, the 87 exports and DummyFunction_nid_no_patch, so the inline helper is not exported.
  • MinGW-w64 syntax check of the changed files only (x86_64-w64-mingw32-g++ 16.2.0, -std=gnu++20 -fsyntax-only -Wall -Wextra -D_WIN32_WINNT=0x0602 -I core/libs -I core/libs/nid/include -I core/libs/prx/libkernel) on Export.cpp, Key.cpp, Ssl.cpp, X509.cpp, GuestLibreSsl3Ssl.cpp and GuestLibreSsl3KeyReference.cpp, and on Key.hpp, Ssl.hpp, X509.hpp, Reference.hpp and Api.hpp each included alone with -Werror: no warnings. This is not a Windows build or run.
  • Windows, by @JJenkx: that head merged onto main edf6804, Windows 11 Enterprise, WinLibs GCC 15.2.0 UCRT, Ninja, Release, BUILD_TESTING=ON. guest_libressl3_key_reference and guest_libressl3_ssl passed 3 of 3 with ctest --repeat until-fail:3; no negative control, since the build fails with this PR's sources put back to main's (comment). The pull request's Windows CI job also passed.
  • Not compared with a console and not run with a title or homebrew.

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

@JJenkx

JJenkx commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Windows run of this head (48bc460a1d), merged onto main edf6804cf5 (clean merge, local only). Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7, Ninja, Release, BUILD_TESTING=ON, no Vulkan driver visible.

  • This PR: guest_libressl3_key_reference, guest_libressl3_ssl pass 3 of 3 (ctest --repeat until-fail:3).
  • Negative control: not possible. With this PR's source files (core/libs/prx/libSceLibreSsl3/Export.cpp, core/libs/prx/libSceLibreSsl3/include/Api.hpp, core/libs/prx/libSceLibreSsl3/include/Key.hpp, core/libs/prx/libSceLibreSsl3/include/Reference.hpp, core/libs/prx/libSceLibreSsl3/include/Ssl.hpp, core/libs/prx/libSceLibreSsl3/include/X509.hpp and 3 more) put back to main's version, and the ones it adds removed, the build fails against the rest of the PR, so there is no source-only control.

AI-assisted: yes (Claude Code).

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Progress report (ea443a1 → a19cd6a)

📈 System libraries: 28.76% (+0.02%, +8 implemented functions)

✅ 8 implemented
Library Name
libSceLibreSsl3 SSL_CTX_set_max_proto_version_nid_postfix
libSceLibreSsl3 SSL_CTX_set_min_proto_version_nid_postfix
libSceLibreSsl3 SSL_CTX_up_ref_nid_postfix
libSceLibreSsl3 SSL_SESSION_up_ref_nid_postfix
libSceLibreSsl3 SSL_get_client_random_nid_postfix
libSceLibreSsl3 SSL_up_ref_nid_postfix
libSceLibreSsl3 X509_get_version_nid_postfix
libSceLibreSsl3 X509_up_ref_nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libSceLibreSsl3 52/280 (18.57%) 60/280 (21.43%) +2.86%

@oneandonlydean oneandonlydean self-assigned this Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

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 11128 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 12315 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 13486 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 14409 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
core/libs/prx/libSceLibreSsl3/src/Key.cpp
core/libs/tests/GuestLibreSsl3KeyReference.cpp
docs/dev/debt/libSceLibreSsl3.md
PR 14465 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 14499 core/libs/prx/libSceLibreSsl3/include/Api.hpp
core/libs/prx/libSceLibreSsl3/src/Key.cpp
core/libs/tests/GuestLibreSsl3KeyReference.cpp
docs/dev/debt/libSceLibreSsl3.md
PR 14612 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 14889 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15119 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15163 core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15289 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15303 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15406 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15449 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15514 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15544 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15591 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/Export.cpp
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 15826 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15831 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15854 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16111 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16185 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16186 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16249 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16255 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16258 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md

@EagleBearerYS

Copy link
Copy Markdown
Contributor

@Lindamea1 a heads-up: this PR covers five of the six LibreSSL 4.0.0 exports we had prepared on top of #12578, so we won't open those. BIO_up_ref isn't here. We'd like to open it shortly as a small draft stacked on this one, with "Depends on: #12754", merging after yours.

  • The retain: it would use your Retain_nid_no_patch in include/Reference.hpp, as is.
  • The layout: it adds the 112-byte guest BIO, with references at offset 80, from LibreSSL 4.0.0's bio_local.h, with static_asserts.
  • The test: a bio case in GuestLibreSsl3KeyReference.cpp, written like your SSL and SSL_SESSION cases.
  • Your lines stay as they are, apart from the debt file's count line.

@Lindamea1

Copy link
Copy Markdown
Contributor Author

@EagleBearerYS Sounds good, thanks for the heads-up. Agreed: #12754 first, then your BIO_up_ref draft with Depends on: #12754. Retain_nid_no_patch in include/Reference.hpp is fine to use as it is, and I don't plan to change it here. Two notes:

@github-actions github-actions Bot added build docs prx needs rebase Conflicts with main, rebase needed labels Oct 29, 2026
@Lindamea1
Lindamea1 force-pushed the feat/libressl3-ssl-x509-objects branch from 48bc460 to 0ee29b8 Compare October 30, 2026 12:41
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 30, 2026
@DonRyuzaki DonRyuzaki mentioned this pull request Oct 31, 2026
12 tasks done
PrivacyOnion and others added 2 commits October 31, 2026 15:30
…s, the SSL_CTX version bounds, SSL_get_client_random and X509_get_version

SSL_up_ref, SSL_SESSION_up_ref and X509_up_ref add one to the reference
count of a caller-owned object through the retain helper of EVP_PKEY_up_ref,
now shared in Reference.hpp, which SSL_CTX_up_ref also uses.
SSL_CTX_set_min_proto_version and SSL_CTX_set_max_proto_version clamp the
requested bound to the method range and convert DTLS versions; the SSL_CTX
fields they use extend LibreSsl3SslCtx in Key.hpp. SSL_get_client_random
copies up to 32 bytes of the SSL3 client random, and X509_get_version reads
cert_info->version with the ASN1_INTEGER_get rules, queueing its ASN.1
errors.

Behaviour and object layouts follow LibreSSL 4.0.0 (ce488b78e0bd): ssl_lib.c,
ssl_sess.c, ssl_versions.c, ssl_local.h, x_all.c, x509_set.c, x509_local.h
and a_int.c. No upstream source is copied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Lindamea1
Lindamea1 force-pushed the feat/libressl3-ssl-x509-objects branch from 0ee29b8 to 34728c5 Compare October 31, 2026 16:08
@Lindamea1 Lindamea1 changed the title feat(libSceLibreSsl3): implement the SSL, SSL_SESSION and X509 retains, the SSL_CTX version bounds, SSL_get_client_random and X509_get_version feat(libSceLibreSsl3): implement the SSL_CTX, SSL, SSL_SESSION and X509 retains, the SSL_CTX version bounds, SSL_get_client_random and X509_get_version Oct 31, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 31, 2026
EagleBearerYS added a commit to EagleBearerYS/AnyPS5 that referenced this pull request Oct 31, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 1, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 6, 2026
@oneandonlydean
oneandonlydean merged commit caac855 into boykopovar:main Nov 6, 2026
12 checks passed
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Hi @Lindamea1, I merged main into your branch after #15045 landed: the CMake test blocks, Api.hpp, Key.hpp and Key.cpp keep both sides, and the LibreSsl3 pending-exports line keeps main's exclusion list plus your eight names, count 46. No changes to your code.

oneandonlydean pushed a commit that referenced this pull request Nov 6, 2026
#10557 implements X509_PUBKEY_get0_param where this branch, through
#12754, implements the SSL_CTX, SSL and SSL_SESSION retains, the SSL_CTX
version bounds and SSL_get_client_random. In Export.cpp the merge drops
both sides' stubs, and Api.hpp keeps this branch's six declarations and
#10557's X509_PUBKEY_get0_param one. The Windows ENVIRONMENT_MODIFICATION
list in CMakeLists.txt takes both guest_libressl3_ssl and
guest_libressl3_x509_pubkey_param. The pending exports entry counts 64
and adds X509_PUBKEY_get0_param to the implemented ones.
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.

5 participants