Skip to content

LibCrypto+LibWeb: Support EC compressed point and raw format aliases#8895

Open
tete17 wants to merge 3 commits intoLadybirdBrowser:masterfrom
tete17:Crypot-Pickup
Open

LibCrypto+LibWeb: Support EC compressed point and raw format aliases#8895
tete17 wants to merge 3 commits intoLadybirdBrowser:masterfrom
tete17:Crypot-Pickup

Conversation

@tete17
Copy link
Copy Markdown
Contributor

@tete17 tete17 commented Apr 13, 2026

This PR does 3 things:

  • For all symmetric algorithms (AES-CBC, AES-CTR, AES-GCM, AES-KW, HMAC, HKDF, PBKDF2), raw-secret is treated as an alias for raw. For all asymmetric algorithms (ECDSA, ECDH, Ed25519, X25519), raw-public is treated as an alias for raw
  • Add support for SEC 1 compressed EC public key format (0x02/0x03 prefix) via a new SECPxxxr1Point::from_compressed() that uses OpenSSL's EC_POINT_oct2point for decompression
  • Refactor read_ec_public_key() to delegate to SECPxxxr1Point::from_uncompressed and from_compressed, removing duplicated parsing logic and adding length validation to reject truncated keys

This fixes 48 WPT tests for compressed EC point import (ECDSA/ECDH across P-256, P-384, P-521) and passes all 20 tests from the raw_format_aliases WPT, for a total of 68 new passing WPT tests.

tete17 added 3 commits April 13, 2026 20:39
Add SECPxxxr1Point::from_compressed() to decompress SEC 1 compressed
EC public keys using OpenSSL's EC_POINT_oct2point. Refactor
read_ec_public_key() to delegate to SECPxxxr1Point::from_uncompressed
and from_compressed, removing duplicated parsing logic. Also add a
length validation to from_uncompressed to reject truncated keys.

This fixes 48 WPT tests that were previously marked as
"Optional Feature Unsupported" for compressed EC point import
across ECDSA and ECDH for P-256, P-384, and P-521.
@tete17 tete17 requested a review from alimpfard as a code owner April 13, 2026 22:01
@tete17 tete17 changed the title LibWeb: Treat raw-public and raw-secret key formats as aliases for raw LibCrypto+LibWeb: Support EC compressed point and raw format aliases Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant