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

Unified Diff: components/webcrypto/algorithms/aes.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 | « no previous file | components/webcrypto/algorithms/ec.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/webcrypto/algorithms/aes.cc
diff --git a/components/webcrypto/algorithms/aes.cc b/components/webcrypto/algorithms/aes.cc
index f46ea15a119bf502f399bbf4e3e9cc664db962a3..1a21dc5ca1a85c7be508de02cbc8726ba4b4fc06 100644
--- a/components/webcrypto/algorithms/aes.cc
+++ b/components/webcrypto/algorithms/aes.cc
@@ -199,6 +199,10 @@ Status AesAlgorithm::DeserializeKeyForClone(
blink::WebCryptoKeyUsageMask usages,
const CryptoData& key_data,
blink::WebCryptoKey* key) const {
+ if (algorithm.paramsType() != blink::WebCryptoKeyAlgorithmParamsTypeAes ||
+ type != blink::WebCryptoKeyTypeSecret)
+ return Status::ErrorUnexpected();
+
return ImportKeyRaw(key_data, SynthesizeImportAlgorithmForClone(algorithm),
extractable, usages, key);
}
« no previous file with comments | « no previous file | components/webcrypto/algorithms/ec.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698