From 46e724729c19b071a9e406cb26008d53bd815664 Mon Sep 17 00:00:00 2001 From: devgianlu Date: Wed, 27 Nov 2024 21:17:07 +0100 Subject: [PATCH] LibWeb: Match algorithm names case-insensitive I dug through the code and the WebCryptoAPI spec to figure out the reason for `... mixed case parameters` WPT tests and figured out that our implementation was slightly wrong. By being closer to the spec we can now pass those tests and also remove a bunch of duplicated code. Context: https://github.com/LadybirdBrowser/ladybird/pull/2598#discussion_r1859263798 --- Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp | 94 ++++--------------- Libraries/LibWeb/Crypto/CryptoAlgorithms.h | 89 ++++++++---------- Libraries/LibWeb/Crypto/SubtleCrypto.cpp | 8 +- .../cfrg_curves_bits_curve448.https.any.txt | 6 +- .../derive_bits_keys/ecdh_bits.https.any.txt | 8 +- .../derive_bits_keys/ecdh_keys.https.any.txt | 8 +- 6 files changed, 74 insertions(+), 139 deletions(-) diff --git a/Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp b/Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp index 09ea7419bbd1..04c136d3571f 100644 --- a/Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp +++ b/Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp @@ -314,14 +314,9 @@ static WebIDL::ExceptionOr generate_random_key(JS::VM& vm, u16 const AlgorithmParams::~AlgorithmParams() = default; -JS::ThrowCompletionOr> AlgorithmParams::from_value(JS::VM& vm, JS::Value value) +JS::ThrowCompletionOr> AlgorithmParams::from_value(JS::VM&, JS::Value) { - auto& object = value.as_object(); - - auto name = TRY(object.get("name")); - auto name_string = TRY(name.to_string(vm)); - - return adopt_own(*new AlgorithmParams { name_string }); + return adopt_own(*new AlgorithmParams {}); } AesCbcParams::~AesCbcParams() = default; @@ -330,15 +325,12 @@ JS::ThrowCompletionOr> AesCbcParams::from_value(J { auto& object = value.as_object(); - auto name_value = TRY(object.get("name")); - auto name = TRY(name_value.to_string(vm)); - auto iv_value = TRY(object.get("iv")); if (!iv_value.is_object() || !(is(iv_value.as_object()) || is(iv_value.as_object()) || is(iv_value.as_object()))) return vm.throw_completion(JS::ErrorType::NotAnObjectOfType, "BufferSource"); auto iv = TRY_OR_THROW_OOM(vm, WebIDL::get_buffer_source_copy(iv_value.as_object())); - return adopt_own(*new AesCbcParams { name, iv }); + return adopt_own(*new AesCbcParams { iv }); } AesCtrParams::~AesCtrParams() = default; @@ -347,9 +339,6 @@ JS::ThrowCompletionOr> AesCtrParams::from_value(J { auto& object = value.as_object(); - auto name_value = TRY(object.get("name")); - auto name = TRY(name_value.to_string(vm)); - auto iv_value = TRY(object.get("counter")); if (!iv_value.is_object() || !(is(iv_value.as_object()) || is(iv_value.as_object()) || is(iv_value.as_object()))) return vm.throw_completion(JS::ErrorType::NotAnObjectOfType, "BufferSource"); @@ -358,7 +347,7 @@ JS::ThrowCompletionOr> AesCtrParams::from_value(J auto length_value = TRY(object.get("length")); auto length = TRY(length_value.to_u8(vm)); - return adopt_own(*new AesCtrParams { name, iv, length }); + return adopt_own(*new AesCtrParams { iv, length }); } AesGcmParams::~AesGcmParams() = default; @@ -367,9 +356,6 @@ JS::ThrowCompletionOr> AesGcmParams::from_value(J { auto& object = value.as_object(); - auto name_value = TRY(object.get("name")); - auto name = TRY(name_value.to_string(vm)); - auto iv_value = TRY(object.get("iv")); if (!iv_value.is_object() || !(is(iv_value.as_object()) || is(iv_value.as_object()) || is(iv_value.as_object()))) return vm.throw_completion(JS::ErrorType::NotAnObjectOfType, "BufferSource"); @@ -389,7 +375,7 @@ JS::ThrowCompletionOr> AesGcmParams::from_value(J maybe_tag_length = TRY(tag_length_value.to_u8(vm)); } - return adopt_own(*new AesGcmParams { name, iv, maybe_additional_data, maybe_tag_length }); + return adopt_own(*new AesGcmParams { iv, maybe_additional_data, maybe_tag_length }); } HKDFParams::~HKDFParams() = default; @@ -398,9 +384,6 @@ JS::ThrowCompletionOr> HKDFParams::from_value(JS: { auto& object = value.as_object(); - auto name_value = TRY(object.get("name")); - auto name = TRY(name_value.to_string(vm)); - auto hash_value = TRY(object.get("hash")); auto hash = TRY(hash_algorithm_identifier_from_value(vm, hash_value)); @@ -414,7 +397,7 @@ JS::ThrowCompletionOr> HKDFParams::from_value(JS: return vm.throw_completion(JS::ErrorType::NotAnObjectOfType, "BufferSource"); auto info = TRY_OR_THROW_OOM(vm, WebIDL::get_buffer_source_copy(info_value.as_object())); - return adopt_own(*new HKDFParams { name, hash, salt, info }); + return adopt_own(*new HKDFParams { hash, salt, info }); } PBKDF2Params::~PBKDF2Params() = default; @@ -423,9 +406,6 @@ JS::ThrowCompletionOr> PBKDF2Params::from_value(J { auto& object = value.as_object(); - auto name_value = TRY(object.get("name")); - auto name = TRY(name_value.to_string(vm)); - auto salt_value = TRY(object.get("salt")); if (!salt_value.is_object() || !(is(salt_value.as_object()) || is(salt_value.as_object()) || is(salt_value.as_object()))) @@ -439,7 +419,7 @@ JS::ThrowCompletionOr> PBKDF2Params::from_value(J auto hash_value = TRY(object.get("hash")); auto hash = TRY(hash_algorithm_identifier_from_value(vm, hash_value)); - return adopt_own(*new PBKDF2Params { name, salt, iterations, hash }); + return adopt_own(*new PBKDF2Params { salt, iterations, hash }); } RsaKeyGenParams::~RsaKeyGenParams() = default; @@ -448,9 +428,6 @@ JS::ThrowCompletionOr> RsaKeyGenParams::from_valu { auto& object = value.as_object(); - auto name_value = TRY(object.get("name")); - auto name = TRY(name_value.to_string(vm)); - auto modulus_length_value = TRY(object.get("modulusLength")); auto modulus_length = TRY(modulus_length_value.to_u32(vm)); @@ -462,7 +439,7 @@ JS::ThrowCompletionOr> RsaKeyGenParams::from_valu public_exponent = static_cast(public_exponent_value.as_object()); - return adopt_own(*new RsaKeyGenParams { name, modulus_length, big_integer_from_api_big_integer(public_exponent) }); + return adopt_own(*new RsaKeyGenParams { modulus_length, big_integer_from_api_big_integer(public_exponent) }); } RsaHashedKeyGenParams::~RsaHashedKeyGenParams() = default; @@ -471,9 +448,6 @@ JS::ThrowCompletionOr> RsaHashedKeyGenParams::fro { auto& object = value.as_object(); - auto name_value = TRY(object.get("name")); - auto name = TRY(name_value.to_string(vm)); - auto modulus_length_value = TRY(object.get("modulusLength")); auto modulus_length = TRY(modulus_length_value.to_u32(vm)); @@ -488,7 +462,7 @@ JS::ThrowCompletionOr> RsaHashedKeyGenParams::fro auto hash_value = TRY(object.get("hash")); auto hash = TRY(hash_algorithm_identifier_from_value(vm, hash_value)); - return adopt_own(*new RsaHashedKeyGenParams { name, modulus_length, big_integer_from_api_big_integer(public_exponent), hash }); + return adopt_own(*new RsaHashedKeyGenParams { modulus_length, big_integer_from_api_big_integer(public_exponent), hash }); } RsaHashedImportParams::~RsaHashedImportParams() = default; @@ -497,13 +471,10 @@ JS::ThrowCompletionOr> RsaHashedImportParams::fro { auto& object = value.as_object(); - auto name_value = TRY(object.get("name")); - auto name = TRY(name_value.to_string(vm)); - auto hash_value = TRY(object.get("hash")); auto hash = TRY(hash_algorithm_identifier_from_value(vm, hash_value)); - return adopt_own(*new RsaHashedImportParams { name, hash }); + return adopt_own(*new RsaHashedImportParams { hash }); } RsaOaepParams::~RsaOaepParams() = default; @@ -512,9 +483,6 @@ JS::ThrowCompletionOr> RsaOaepParams::from_value( { auto& object = value.as_object(); - auto name_value = TRY(object.get("name")); - auto name = TRY(name_value.to_string(vm)); - auto label_value = TRY(object.get("label")); ByteBuffer label; @@ -525,7 +493,7 @@ JS::ThrowCompletionOr> RsaOaepParams::from_value( label = TRY_OR_THROW_OOM(vm, WebIDL::get_buffer_source_copy(label_value.as_object())); } - return adopt_own(*new RsaOaepParams { name, move(label) }); + return adopt_own(*new RsaOaepParams { move(label) }); } EcdsaParams::~EcdsaParams() = default; @@ -534,13 +502,10 @@ JS::ThrowCompletionOr> EcdsaParams::from_value(JS { auto& object = value.as_object(); - auto name_value = TRY(object.get("name")); - auto name = TRY(name_value.to_string(vm)); - auto hash_value = TRY(object.get("hash")); auto hash = TRY(hash_algorithm_identifier_from_value(vm, hash_value)); - return adopt_own(*new EcdsaParams { name, hash }); + return adopt_own(*new EcdsaParams { hash }); } EcKeyGenParams::~EcKeyGenParams() = default; @@ -549,13 +514,10 @@ JS::ThrowCompletionOr> EcKeyGenParams::from_value { auto& object = value.as_object(); - auto name_value = TRY(object.get("name")); - auto name = TRY(name_value.to_string(vm)); - auto curve_value = TRY(object.get("namedCurve")); auto curve = TRY(curve_value.to_string(vm)); - return adopt_own(*new EcKeyGenParams { name, curve }); + return adopt_own(*new EcKeyGenParams { curve }); } AesKeyGenParams::~AesKeyGenParams() = default; @@ -564,13 +526,10 @@ JS::ThrowCompletionOr> AesKeyGenParams::from_valu { auto& object = value.as_object(); - auto name_value = TRY(object.get("name")); - auto name = TRY(name_value.to_string(vm)); - auto length_value = TRY(object.get("length")); auto length = TRY(length_value.to_u16(vm)); - return adopt_own(*new AesKeyGenParams { name, length }); + return adopt_own(*new AesKeyGenParams { length }); } AesDerivedKeyParams::~AesDerivedKeyParams() = default; @@ -579,13 +538,10 @@ JS::ThrowCompletionOr> AesDerivedKeyParams::from_ { auto& object = value.as_object(); - auto name_value = TRY(object.get("name")); - auto name = TRY(name_value.to_string(vm)); - auto length_value = TRY(object.get("length")); auto length = TRY(length_value.to_u16(vm)); - return adopt_own(*new AesDerivedKeyParams { name, length }); + return adopt_own(*new AesDerivedKeyParams { length }); } EcdhKeyDeriveParams::~EcdhKeyDeriveParams() = default; @@ -594,9 +550,6 @@ JS::ThrowCompletionOr> EcdhKeyDeriveParams::from_ { auto& object = value.as_object(); - auto name_value = TRY(object.get("name")); - auto name = TRY(name_value.to_string(vm)); - auto key_value = TRY(object.get("public")); auto key_object = TRY(key_value.to_object(vm)); @@ -606,7 +559,7 @@ JS::ThrowCompletionOr> EcdhKeyDeriveParams::from_ auto& key = verify_cast(*key_object); - return adopt_own(*new EcdhKeyDeriveParams { name, key }); + return adopt_own(*new EcdhKeyDeriveParams { key }); } EcKeyImportParams::~EcKeyImportParams() = default; @@ -615,13 +568,10 @@ JS::ThrowCompletionOr> EcKeyImportParams::from_va { auto& object = value.as_object(); - auto name_value = TRY(object.get("name")); - auto name = TRY(name_value.to_string(vm)); - auto named_curve_value = TRY(object.get("namedCurve")); auto named_curve = TRY(named_curve_value.to_string(vm)); - return adopt_own(*new EcKeyImportParams { name, named_curve }); + return adopt_own(*new EcKeyImportParams { named_curve }); } HmacImportParams::~HmacImportParams() = default; @@ -630,9 +580,6 @@ JS::ThrowCompletionOr> HmacImportParams::from_val { auto& object = value.as_object(); - auto name_value = TRY(object.get("name")); - auto name = TRY(name_value.to_string(vm)); - auto hash_value = TRY(object.get("hash")); auto hash = TRY(hash_algorithm_identifier_from_value(vm, hash_value)); @@ -642,7 +589,7 @@ JS::ThrowCompletionOr> HmacImportParams::from_val maybe_length = TRY(length_value.to_u32(vm)); } - return adopt_own(*new HmacImportParams { name, hash, maybe_length }); + return adopt_own(*new HmacImportParams { hash, maybe_length }); } HmacKeyGenParams::~HmacKeyGenParams() = default; @@ -651,9 +598,6 @@ JS::ThrowCompletionOr> HmacKeyGenParams::from_val { auto& object = value.as_object(); - auto name_value = TRY(object.get("name")); - auto name = TRY(name_value.to_string(vm)); - auto hash_value = TRY(object.get("hash")); auto hash = TRY(hash_algorithm_identifier_from_value(vm, hash_value)); @@ -663,7 +607,7 @@ JS::ThrowCompletionOr> HmacKeyGenParams::from_val maybe_length = TRY(length_value.to_u32(vm)); } - return adopt_own(*new HmacKeyGenParams { name, hash, maybe_length }); + return adopt_own(*new HmacKeyGenParams { hash, maybe_length }); } // https://w3c.github.io/webcrypto/#rsa-oaep-operations diff --git a/Libraries/LibWeb/Crypto/CryptoAlgorithms.h b/Libraries/LibWeb/Crypto/CryptoAlgorithms.h index 5fbd25f49d55..892e7b5305bd 100644 --- a/Libraries/LibWeb/Crypto/CryptoAlgorithms.h +++ b/Libraries/LibWeb/Crypto/CryptoAlgorithms.h @@ -45,11 +45,12 @@ struct HashAlgorithmIdentifier : public AlgorithmIdentifier { // https://w3c.github.io/webcrypto/#algorithm-overview struct AlgorithmParams { virtual ~AlgorithmParams(); - explicit AlgorithmParams(String name) - : name(move(name)) + explicit AlgorithmParams() { } + // NOTE: this is initialized when normalizing the algorithm name as the spec requests. + // It must not be set in `from_value`. String name; static JS::ThrowCompletionOr> from_value(JS::VM&, JS::Value); @@ -58,9 +59,8 @@ struct AlgorithmParams { // https://w3c.github.io/webcrypto/#aes-cbc struct AesCbcParams : public AlgorithmParams { virtual ~AesCbcParams() override; - AesCbcParams(String name, ByteBuffer iv) - : AlgorithmParams(move(name)) - , iv(move(iv)) + AesCbcParams(ByteBuffer iv) + : iv(move(iv)) { } @@ -72,9 +72,8 @@ struct AesCbcParams : public AlgorithmParams { // https://w3c.github.io/webcrypto/#dfn-AesCtrParams struct AesCtrParams : public AlgorithmParams { virtual ~AesCtrParams() override; - AesCtrParams(String name, ByteBuffer counter, u8 length) - : AlgorithmParams(move(name)) - , counter(move(counter)) + AesCtrParams(ByteBuffer counter, u8 length) + : counter(move(counter)) , length(length) { } @@ -88,9 +87,8 @@ struct AesCtrParams : public AlgorithmParams { // https://w3c.github.io/webcrypto/#dfn-AesGcmParams struct AesGcmParams : public AlgorithmParams { virtual ~AesGcmParams() override; - AesGcmParams(String name, ByteBuffer iv, Optional additional_data, Optional tag_length) - : AlgorithmParams(move(name)) - , iv(move(iv)) + AesGcmParams(ByteBuffer iv, Optional additional_data, Optional tag_length) + : iv(move(iv)) , additional_data(move(additional_data)) , tag_length(tag_length) { @@ -106,9 +104,8 @@ struct AesGcmParams : public AlgorithmParams { // https://w3c.github.io/webcrypto/#hkdf-params struct HKDFParams : public AlgorithmParams { virtual ~HKDFParams() override; - HKDFParams(String name, HashAlgorithmIdentifier hash, ByteBuffer salt, ByteBuffer info) - : AlgorithmParams(move(name)) - , hash(move(hash)) + HKDFParams(HashAlgorithmIdentifier hash, ByteBuffer salt, ByteBuffer info) + : hash(move(hash)) , salt(move(salt)) , info(move(info)) { @@ -124,9 +121,8 @@ struct HKDFParams : public AlgorithmParams { // https://w3c.github.io/webcrypto/#pbkdf2-params struct PBKDF2Params : public AlgorithmParams { virtual ~PBKDF2Params() override; - PBKDF2Params(String name, ByteBuffer salt, u32 iterations, HashAlgorithmIdentifier hash) - : AlgorithmParams(move(name)) - , salt(move(salt)) + PBKDF2Params(ByteBuffer salt, u32 iterations, HashAlgorithmIdentifier hash) + : salt(move(salt)) , iterations(iterations) , hash(move(hash)) { @@ -143,9 +139,8 @@ struct PBKDF2Params : public AlgorithmParams { struct RsaKeyGenParams : public AlgorithmParams { virtual ~RsaKeyGenParams() override; - RsaKeyGenParams(String name, u32 modulus_length, ::Crypto::UnsignedBigInteger public_exponent) - : AlgorithmParams(move(name)) - , modulus_length(modulus_length) + RsaKeyGenParams(u32 modulus_length, ::Crypto::UnsignedBigInteger public_exponent) + : modulus_length(modulus_length) , public_exponent(move(public_exponent)) { } @@ -161,8 +156,8 @@ struct RsaKeyGenParams : public AlgorithmParams { struct RsaHashedKeyGenParams : public RsaKeyGenParams { virtual ~RsaHashedKeyGenParams() override; - RsaHashedKeyGenParams(String name, u32 modulus_length, ::Crypto::UnsignedBigInteger public_exponent, HashAlgorithmIdentifier hash) - : RsaKeyGenParams(move(name), modulus_length, move(public_exponent)) + RsaHashedKeyGenParams(u32 modulus_length, ::Crypto::UnsignedBigInteger public_exponent, HashAlgorithmIdentifier hash) + : RsaKeyGenParams(modulus_length, move(public_exponent)) , hash(move(hash)) { } @@ -176,9 +171,8 @@ struct RsaHashedKeyGenParams : public RsaKeyGenParams { struct RsaHashedImportParams : public AlgorithmParams { virtual ~RsaHashedImportParams() override; - RsaHashedImportParams(String name, HashAlgorithmIdentifier hash) - : AlgorithmParams(move(name)) - , hash(move(hash)) + RsaHashedImportParams(HashAlgorithmIdentifier hash) + : hash(move(hash)) { } @@ -191,9 +185,8 @@ struct RsaHashedImportParams : public AlgorithmParams { struct RsaOaepParams : public AlgorithmParams { virtual ~RsaOaepParams() override; - RsaOaepParams(String name, ByteBuffer label) - : AlgorithmParams(move(name)) - , label(move(label)) + RsaOaepParams(ByteBuffer label) + : label(move(label)) { } @@ -206,9 +199,8 @@ struct RsaOaepParams : public AlgorithmParams { struct EcdsaParams : public AlgorithmParams { virtual ~EcdsaParams() override; - EcdsaParams(String name, HashAlgorithmIdentifier hash) - : AlgorithmParams(move(name)) - , hash(move(hash)) + EcdsaParams(HashAlgorithmIdentifier hash) + : hash(move(hash)) { } @@ -221,9 +213,8 @@ struct EcdsaParams : public AlgorithmParams { struct EcKeyGenParams : public AlgorithmParams { virtual ~EcKeyGenParams() override; - EcKeyGenParams(String name, NamedCurve named_curve) - : AlgorithmParams(move(name)) - , named_curve(move(named_curve)) + EcKeyGenParams(NamedCurve named_curve) + : named_curve(move(named_curve)) { } @@ -236,9 +227,8 @@ struct EcKeyGenParams : public AlgorithmParams { struct AesKeyGenParams : public AlgorithmParams { virtual ~AesKeyGenParams() override; - AesKeyGenParams(String name, u16 length) - : AlgorithmParams(move(name)) - , length(length) + AesKeyGenParams(u16 length) + : length(length) { } @@ -251,9 +241,8 @@ struct AesKeyGenParams : public AlgorithmParams { struct AesDerivedKeyParams : public AlgorithmParams { virtual ~AesDerivedKeyParams() override; - AesDerivedKeyParams(String name, u16 length) - : AlgorithmParams(move(name)) - , length(length) + AesDerivedKeyParams(u16 length) + : length(length) { } @@ -266,9 +255,8 @@ struct AesDerivedKeyParams : public AlgorithmParams { struct HmacImportParams : public AlgorithmParams { virtual ~HmacImportParams() override; - HmacImportParams(String name, HashAlgorithmIdentifier hash, Optional length) - : AlgorithmParams(move(name)) - , hash(move(hash)) + HmacImportParams(HashAlgorithmIdentifier hash, Optional length) + : hash(move(hash)) , length(length) { } @@ -283,9 +271,8 @@ struct HmacImportParams : public AlgorithmParams { struct HmacKeyGenParams : public AlgorithmParams { virtual ~HmacKeyGenParams() override; - HmacKeyGenParams(String name, HashAlgorithmIdentifier hash, Optional length) - : AlgorithmParams(move(name)) - , hash(move(hash)) + HmacKeyGenParams(HashAlgorithmIdentifier hash, Optional length) + : hash(move(hash)) , length(length) { } @@ -580,9 +567,8 @@ class HMAC : public AlgorithmMethods { struct EcdhKeyDeriveParams : public AlgorithmParams { virtual ~EcdhKeyDeriveParams() override; - EcdhKeyDeriveParams(String name, CryptoKey& public_key) - : AlgorithmParams(move(name)) - , public_key(public_key) + EcdhKeyDeriveParams(CryptoKey& public_key) + : public_key(public_key) { } @@ -594,9 +580,8 @@ struct EcdhKeyDeriveParams : public AlgorithmParams { struct EcKeyImportParams : public AlgorithmParams { virtual ~EcKeyImportParams() override; - EcKeyImportParams(String name, String named_curve) - : AlgorithmParams(move(name)) - , named_curve(move(named_curve)) + EcKeyImportParams(String named_curve) + : named_curve(move(named_curve)) { } diff --git a/Libraries/LibWeb/Crypto/SubtleCrypto.cpp b/Libraries/LibWeb/Crypto/SubtleCrypto.cpp index 772976974f07..f52926015a4b 100644 --- a/Libraries/LibWeb/Crypto/SubtleCrypto.cpp +++ b/Libraries/LibWeb/Crypto/SubtleCrypto.cpp @@ -100,6 +100,8 @@ WebIDL::ExceptionOr normalize_an_algorithm(JS:: // 5. If registeredAlgorithms contains a key that is a case-insensitive string match for algName: if (auto it = registered_algorithms.find(algorithm_name); it != registered_algorithms.end()) { // 1. Set algName to the value of the matching key. + algorithm_name = it->key; + // 2. Let desiredType be the IDL dictionary type stored at algName in registeredAlgorithms. desired_type = it->value; } else { @@ -110,7 +112,6 @@ WebIDL::ExceptionOr normalize_an_algorithm(JS:: // 8. Let normalizedAlgorithm be the result of converting the ECMAScript object represented by alg // to the IDL dictionary type desiredType, as defined by [WebIDL]. - // 9. Set the name attribute of normalizedAlgorithm to algName. // 10. If an error occurred, return the error and terminate this algorithm. // 11. Let dictionaries be a list consisting of the IDL dictionary type desiredType // and all of desiredType's inherited dictionaries, in order from least to most derived. @@ -118,6 +119,11 @@ WebIDL::ExceptionOr normalize_an_algorithm(JS:: // Note: All of these steps are handled by the create_methods and parameter_from_value methods. auto methods = desired_type.create_methods(realm); auto parameter = TRY(desired_type.parameter_from_value(vm, algorithm.get>())); + + // 9. Set the name attribute of normalizedAlgorithm to algName. + VERIFY(parameter->name.is_empty()); + parameter->name = algorithm_name; + auto normalized_algorithm = NormalizedAlgorithmAndParameter { move(methods), move(parameter) }; // 13. Return normalizedAlgorithm. diff --git a/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/derive_bits_keys/cfrg_curves_bits_curve448.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/derive_bits_keys/cfrg_curves_bits_curve448.https.any.txt index 0f09054e07f8..aa69ea2e5ec7 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/derive_bits_keys/cfrg_curves_bits_curve448.https.any.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/derive_bits_keys/cfrg_curves_bits_curve448.https.any.txt @@ -6,8 +6,8 @@ Rerun Found 18 tests -16 Pass -2 Fail +17 Pass +1 Fail Details Result Test Name MessagePass setup - define tests Pass X448 key derivation checks for all-zero value result with a key of order 0 @@ -16,7 +16,7 @@ Pass X448 key derivation checks for all-zero value result with a key of order p- Pass X448 key derivation checks for all-zero value result with a key of order p (=0, order 4) Pass X448 key derivation checks for all-zero value result with a key of order p+1 (=1, order 1) Pass X448 good parameters -Fail X448 mixed case parameters +Pass X448 mixed case parameters Pass X448 short result Fail X448 non-multiple of 8 bits Pass X448 missing public property diff --git a/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/derive_bits_keys/ecdh_bits.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/derive_bits_keys/ecdh_bits.https.any.txt index 3ffecb25962f..72240fba0e52 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/derive_bits_keys/ecdh_bits.https.any.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/derive_bits_keys/ecdh_bits.https.any.txt @@ -6,8 +6,8 @@ Rerun Found 40 tests -23 Pass -17 Fail +25 Pass +15 Fail Details Result Test Name MessagePass setup - define tests Fail P-521 good parameters @@ -24,7 +24,7 @@ Fail P-521 public property value is a private key Fail P-521 public property value is a secret key Fail P-521 asking for too many bits Pass P-256 good parameters -Fail P-256 mixed case parameters +Pass P-256 mixed case parameters Pass P-256 short result Fail P-256 non-multiple of 8 bits Pass P-256 missing public curve @@ -37,7 +37,7 @@ Pass P-256 public property value is a private key Pass P-256 public property value is a secret key Fail P-256 asking for too many bits Pass P-384 good parameters -Fail P-384 mixed case parameters +Pass P-384 mixed case parameters Pass P-384 short result Fail P-384 non-multiple of 8 bits Pass P-384 missing public curve diff --git a/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/derive_bits_keys/ecdh_keys.https.any.txt b/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/derive_bits_keys/ecdh_keys.https.any.txt index 89c8b77bdbfd..904279017593 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/derive_bits_keys/ecdh_keys.https.any.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/WebCryptoAPI/derive_bits_keys/ecdh_keys.https.any.txt @@ -6,8 +6,8 @@ Rerun Found 31 tests -21 Pass -10 Fail +23 Pass +8 Fail Details Result Test Name MessagePass setup - define tests Fail P-521 good parameters @@ -21,7 +21,7 @@ Fail P-521 base key is not a private key Fail P-521 public property value is a private key Fail P-521 public property value is a secret key Pass P-256 good parameters -Fail P-256 mixed case parameters +Pass P-256 mixed case parameters Pass P-256 missing public curve Pass P-256 public property of algorithm is not a CryptoKey Pass P-256 mismatched curves @@ -31,7 +31,7 @@ Pass P-256 base key is not a private key Pass P-256 public property value is a private key Pass P-256 public property value is a secret key Pass P-384 good parameters -Fail P-384 mixed case parameters +Pass P-384 mixed case parameters Pass P-384 missing public curve Pass P-384 public property of algorithm is not a CryptoKey Pass P-384 mismatched curves