Commit Graph

81 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
be9936263f LibWeb: Re-import KMAC WPT tests 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
b7eef098ed LibWeb: ReImport cshake WPT 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
6cc575b8a9 LibWeb: Import KMAC WPT tests 2026-03-19 10:46:49 +01:00
mikiubo
1ac12651f6 LibWeb: Update SubtleCrypto.digest() to match the spec
The WebCrypto spec was updated to normalize the algorithm before
getting a copy of the data bytes, and to queue a global task on the
crypto task source when rejecting or resolving the promise.

This fixes some WPT tests.
2026-03-17 21:05:13 +01:00
mikiubo
89f8920c3a LibWeb: Import digest https WPT tests 2026-03-17 21:05:13 +01:00
mikiubo
2a6cfb4f48 LibWeb: Re-Import sha3 and cshake WPT tests 2026-03-17 21:05:13 +01:00
mikiubo
0e2d8ff43a LibWeb: Update SubtleCrypto.sign() and verify() to match the spec
The WebCrypto spec was updated to normalize the algorithm before
getting a copy of the input bytes, and to queue a global task on the
crypto task source when rejecting or resolving the promise.
2026-03-15 20:03:58 +01:00
mikiubo
a0dd96bb0a LibWeb: Re-Import sign_verify WPT tests 2026-03-15 20:03:58 +01:00
mikiubo
17fe3ae00c LibWeb: Update SubtleCrypto.encrypt() and decrypt() to match the spec
The WebCrypto spec was updated to normalize the algorithm before
getting a copy of the data bytes, and to queue a global task on the
crypto task source when rejecting or resolving the promise.
2026-03-06 14:21:46 +01:00
mikiubo
8baad1dc4c LibWeb: Re-Import encrypt_decrypt WPT tests 2026-03-06 14:21:46 +01:00
mikiubo
d6049586be LibWeb: Import AES-OCB encrypt_decrypt WPT tests 2026-02-27 12:03:19 +01:00
Shannon Booth
9e7aa878bc LibWeb: Properly determine if running in SecureContext for Workers
Fixes the included imported test. Note that this required a minor
edit of the WPT import to work with our test harness setup to
try and create a non secure context setup as both file:// and
localhost are considered secure contexts.
2026-02-26 07:22:50 +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
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
Tete17
7ac6aecef0 LibWeb: Implement decapsulation for ML-KEM algorithms 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
5b215c01f8 LibWeb: Import WPT regarding ML-KEM import and key generation 2026-01-06 01:06:06 +01:00
Tete17
0fe7f3e74a LibWeb: Add Argon2 WPT tests
A modest 4 new passes :)
2026-01-04 15:56:54 +01:00
Tete17
460244c5a8 LibWeb: Add encap & decap WPT tests
For now only the most basic test pass but it is a beginning.
2025-12-30 14:16:35 +01:00
Tete17
4868a118a5 LibWeb: Add ML-DSA test
This represents 1600+ subtests, including the worker tests.
2025-12-10 21:26:06 +01:00
Tete17
aa44d254a4 Tests: Re-import WebCryptoAPI tests
Some test have changed name and some utilities have now expanded to
accommodate new algorithms.
2025-12-10 21:26: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
devgianlu
b4deae6abf LibWeb/Crypto: Add JWK alg attribute to Ed{448,25519} keys
Spec PR: https://github.com/WICG/webcrypto-secure-curves/pull/34
2025-08-03 04:52:35 -07:00
devgianlu
3a8984b255 LibWeb/Crypto: Add raw key length checks to {Ed,X}{448,25519} key import
Following the spec update we finally can add these checks.

Spec PR: https://github.com/WICG/webcrypto-secure-curves/pull/35
2025-08-03 04:52:35 -07:00
Chase Knowlden
6b4e00bc39 LibCrypto: Implement Ed25519 Small Order Points 2025-08-01 14:31:44 +02:00
Abhinav
93a0ef949a LibWeb: Update x25519 raw key import tests 2025-07-26 10:43:16 -06:00
Tim Ledbetter
689dff3ee8 Tests: Synchronize imported tests with the WPT repository 2025-06-22 23:51:34 +02:00
devgianlu
cf5ce8277f LibCrypto: Use OpenSSL for SECPxxxr1 sign/verify operations 2025-01-27 12:24:48 +01:00
devgianlu
fd2014f5c2 LibCrypto: Use OpenSSL for SECPxxxr1 point computation 2025-01-27 12:24:48 +01:00
devgianlu
aefffa9455 LibCrypto: Use OpenSSL for SECPxxxr1 key generation 2025-01-27 12:24:48 +01:00
devgianlu
991cb8942d LibWeb: Always return a KeyAlgorithm from RsaHashedKeyAlgorithm
The spec never mentions the possibility for the `hash` member of
`RsaHashedKeyAlgorithm` to be a string, it should be a `KeyAlgorithm`
object containing a `name` string member.

Spec: https://w3c.github.io/webcrypto/#dfn-RsaHashedKeyAlgorithm
2025-01-17 12:43:03 +01:00
devgianlu
999f456ba4 LibWeb: Support RSASSA-PKCS1-v1_5 in WebCryptoAPI 2025-01-17 12:43:03 +01:00
devgianlu
e05ee9d297 LibWeb: Support RSA-PSS in WebCryptoAPI 2025-01-17 12:43:03 +01:00
devgianlu
4b832b67fb LibWeb: Add RSA-OAEP WPT tests
This serve as a regression check for the next commits
2025-01-13 17:00:18 +01:00
devgianlu
b9ba1b3f72 LibWeb: Add Ed448 support in WebCryptoAPI
Add full support for Ed448 and import relevant tests.
2025-01-11 11:13:06 +01:00
devgianlu
819178a49e LibWeb: Use correct default key size for HMAC
When the default key size was requested it was expressed in bytes
(instead of bits) and from the digest size instead of the block size.
2025-01-02 11:33:43 +01:00
devgianlu
f5d3d6a7d4 LibWeb: Set algorithm length for HMAC key generation
This assignment was missing from the spec, but has been fixed since
https://github.com/w3c/webcrypto/pull/394.

Also add relevant WPT tests.
2025-01-02 11:33:43 +01:00
devgianlu
637f934f69 LibWeb: Correctly normalize HashAlgorithmIdentifier
Make sure that `HashAlgorithmIdentifier` is passed through
`normalize_an_algorithm` to verify that the hash is valid and supported.

This is required by the spec, but we are not following it very strictly
in `normalize_an_algorithm` because it is pretty convoluted.

Fixes ~60 tests.
2024-12-18 12:45:06 -08:00
devgianlu
f3a9bb0a91 LibWeb: Correct WebCryptoAPI derive length behaviour
Fixes multiple slightly wrong behaviours of the `deriveBits` method
across various algorithms. Some of them might be due to a spec update.

Add tests related to fixes.
2024-12-18 13:18:40 +01:00
devgianlu
94374f0d19 LibWeb: Implement AES-KW in WebCryptoAPI
Add support for AES-KW for key wrapping/unwrapping. Very similar
implementation to other AES modes.

Added generic tests for symmetric import and specific AES-KW ones.

Adds ~400 test passes on WPT. Now we do better than Firefox in
`WebCryptoAPI/wrapKey_unwrapKey`!
2024-12-17 11:00:14 +01:00