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

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: 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..aa5d611e0fcea607e6b43376f59e21237fa33331 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 check_usage) {
eroman 2014/12/09 21:04:46 This is poorly named -- the entire purpose of this
Habib Virji 2014/12/15 18:48:56 Done.
+ // In case import key calls this function, it checks for empty usage
eroman 2014/12/09 21:04:46 This comment is unnecessary (will apply to both im
Habib Virji 2014/12/15 18:48:56 Removed
+ if (check_usage && actual_usages == 0)
+ return Status::ErrorImportKeyEmptyUsages();
+
if (!ContainsKeyUsages(all_possible_usages, actual_usages))
return Status::ErrorCreateKeyBadUsages();
return Status::Success();
« content/child/webcrypto/test/rsa_ssa_unittest.cc ('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