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
  • Loading branch information
BenWiederhake committed Oct 25, 2024
1 parent 3cf893c commit 0d586ae
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 @@ -995,19 +995,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 @@ -1035,19 +1032,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 0d586ae

Please sign in to comment.