Commit Graph

189 Commits

Author SHA1 Message Date
Shannon Booth
6a9cd0e8e0 LibWeb: Use interface_name instead of serialize_type virtual
`interface_name` is implemented for every platform object,
so we no longer need this boilerplate for every serializable
platform object.
2026-02-14 20:22:40 +01:00
Shannon Booth
76cf230bd6 LibWeb: Use Bindings::InterfaceName for serializing types
While this does cost us an extra byte to serialize as it
contains _all_ interface names instead of the set of serializable
types, doing this will allow us to remove to use the same
enum for checking whether that interface is exposed in a future
commit.
2026-02-14 20:22:40 +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
Andreas Kling
d89f3fc5e6 LibGC+ClangPlugins: Forbid non-trivial destructors in Cell subclasses
Add a clang plugin check that flags GC::Cell subclasses (and their
base classes within the Cell hierarchy) that have destructors with
non-trivial bodies. Such logic should use Cell::finalize() instead.

Add GC_ALLOW_CELL_DESTRUCTOR annotation macro for opting out in
exceptional cases (currently only JS::Object).

This prevents us from accidentally adding code in destructors that
runs after something we're pointing to may have been destroyed.
(This could become a problem when the garbage collector sweeps
objects in an unfortunate order.)

This new check uncovered a handful of bugs which are then also fixed
in this commit. :^)
2026-01-30 20:57:42 +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
140bbe50ab LibWeb: Extend decapsulate(Key|Bits) methods to pass the key
This is mandated by the spec but since no algorithm supported this
method, yet we didn't notice it was missing.
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
86e9765fe7 LibWeb: Pass the correct algorithms parameters when importing shared key
During decapsulate we were passing the parameters for decapsulate
instead of the ones for the shared key.
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
1e6b5a6f81 LibWeb: Set the extractable and usages fields of the generated key
This was a spec bug updated in
https://github.com/WICG/webcrypto-modern-algos/pull/39
2025-12-30 14:16:35 +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
336929c5a3 LibWeb: Add TemporaryExecutionContext to encapsulate/decapsulate methods
Some operations like retrieving the algorithm name require it.
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
63c99f3703 LibWeb: Correctly check the usage of the encapsulation key 2025-12-30 14:16:35 +01:00
Shannon Booth
2a8b83a568 LibWeb/WebIDL: Upgrade QuotaExceededError to its own interface
See https://github.com/whatwg/webidl/commit/48eba6d
2025-12-29 17:15:11 +01:00
Tete17
fdb01e7f93 LibWeb: Add the Crypto task source
This is used by the spec to queue tasks to resolve or reject promises
created in response to calls to methods of SubtleCrypto.
2025-12-28 18:56:50 +01:00
Tete17
305e9c1b0f LibWeb: Implement decapsulateBits for SubtleCrypto 2025-12-28 18:56:50 +01:00
Tete17
c9b8b4557d LibWeb: Implement decapsulateKey for SubtleCrypto 2025-12-28 18:56:50 +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