mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-21 10:32:51 +00:00
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.
This commit is contained in:
parent
ac0036d184
commit
f5d3d6a7d4
Notes:
github-actions[bot]
2025-01-02 10:38:45 +00:00
Author: https://github.com/devgianlu
Commit: f5d3d6a7d4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3092
4 changed files with 230 additions and 5 deletions
|
@ -6205,19 +6205,22 @@ WebIDL::ExceptionOr<Variant<GC::Ref<CryptoKey>, GC::Ref<CryptoKeyPair>>> HMAC::g
|
|||
// 10. Set the hash attribute of algorithm to hash.
|
||||
algorithm->set_hash(hash);
|
||||
|
||||
// 11. Set the [[type]] internal slot of key to "secret".
|
||||
// 11. Set the length attribute of algorithm to length.
|
||||
algorithm->set_length(length);
|
||||
|
||||
// 12. Set the [[type]] internal slot of key to "secret".
|
||||
key->set_type(Bindings::KeyType::Secret);
|
||||
|
||||
// 12. Set the [[algorithm]] internal slot of key to algorithm.
|
||||
// 13. Set the [[algorithm]] internal slot of key to algorithm.
|
||||
key->set_algorithm(algorithm);
|
||||
|
||||
// 13. Set the [[extractable]] internal slot of key to be extractable.
|
||||
// 14. Set the [[extractable]] internal slot of key to be extractable.
|
||||
key->set_extractable(extractable);
|
||||
|
||||
// 14. Set the [[usages]] internal slot of key to be usages.
|
||||
// 15. Set the [[usages]] internal slot of key to be usages.
|
||||
key->set_usages(usages);
|
||||
|
||||
// 15. Return key.
|
||||
// 16. Return key.
|
||||
return Variant<GC::Ref<CryptoKey>, GC::Ref<CryptoKeyPair>> { key };
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue