Chromium Code Reviews| 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(); |