feat(libressl3): implement EVP_PKEY_bits #14409
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14409"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by DonRyuzaki on 2026-11-01T11:50:25Z.
What
Resubmission of #13941 after the author's PR allowance increased. The original was automatically closed for the earlier PR limit and remains closed; this PR supersedes it.
Implement
EVP_PKEY_bitsin the existinglibSceLibreSsl3library, replacing its throwing unknown-signature placeholder withint (const LibreSsl3EvpPkey*). Null keys, methods and callbacks return zero; otherwise dispatch through the method'spkey_bitscallback with the original key and preserve its result.The contract follows LibreSSL 4.0.0 p_lib.c. The existing key model places the method at offset 8; the callback at offset 104 follows that revision's LP64
evp_local.h. Record the unverified console ABI and constructor interoperability in the library's technical debt. This adds one function to an existing library and no third-party dependency.Add a registered regression test covering null paths, the neighboring callback slot, original argument forwarding, exact callback count, signed return values, unchanged input objects and replacement/removal of the callback. The existing key-reference test also runs this coverage by default.
Tested
Windows x86-64, WinLibs GCC 15.2 DWARF, Release with bundled dependencies and BUILD_TESTING=ON. Tested local commit
a99b4c27f90c32076d79d573fc20a15b820b6576, based on upstreamba627802e2210187d417deb64c8f2fed8e33011f. Publishedaa4fc310feb23ba86c31d0ce1c5786c8543692a0has exactly the tested tree6777f6e55ad6f9a63d1107b890b7f84e0ed1f4af.libs,relinker, and all focused test targets with two compiler jobs.patched_libraries,strict_nid_filter,guest_libressl3_pkey_bits,guest_libressl3_key_reference,guest_libressl3_pkey_getters, andguest_crypto_memcmp.test_public_headers.py --audit-only: 399 libraries / 26,227 exports, unique declarations and umbrella coverage verified.check_conventions.py --base origin/mainandgit diff --check origin/main HEADpassed.pr_overlap.py --branch feat/pkey-bits-currentused a fresh 1,648-head REST snapshot, unchanged comparison logic, and exact-base/head caches verified against live upstreamba627802e2210187d417deb64c8f2fed8e33011f. It returned 2: shared-line overlap with #12315 (debt insertion), #12945 (retain-helper extraction/test dispatch), and #14366 (RSA getter debt insertion/inventory); comparisons remained unverified for #9970, #10452, #10461, #10490, #10491, #10493, #10557, #10631, #11146, #12754, and #14212 because those peers conflict with the base. Every reported peer's actual shared patch, plus the refreshed #10960 digest-helper patch, was manually compared at its exact head: none implements EVP_PKEY_bits. Preserve both sets of changes when resolving the helper/test/debt hunks. This does not claim that those peers merge cleanly; this function does not depend on their implementations.Console ABI and native key-constructor interoperability remain unverified and are recorded in the library's technical debt. Coverage uses caller-owned keys/methods. Validation here is Windows-only and focused; no entire-CTest-suite or title-compatibility claim.
Documentation follow-up (November 2, 2026): explicitly state that the console module's LibreSSL revision is unknown and that callback offset 104 assumes LibreSSL 4.0.0's LP64
EVP_PKEY_ASN1_METHODlayout. This follow-up changes only the debt entry; all code/build inputs are identical to the previously tested tree above. Re-ran the 399-library / 26,227-export public-header audit and the same six previously built runtime regressions: all passed. Current-main conventions and whitespace checks passed. This is not a new full-runtime build or console ABI verification.Published follow-up
2573684d24be67e6b0dde001c01a1d5a43fa24cbhas exactly the validated local treeec185ba24382c808aa99c0286a941c5d16303898(local source89a4e19f48a30d9315ebeb8908396ba0d223a239).Current-main refresh (November 5, 2026): rebased the unchanged feature onto upstream main
e772fb25cc72ee5faf77847f06bbc69533016e82. Published headc8541e6841e3326d7f7b420ad3282b11d5473a3fhas treec8333a93c071393d79311f4ae29cd336ec4831a7; the worktree was clean. An isolated native Windows Release configuration succeeded using WinLibs GCC 15.2 and the pinned FFmpeg package. Theguest_libressl3_key_reference_teststarget built successfully (352 Ninja steps, two below-normal compiler jobs). Focused CTestsguest_libressl3_pkey_bitsandguest_libressl3_key_referenceeach passed three consecutive runs, with no skips. Current-main conventions and whitespace checks passed. This refresh did not repeat the fulllibs/relinkerbuild, public-header audit, entire CTest suite, console ABI check, or game test; the earlier full-build evidence above applies to the older tree. The old hosted Windows job was cancelled at its 45-minute limit during guest-test compilation, before a test verdict. The refreshed head triggered a new Build run, initially queued. The localpr_overlap.pycould not run becauseghis unavailable here; a live GitHub PR search found no other open PR claimingEVP_PKEY_bits, but did not prove whole-repository line-overlap freedom.Current-main merge (November 6, 2026): merged upstream main through
c28413dda903edcfe7fe9d544abe1b7786cb0e31into the existing branch. Published head533a4fe645f1419a55a55d8c77cf2fb73c409207has tree5777d5ff7774734274822985c99518be61ab7998and a clean working tree. The feature diff against this main is six files. Conflict resolution keeps the upstreamRetain_nid_no_patchhelper andssl_ctxtest case, retains theEVP_PKEY_bitsimplementation and test, and retains the upstream parent-forwarding count of 391. The initial pending-export count was corrected in the November 6 follow-up below.On native Windows x64, Release CMake configuration and the
guest_libressl3_key_reference_teststarget build passed with GCC 15.2 and two below-normal compiler jobs. The registeredguest_libressl3_pkey_bitsandguest_libressl3_key_referencetests each passed three consecutive executions (2 tests, 0 failures/skips).git diff --check origin/main HEADpassed.check_conventions.py --base origin/main --head HEADcompleted with 0 errors and one debt-entry length warning on that intermediate tree. This merge did not rerun the fulllibs/relinker build, whole CTest suite, public-header audit, console ABI check, or game test. The November 5 refreshed head's Build run later succeeded; fresh hosted checks for this merge are separate.Latest-main merge and review correction (November 6, 2026): merged upstream main through
e509b292479c383dabd18bf5c323eff1afe9d2f3and published headb85b547dcf8bd1695c540de83fd66e3e7add2b58(tree3db5b072f0db35524f9a08b8badbfffe20aa8a80). The worktree is clean and the feature diff remains six files, with 83 additions and 7 deletions. This merge retains upstream native PKEY lifecycle changes and its 387 parent export forwarders without changing theEVP_PKEY_bitsimplementation. Dean's count review was verified against the source:Export.cpphas 46 throwing exports, whileAdditionalExports.cpphas 164 remaining callable exports (154 named and 10 NID-only). The debt document now records those counts on the corresponding lines.On native Windows x64, the Release
guest_libressl3_key_reference_teststarget rebuilt successfully with GCC 15.2 (217 Ninja steps; two below-normal compiler jobs). The registeredguest_libressl3_pkey_bitsandguest_libressl3_key_referencetests each passed three consecutive runs, with no failures or skips. On the final documentation-only follow-up,check_conventions.py --base origin/main --head HEADpassed with no findings, andgit diff --check origin/main HEADpassed. The focused executable did not need rebuilding after the documentation-only correction. This update did not repeat the fulllibs/relinker build, whole CTest suite, console ABI check, or game test; hosted checks for this head are new and pending. Maintainer edits were enabled for this PR on November 6 at the author's request.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T14:17:17Z.
Review: COMMENTED
Reviewed — no blocking findings
The
EVP_PKEY_bitsexport dispatches through the method'spkey_bitsslot and returns zero for null keys, methods and callbacks, as the PR says; the slot offset 104 is correct for the LibreSSL 4.0.0 layout the PR cites, but whether the console's library follows that layout is not known here, and the repository does not record it.What I ran
aa4fc310feb23ba86c31d0ce1c5786c8543692a0, baseba627802e2210187d417deb64c8f2fed8e33011f./usr/bin/python33.11.2, no build.python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14409 --output-dir /dev/shm/reviewer-run/precheck/14409python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base ba627802e2210187d417deb64c8f2fed8e33011f --head aa4fc310feb23ba86c31d0ce1c5786c8543692a0 --json(exit 0;passed; 0 findings; 270 symbols).core/libs/tests/GuestLibreSsl3KeyReference.cppfrom a head extract: one literal-path registration heuristic.evp_pkey_asn1_method_stinsrc/lib/libcrypto/evp/evp_local.hatce488b78e0bd994780569df718596b9776ff681a(fetched withgh api). Counting LP64 offsets:base_method0,pkey_id8,pkey_flags16,pem_str24,info32, the six pub/priv callbacks 40 to 80,pkey_size96,pkey_bits104. The value 104 matches.Results
Precheck report, checks table, unedited (
/dev/shm/reviewer-run/precheck/14409/report.md):The precheck deliberately does not configure, build, or compile AnyPS5.git diff --check ba627802e2210187d417deb64c8f2fed8e33011f...aa4fc310feb23ba86c31d0ce1c5786c8543692a0/usr/bin/python3 tools/check_conventions.py --base ba627802e2210187d417deb64c8f2fed8e33011f --head aa4fc310feb23ba86c31d0ce1c5786c8543692a0 --title feat(libressl3): implement EVP_PKEY_bits --body /dev/shm/reviewer-run/precheck/14409/pr-body.md/usr/bin/python3 tools/pr_abi_audit.py --base ba627802e2210187d417deb64c8f2fed8e33011f --head aa4fc310feb23ba86c31d0ce1c5786c8543692a0 --jsonNo changed Python implementation files.No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.No changed test_*.py files./usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14409 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14409/stackNot run: C++ tests need exact-head binaries, which require a build; the precheck does not build./usr/bin/python3 /dev/shm/reviewer-run/precheck/14409/head-aa4fc310feb2-1a9f74f7/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14409/head-aa4fc310feb2-1a9f74f7 --json core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp 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.mdNo changed Python test module in tools/ can be run as a no-build base-source control.Negative control
Not run here. The guest test is C++ and needs a build. The test writes a neighbouring method slot at 96 and checks that dispatch picks the slot at 104, which tests the code's constant, not the console's layout.
Findings
Blocking: none.
Non-blocking:
base_methodpointer replaces the 3.xpkey_base_idfield, which is why the slot moves. I believe a 3.x layout would putpkey_bitsat 96, but I did not fetch a 3.x header here, so that is an inference. The library's technical-debt entry says "no console ABI or behavior verification" and cites 4.0.0; it should also state the revision thelibSceLibreSsl3export is assumed to follow, and that the offset depends on it.Sources
github.com/libressl/openbsd@ce488b78e0/src/lib/libcrypto/evp/evp_local.h (L92-L113)github.com/boykopovar/AnyPS5@aa4fc310fe/core/libs/prx/libSceLibreSsl3/src/Key.cpp (L32-L39)Not verified
libSceLibreSsl3follows; the 3.x layout was not fetched.conventions,eligibility,intake,labelsandlibrary-portabilitysucceeded;linux,register-context,relinker,relinker-asanandwrite-watchwere skipped.Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:47:01Z.
Review: COMMENTED
Withdrawn. This review applied a title-ID/log requirement that is not in CONTRIBUTING (
Unblocks: noneis allowed), and it contained no code review.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-05T00:25:06Z.
Review: COMMENTED
Reviewed — no blocking findings
EVP_PKEY_bitsfollows LibreSSL 4.0.0 and its method-table offset (104) matches that revision's struct; the Windows job on this head was cancelled, and I did not build or run the new test.What I ran
Head
2573684d24be67e6b0dde001c01a1d5a43fa24cb, PR baseba627802e2210187d417deb64c8f2fed8e33011f. I read the whole diff (6 files) and the head'sKey.cpp, and compared them with LibreSSL 4.0.0 (p_lib.candevp_local.hatce488b78e0bd994780569df718596b9776ff681a). Environment: Debian 12, Linux x86_64. No AnyPS5 build was run.Results
Precheck report for this head, unedited table
git diff --check ba627802e2210187d417deb64c8f2fed8e33011f...2573684d24be67e6b0dde001c01a1d5a43fa24cb/marc/DeusMachina_0x1914/.venv/bin/python3 tools/check_conventions.py --base ba627802e2210187d417deb64c8f2fed8e33011f --head 2573684d24be67e6b0dde001c01a1d5a43fa24cb --title feat(libressl3): implement EVP_PKEY_bits --body /tmp/anyps5-pr-precheck/final/14409/pr-body.md/marc/DeusMachina_0x1914/.venv/bin/python3 /marc/AnyPS5/tools/pr_abi_audit.py --base ba627802e2210187d417deb64c8f2fed8e33011f --head 2573684d24be67e6b0dde001c01a1d5a43fa24cb --json/marc/DeusMachina_0x1914/.venv/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14409 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/final/14409/stack/marc/DeusMachina_0x1914/.venv/bin/python3 /marc/AnyPS5/tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/final/14409/head-2573684d24be-798d46cd --json core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp 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.mdNegative control
Not run. The new
CheckBitstest covers a null key, a key without a method, a neighbouring slot (offset 96) holding a failing callback, a removed callback and eight callback results; I read it but did not run it.Findings
Blocking
None.
Non-blocking
None.
Sources
github.com/boykopovar/AnyPS5@2573684d24/core/libs/prx/libSceLibreSsl3/src/Key.cpp (L11)EVP_PKEY_bits_nid_postfix:github.com/boykopovar/AnyPS5@2573684d24/core/libs/prx/libSceLibreSsl3/src/Key.cpp (L32-L38)EVP_PKEY_bits:github.com/libressl/openbsd@ce488b78e0/src/lib/libcrypto/evp/p_lib.c (L262-L267)pkey_sizethenpkey_bits):github.com/libressl/openbsd@ce488b78e0/src/lib/libcrypto/evp/evp_local.h (L92-L112)Not verified
guest_libressl3_pkey_bitstest on any platform. The AMD GPU CI comment is another contributor's report, not my run.To get this to a good state
2573684d24be67e6b0dde001c01a1d5a43fa24cb; a maintainer has to rerun it.