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

Unified Diff: content/child/webcrypto/webcrypto_util.cc

Issue 777403004: [WebCrypto] Throw syntaxError if keyUsage is empty in ImportKey (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved import key empty usage to CheckKeyCreationUsages Created 6 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
Index: content/child/webcrypto/webcrypto_util.cc
diff --git a/content/child/webcrypto/webcrypto_util.cc b/content/child/webcrypto/webcrypto_util.cc
index 6dad83fcae7dae6c9cb0bd1ecd7b50139d56c670..603d9da7b4caa2d584c6f113618f9ea48a26ef7f 100644
--- a/content/child/webcrypto/webcrypto_util.cc
+++ b/content/child/webcrypto/webcrypto_util.cc
@@ -229,7 +229,12 @@ Status VerifyAesKeyLengthForImport(unsigned int keylen_bytes) {
}
Status CheckKeyCreationUsages(blink::WebCryptoKeyUsageMask all_possible_usages,
- blink::WebCryptoKeyUsageMask actual_usages) {
+ blink::WebCryptoKeyUsageMask actual_usages,
+ bool checkImportEmptyUsage) {
Habib Virji 2014/12/09 10:21:53 Have initialized this variable to false by default
+ // In case import key calls this function, it checks for empty usage
+ if (checkImportEmptyUsage && actual_usages == 0)
+ return Status::ErrorImportKeyEmptyUsages();
+
if (!ContainsKeyUsages(all_possible_usages, actual_usages))
return Status::ErrorCreateKeyBadUsages();
return Status::Success();
« content/child/webcrypto/webcrypto_util.h ('K') | « content/child/webcrypto/webcrypto_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698