Skip to content

Commit

Permalink
LibWeb: Remove dead write in HKDF/PBKDF importKey operation
Browse files Browse the repository at this point in the history
This corresponds to a recent change in the spec:
w3c/webcrypto#379

(cherry picked from commit efad0b56769957e81e2420e4ccaef212baf5ea9f)
  • Loading branch information
BenWiederhake authored and nico committed Nov 12, 2024
1 parent 81174e6 commit 1d9376d
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions Userland/Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -990,19 +990,16 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<CryptoKey>> HKDF::import_key(AlgorithmParam
// 4. Set the [[type]] internal slot of key to "secret".
key->set_type(Bindings::KeyType::Secret);

// 5. Set the [[extractable]] internal slot of key to false.
key->set_extractable(false);

// 6. Let algorithm be a new KeyAlgorithm object.
// 5. Let algorithm be a new KeyAlgorithm object.
auto algorithm = KeyAlgorithm::create(m_realm);

// 7. Set the name attribute of algorithm to "HKDF".
// 6. Set the name attribute of algorithm to "HKDF".
algorithm->set_name("HKDF"_string);

// 8. Set the [[algorithm]] internal slot of key to algorithm.
// 7. Set the [[algorithm]] internal slot of key to algorithm.
key->set_algorithm(algorithm);

// 9. Return key.
// 8. Return key.
return key;
}

Expand Down Expand Up @@ -1030,19 +1027,16 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<CryptoKey>> PBKDF2::import_key(AlgorithmPar
// 5. Set the [[type]] internal slot of key to "secret".
key->set_type(Bindings::KeyType::Secret);

// 6. Set the [[extractable]] internal slot of key to false.
key->set_extractable(false);

// 7. Let algorithm be a new KeyAlgorithm object.
// 6. Let algorithm be a new KeyAlgorithm object.
auto algorithm = KeyAlgorithm::create(m_realm);

// 8. Set the name attribute of algorithm to "PBKDF2".
// 7. Set the name attribute of algorithm to "PBKDF2".
algorithm->set_name("PBKDF2"_string);

// 9. Set the [[algorithm]] internal slot of key to algorithm.
// 8. Set the [[algorithm]] internal slot of key to algorithm.
key->set_algorithm(algorithm);

// 10. Return key.
// 9. Return key.
return key;
}

Expand Down

0 comments on commit 1d9376d

Please sign in to comment.