Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1434)

Unified Diff: components/webcrypto/algorithms/hmac.cc

Issue 2544533002: Have all overloads of webcrypto::AlgorithmImplementation::DeserializeKeyForClone check the params t… (Closed)
Patch Set: additional checks, per eroman Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/webcrypto/algorithms/hkdf.cc ('k') | components/webcrypto/algorithms/pbkdf2.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/webcrypto/algorithms/hmac.cc
diff --git a/components/webcrypto/algorithms/hmac.cc b/components/webcrypto/algorithms/hmac.cc
index 05caa7c6c5cdc64549fad770770bc022329137fd..9678654b630d340652205bf4c436ea8b4847e49b 100644
--- a/components/webcrypto/algorithms/hmac.cc
+++ b/components/webcrypto/algorithms/hmac.cc
@@ -291,6 +291,10 @@ class HmacImplementation : public AlgorithmImplementation {
blink::WebCryptoKeyUsageMask usages,
const CryptoData& key_data,
blink::WebCryptoKey* key) const override {
+ if (algorithm.paramsType() != blink::WebCryptoKeyAlgorithmParamsTypeHmac ||
+ type != blink::WebCryptoKeyTypeSecret)
+ return Status::ErrorUnexpected();
+
return CreateWebCryptoSecretKey(key_data, algorithm, extractable, usages,
key);
}
« no previous file with comments | « components/webcrypto/algorithms/hkdf.cc ('k') | components/webcrypto/algorithms/pbkdf2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698