feat(libSceLibreSsl3): derive ECDH secrets through EVP_PKEY_CTX #19487
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19487"
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 MarrasFederico on 2026-11-13T12:13:38Z.
What
ECDH key agreement through
EVP_PKEY_CTXinlibSceLibreSsl3:EVP_PKEY_derive_init,EVP_PKEY_derive_set_peerandEVP_PKEY_deriveforEVP_PKEY_ECkeys, plusEVP_PKEY_copy_parametersfor EC keys. It builds on theEVP_PKEY_CTXfrom #17528 and reuses the parent library's ECDH (ECDH_compute_key,EC_KEY_*inlibSceLibreSsl/src/Ec.cpp) instead of a second implementation.pmeth_fn.corder:derive_set_peer, a missing own key, a different key type or a peer on another curve each return -1, withEVP_R_NO_KEY_SET,EVP_R_DIFFERENT_KEY_TYPESorEVP_R_DIFFERENT_PARAMETERSrespectively;pkey_ec_derive:key == NULLreports(degree + 7) / 8;EC_R_KEYS_NOT_SET;ECDH_compute_keyrejects short buffers and zeroes the tail of long ones, so the wrapper computes into a scratch buffer and copiesmin(*keylen, secret length).EVP_PKEY_copy_parameters: followsp_lib.candec_copy_parameters. Different types giveEVP_R_DIFFERENT_KEY_TYPES, a source without a group givesEVP_R_MISSING_PARAMETERS, and otherwise the group is set withEC_KEY_set_group. Non-EC types still throw.EVP_PKEY_free: now releases EC payloads throughEC_KEY_free.X9_63) and cofactor ECDH controls. The debt entry states both.Source: LibreSSL 4.0.0
evp/pmeth_fn.c,evp/p_lib.c,ec/ec_pmeth.c,ec/ec_ameth.c, at the same revision as the neighbouring entries. The ported files carry the upstream notices and a Derived from line.Overlap: I checked the diffs of every open PR touching
libSceLibreSsl3or its debt file, and none implements these functions. The EC point and ECDSA PRs (#16918, #17621, #17622, #17626, #19033, #19044, #19134) touch different exports.Tested
Ubuntu 26.04.1, GCC 15.2.0, Release,
BUILD_TESTING=ON.guest_libressl3_pkey_contextgains ECDH cases:derive_set_peer, a derive beforederive_init, and an own key without a private part, each checked against the error queue;copy_parameterswith null arguments, a source without a group, a different key type, and a successful copy.Results:
ctest -R libressl3: 69 of 69 pass at3ede9bc1ae(after mergingupstream/maind5663ee9a3).EVP_PKEY_derive_init not implemented.tools/check_conventions.py --base upstream/main:All conventions checks passed(0 errors, 0 warnings);python3 core/libs/tests/test_public_headers.py --audit-only: 413 libraries, 34548 exports verified;git diff --check upstream/main...HEAD: clean.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)