feat(libSceLibreSsl3): implement EC_GROUP_cmp #16918
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16918"
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 GalaxyGamingFR on 2026-11-07T22:31:14Z.
What
Implement
EC_GROUP_cmpinlibSceLibreSsl3, replacing its parameterless throwing placeholder inAdditionalExports.cpp.ce488b78ec_lib.c, the revision the library's debt file already uses. Upstream returns 1 when both groups have curve names and they differ. Otherwise it compares the field type,a,b,p, the generator, the order and the cofactor, and returns 0 only when all of them match.EC_GROUPin this code base comes from libSceLibreSslEC_GROUP_new_by_curve_name(forwarded byParentExports.cpp), which builds only the eleven named curves inEc.cpp. Each NID there has its own parameters, so for these groups "same NID" and "same parameters" are equivalent, and the export returnsa nid != b nid ? 1 : 0.Ec.hpp, because mbedcrypto is a private dependency of libSceLibreSsl and its headers are not visible here. The export reads the NID as the leadingintof the group:EcGroupbegins withNamedCurve curve, which begins withint nid. New static asserts inEc.hpppin this:EcGroupis standard-layout,curveis at offset 0 andnidis at offset 0. If the layout ever changes, the parent fails to compile instead of the child reading garbage.Api.hppnow declares it asint EC_GROUP_cmp(const EcGroup* a, const EcGroup* b, void* ctx). TheBN_CTXis not used, as upstream only uses it as scratch space.std::invalid_argument, where upstream would dereference it.The gap is recorded in
docs/dev/debt/libSceLibreSsl3.md:-1is never returned, and the shortcut only holds while groups are named curves. The export inventory is updated (138 exports, 128 named).No title's trace or disassembly was used, and the export was not measured on a PS5.
Tested
Windows 11, WinLibs GCC 15.2.0 UCRT r7. This is not a full CMake build. I compiled the new
tests/EcGroup.cppwithsrc/EcGroup.cpp, libSceLibreSsl'sEc.cppandError.cpp, and the3rdparty/mbedtlslibrary sources into one executable, withAPS5_VABIdefined empty and a one-lineNotImplementedAt_nid_no_patchthat throws. No title or homebrew, and not built on Linux or macOS.ctxis left untouched and that each null-argument combination throws. The set includes secp256r1, secp256k1 and brainpoolP256r1, which shareEC_GROUP_get_degree256, so a degree-based comparison would fail.-Wall -Wextrais clean for the new files, andpython tools/check_conventions.py --base origin/mainpasses.I searched open and merged pull requests for
EC_GROUP_cmpjust before opening this one, and none implements it. #16586, #16588, #16589 and #16848 change the same export inventory count, so whichever lands later needs a one-line rebase.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)🤖 Generated with Claude Code