Commit graph

147 commits

Author SHA1 Message Date
mikiubo
29ae949798 LibWeb: Use outputLength instead of length in KmacParams
The WebCrypto spec was updated to rename the KMAC algorithm
parameter from length to outputLength.
2026-03-25 22:07:53 +01:00
mikiubo
63d8f6b4a9 LibWeb: Use outputLength instead of length in CShakeParams
The WebCrypto spec was updated to rename the CSHAKE algorithm
parameter from length to outputLength.
2026-03-22 14:13:21 +01:00
mikiubo
d4cf537d58 LibCrypto: Implement KMAC authentication support
Add a LibCrypto::Authentication::KMAC helper over OpenSSL.
Add keygen/import/export logic into WebCrypto.
Register KMAC128/KMAC256 operations with SubtleCrypto.
2026-03-19 10:46:49 +01:00
mikiubo
50ec070017 LibCrypto: Add AES-OCB support
Implement AES-OCB AEAD using OpenSSL and expose it through
the WebCrypto API, including key management and AEAD parameters.

Add WPT:
/encrypt_decrypt/aes_ocb.tentative.https.any.html
2026-02-27 12:03:19 +01:00
devgianlu
492b97f769 LibWeb/Crypto: Update spec links
Add and update spec links to more precise ones
and move X25519 and Ed25519 from WICG to W3C.
2026-02-14 17:43:34 +01:00
Psychpsyo
dab742ed84 Everywhere: Remove double // on comments 2026-02-11 13:28:01 -06:00
mikiubo
4a1a15ce66 LibWeb: Allow importing ChaCha20-Poly1305 JWK without alg
The WebCrypto specification does not require the "alg" member
to be present when importing a symmetric JWK, as long as the
key material itself is valid.

Add tests covering JWK import without an "alg" field.

This fixes the following WPT:
WebCryptoAPI/import_export/ChaCha20-Poly1305_importKey
2026-02-05 09:05:11 +01:00
mikiubo
ff2acd1d33 LibWeb: Use unchecked_append for pre-sized JWK key_ops vectors
The key_ops vector is pre-sized with ensure_capacity(), so
bounds-checked append() is unnecessary here.

Switch to unchecked_append() to avoid redundant checks.

This change was suggested in a previous pull request #7563.

Add some typo and wrong comment.
2026-02-04 19:19:09 +01:00
mikiubo
ba75d4c014 LibCrypto: Add ChaCha20-Poly1305 support
Implement ChaCha20-Poly1305 AEAD using OpenSSL and expose it through
the WebCrypto API, including key management and AEAD parameters.

Add WPT:
/encrypt_decrypt/chacha20_poly1305.tentative.https.any.worker.html
2026-01-26 10:03:09 +01:00
Colleirose
bf7fd80140 LibCrypto+AK: Merge LibCrypto/SecureRandom into AK/Random
AK/Random is already the same as SecureRandom. See PR for more details.

ProcessPrng is used on Windows for compatibility w/ sandboxing measures
See e.g. https://crbug.com/40277768
2026-01-23 15:53:27 +01:00
mikiubo
cd8465a6b5 LibCrypto: Add SHAKE digest support
Introduce a new SHAKE hash wrapper in LibCrypto backed by OpenSSL.

Wire cSHAKE128 and cSHAKE256 into WebCrypto.

Note that cSHAKE with non-empty functionName or customization is
currently rejected due to OpenSSL EVP limitations.

This fixes WPT:
WebCryptoAPI/digest/cshake.tentative.https.any.html
2026-01-22 19:47:09 -05:00
Jelle Raaijmakers
ae20ecf857 AK+Everywhere: Add Vector::contains(predicate) and use it
No functional changes.
2026-01-08 15:27:30 +00:00
Tete17
7ac6aecef0 LibWeb: Implement decapsulation for ML-KEM algorithms 2026-01-06 01:06:06 +01:00
Tete17
08b48d5369 LibWeb: Align input argument name to the spec 2026-01-06 01:06:06 +01:00
Tete17
a739311fdc LibWeb: Support the exporting of ml-kem keys in pkcs8 format 2026-01-06 01:06:06 +01:00
Tete17
9c5cb08b63 LibWeb: Support the importing of ml-kem keys in pkcs8 format 2026-01-06 01:06:06 +01:00
Tete17
df0796bdf2 LibWeb: Support the exporting of ml-kem keys in raw-seed format 2026-01-06 01:06:06 +01:00
Tete17
ed025f5fcd LibWeb: Support the importing of ml-kem keys in raw-seed format 2026-01-06 01:06:06 +01:00
Tete17
ab74519a0b LibWeb: Support the exporting of ml-kem keys in raw-public format 2026-01-06 01:06:06 +01:00
Tete17
0fc7746b96 LibWeb: Support the importing of ml-kem keys in raw-public format 2026-01-06 01:06:06 +01:00
Tete17
56804e7930 LibWeb: Support the exporting of ml-kem keys in spki format 2026-01-06 01:06:06 +01:00
Tete17
4e41cfb6c4 LibWeb: Correctly set the usage on the private key for ML-KEM
This is one lines gives us almost 1000 WPTs :)
2026-01-06 01:06:06 +01:00
Tete17
94410298f3 LibWeb: Implement Derive Bits for Argon2 algorithm 2026-01-04 15:56:54 +01:00
Tete17
7b3a97a928 LibWeb: Implement Argon2Params
This is the needed context for the Derive Bits operation of the Argon2
algorithm.
2026-01-04 15:56:54 +01:00
Tete17
2cc71e6437 LibWeb: Support the importing for Argon2 keys 2026-01-04 15:56:54 +01:00
Tete17
ebd0874fb5 LibWeb: Implement Get Key Length for Argon2 algorithm 2026-01-04 15:56:54 +01:00
Tete17
bbf70e320f LibWeb: Allow symmetric algorithms to be imported with RawSecret
This new format is equivalent to the old Raw.
2025-12-30 14:16:35 +01:00
Tete17
a414819dd6 LibWeb: Support the importing of ml-kem keys in spki format 2025-12-30 14:16:35 +01:00
Tete17
6350b063ab LibWeb: Implement encapsulation for ML-KEM algorithms 2025-12-30 14:16:35 +01:00
Tete17
013cf34d1b LibWeb: Implement key generation for ML-KEM algorithms 2025-12-30 14:16:35 +01:00
Tete17
26a9551db2 LibWeb: Correctly transform EncapsulatedKey into an ECMAScript object
The spec prefers camel case, but we internally use snake case.
2025-12-30 14:16:35 +01:00
Tete17
ec67f0ae8d LibWeb: Change return type of encapsulate for AlgorithmMethods
The standard ask to turn EncapsulatedBits into an ECMAScript Object
which means it must initially live in the host stack.
2025-12-30 14:16:35 +01:00
Tete17
b65b8c2e6a LibWeb: Use ReadOnlyBytes when encoding ml-dsa public keys
This fixes a build error caused by a merge conflict with some recent
changes in out base64 infrastructure.
2025-12-10 22:46:54 +01:00
Tete17
006428db7a LibWeb: Support the exporting of ml-dsa keys in pkcs8 format 2025-12-10 21:26:06 +01:00
Tete17
b63a0903aa LibWeb: Support the importing of ml-dsa keys in pkcs8 format 2025-12-10 21:26:06 +01:00
Tete17
2078317a51 LibWeb: Support the exporting of ml-dsa keys in jwk format 2025-12-10 21:26:06 +01:00
Tete17
a5e037e2af LibWeb: Support the importing of ml-dsa keys in jwk format 2025-12-10 21:26:06 +01:00
Tete17
affaa8169f LibWeb: Support the exporting of ml-dsa keys in raw-seed format 2025-12-10 21:26:06 +01:00
Tete17
9bea146212 LibWeb: Support the importing of ml-dsa keys in raw-seed format 2025-12-10 21:26:06 +01:00
Tete17
16b0918579 LibWeb: Support the exporting of ml-dsa keys in raw-public format 2025-12-10 21:26:06 +01:00
Tete17
f56f7a0916 LibWeb: Support the importing of ml-dsa keys in raw-public format 2025-12-10 21:26:06 +01:00
Tete17
f13c0fb317 LibWeb: Support the exporting of ml-dsa keys in spki format 2025-12-10 21:26:06 +01:00
Tete17
7a9ed4ba71 LibWeb: Support the importing of ml-dsa keys in spki format 2025-12-10 21:26:06 +01:00
Tete17
e596572085 LibWeb: Implement verify for ML-DSA algorithm 2025-12-10 21:26:06 +01:00
Tete17
ef0205ec86 LibWeb: Implement message signing for ML-DSA algorithm 2025-12-10 21:26:06 +01:00
Tete17
a9ade1c238 LibWeb: Implement key generation for ML-DSA algorithms 2025-12-10 21:26:06 +01:00
Aliaksandr Kalenik
55e6e6f117 Everywhere: Make ByteBuffer::bytes() lvalue-only
This helps prevent us from accidentally using pointers to the underlying
memory of temporary `ByteBuffer` values.
2025-12-10 07:43:22 -05:00
Tete17
42f55c7c97 LibWeb: Implement Encapsulate(Key|Bits) dictionaries
These are needed structure for the encapsulate(Key|Bits) operations.
2025-11-27 21:50:06 +01:00
Tete17
5e736d4e07 LibWeb: Expose SHA3 hashing algorithm through WebCryptoAPI
This give us 48 WPT subtests :)
2025-11-26 22:01:00 -05:00
Shivendra Kumar
b3e8784f92 LibCrypto: Fix typo in comment 2025-09-14 10:45:41 +01:00