Repository navigation
Conversation
EC_GROUP_new_by_curve_name, EC_GROUP_free, EC_GROUP_get_degree, EC_KEY_new, EC_KEY_new_by_curve_name, EC_KEY_free, EC_KEY_set_group, EC_KEY_get0_group and ECDSA_size follow LibreSSL 2.5.4 on top of mbedtls's named curves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ECDH EC_POINT_new, EC_POINT_free, EC_POINT_point2oct, EC_POINT_oct2point, EC_KEY_generate_key, EC_KEY_check_key, EC_KEY_get0_public_key, EC_KEY_set_public_key, ECDSA_sign, ECDSA_verify and ECDH_compute_key follow LibreSSL 2.5.4 on top of mbedtls's named curves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thank you for your contribution! Authors with no pull requests merged into |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed exact head dcb4a21a2ec7b9e154760f6102e5f0c099bb3adc against refreshed upstream main c8d34aa8f4d8058d57169cc1e423ba6db00faaf0.
The two-commit stack is explicitly based on #10395, and the description gives unusually detailed coverage for point encodings, key generation, ECDSA DER/range behavior and ECDH buffer/KDF cases. Current-main conventions and diff-check pass. However, #10395 is still open, and the current-main merge-tree for this stack has content conflicts in core/libs/prx/libSceLibreSsl/CMakeLists.txt and docs/dev/debt/libSceLibreSsl.md. The exact reported Linux test suite therefore does not yet verify the final stack on current main; hosted product tests are skipped.
Please refresh the #10395 dependency and this follow-up to current main, resolve those conflicts while retaining both test registrations and debt entries, and rerun the eight focused LibreSSL tests against the composed head. I have not locally reproduced the crypto test suite or reviewed the final merged dependency composition, so this is an integration request rather than a claim that the cryptographic operations are incorrect.
|
Thanks, done. #10395 is refreshed to current On |
|
Refreshed again after #9529 and #10706 landed: #10395 is now On |
|
Applied the test rule from the #10395 review here too: |
… into fix/anyps5-lssl-ec-privkey
…var#10407) into fix/anyps5-lssl-ec-privkey
…var#10407) into fix/anyps5-lssl-ec-privkey # Conflicts: # core/libs/prx/libSceLibreSsl/CMakeLists.txt # core/libs/prx/libSceLibreSsl/Export.cpp # core/libs/prx/libSceLibreSsl/include/Api.hpp # core/libs/prx/libSceLibreSsl/include/Ec.hpp # core/libs/prx/libSceLibreSsl/src/Ec.cpp # core/libs/tests/GuestLibreSslEcKeys.cpp # docs/dev/debt/libSceLibreSsl.md
What
Implements eleven libSceLibreSsl exports that were throwing
NotImplemented:EC_POINT_new,EC_POINT_free,EC_POINT_point2oct,EC_POINT_oct2point,EC_KEY_generate_key,EC_KEY_check_key,EC_KEY_get0_public_key,EC_KEY_set_public_key,ECDSA_sign,ECDSA_verifyandECDH_compute_key. Builds on #10395, whose commit is the first one here; this diff is the second commit.ec/ec_lib.c,ec/ec_key.c,ec/ec_oct.c,ec/ecp_oct.c,ecdsa/ecs_sign.c,ecdsa/ecs_vrf.c,ecdsa/ecs_ossl.candecdh/ech_key.c.EC_POINTis a host object holding anmbedtls_ecp_pointand its curve; anEC_KEYnow also holds its public point and private scalar. The three exports that take or return aBIGNUM(EC_POINT_mul,EC_KEY_get0_private_key,EC_KEY_set_private_key) still throw:BIGNUMis feat(libSceLibreSsl): implement the BN_ BIGNUM, BN_CTX, conversion, word, BN_mul and BN_mod_inverse functions #9446.EC_POINT_point2octandEC_POINT_oct2pointhandle the compressed, uncompressed and hybrid forms and the single zero octet for infinity, with LibreSSL's checks: form and y bit, exact length, coordinates below the prime, hybrid parity and the X9.62 on-curve test. A point that fails only the on-curve test keeps the decoded coordinates, as in LibreSSL, soEC_KEY_check_keycan reject it later.EC_KEY_generate_keydraws the scalar in [1, n-1] from host entropy and reuses the key's existing point object, as LibreSSL does.EC_KEY_check_keychecks infinity, the curve equation and, with a private key, that it gives the public key; the order test always passes because all 11 curves have cofactor 1.ECDSA_signsigns through mbedtls with a random nonce and writes LibreSSL's DER (unsigned INTEGERs, 0x00 pad when the top bit is set); a null buffer only returns the length.ECDSA_verifyreturns -1 unless the signature is canonical DER with nothing after it (what LibreSSL's decode and re-encode comparison accepts), 0 for r or s outside [1, n-1] or a mismatch, and -1 when u1·G + u2·Q is at infinity. Digests longer than the order are truncated to its bit length, likeecdsa_do_signandecdsa_do_verify.ECDH_compute_keyreturns the x coordinate padded to the field size: -1 without a private key, group or peer key, for a peer at infinity, for a length aboveINT_MAXor a buffer shorter than the secret without a KDF; a larger buffer is zero-filled. A KDF is called through the guest ABI and its output length is returned.Gaps, in the debt file: no error is queued; a point used with a group of another curve throws, since LibreSSL's result depends on the EC methods its build picks; so does
EC_KEY_set_groupto another curve on a key that already has a public or private key; compressed points on secp224k1 and secp224r1 throw (mbedtls only decompresses for primes that are 3 mod 4);ECDSA_verifywith a public key at infinity or off the curve andECDH_compute_keywith a peer key off the curve throw, where LibreSSL computes with them. The EC debt entry is split in two to stay under 1000 characters. The pending-exports count goes from 356 to 345.Tested
Linux (Ubuntu 24.04 container, GCC 13.3), full configure with
-DBUILD_TESTING=ON, Release: builtlibSceLibreSsl,libSceLibreSsl3, their patched.prxfiles and the eight LibreSSL tests;ctest -R 'libressl|crypto_memcmp'passes 8 of 8 (the newguest_libressl_ec_keystakes 0.6 s). It checks:EC_KEY_check_key, encoded sizes, sign and verify (another key, a changed signature, another digest, an empty digest), ECDH agreement on both sides and regeneration keeping the point object;cryptography46, and a secp224k1 signature from a Python reference implementation whose 225-bit order makes the truncation drop seven bits; ten non-DER signatures return -1 and five out-of-range ones return 0;EC_KEY_set_public_keycopies, own key, null, infinity, off-curve and other-curve points, andEC_KEY_set_groupwith and without keys.The test fails when the truncation shift, the hybrid y bit, the DER minimal-integer check or the ECDH zero fill is removed.
nm -Don the patchedlibSceLibreSsl.prxlists the eleven NIDs.tools/check_conventions.py --base origin/mainpasses;tools/pr_overlap.py --branch feat/libressl-ec-points-ecdsa-ecdhfinds no open PR with the same exports or new files. Its line overlaps with #9033, #9448, #9529, #10071, #10078, #10373, #10376 and #10398 are theadd_library/test block inCMakeLists.txtand the pending count in the debt file; #9446, #9571, #9745, #9870, #9949, #10005 and #10248 conflict withmainand could not be compared, and their diffs touch none of these exports. No title tested.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