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

Unified Diff: components/webcrypto/algorithm_dispatch.cc

Issue 1181413009: move KeyUsageAllows to more logical place(part2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove AUTHORS change because name is already there Created 5 years, 4 months 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/webcrypto_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/webcrypto/algorithm_dispatch.cc
diff --git a/components/webcrypto/algorithm_dispatch.cc b/components/webcrypto/algorithm_dispatch.cc
index ce29c91a3a6ddb3c9840687056305132a5bbf044..e56efbd19601b9e7ecddbf7d0e28827cfb908f0c 100644
--- a/components/webcrypto/algorithm_dispatch.cc
+++ b/components/webcrypto/algorithm_dispatch.cc
@@ -65,7 +65,7 @@ Status Encrypt(const blink::WebCryptoAlgorithm& algorithm,
const blink::WebCryptoKey& key,
const CryptoData& data,
std::vector<uint8_t>* buffer) {
- if (!KeyUsageAllows(key, blink::WebCryptoKeyUsageEncrypt))
+ if (!key.keyUsageAllows(blink::WebCryptoKeyUsageEncrypt))
return Status::ErrorUnexpected();
return EncryptDontCheckUsage(algorithm, key, data, buffer);
}
@@ -74,7 +74,7 @@ Status Decrypt(const blink::WebCryptoAlgorithm& algorithm,
const blink::WebCryptoKey& key,
const CryptoData& data,
std::vector<uint8_t>* buffer) {
- if (!KeyUsageAllows(key, blink::WebCryptoKeyUsageDecrypt))
+ if (!key.keyUsageAllows(blink::WebCryptoKeyUsageDecrypt))
return Status::ErrorUnexpected();
return DecryptDontCheckKeyUsage(algorithm, key, data, buffer);
}
@@ -150,7 +150,7 @@ Status Sign(const blink::WebCryptoAlgorithm& algorithm,
const blink::WebCryptoKey& key,
const CryptoData& data,
std::vector<uint8_t>* buffer) {
- if (!KeyUsageAllows(key, blink::WebCryptoKeyUsageSign))
+ if (!key.keyUsageAllows(blink::WebCryptoKeyUsageSign))
return Status::ErrorUnexpected();
if (algorithm.id() != key.algorithm().id())
return Status::ErrorUnexpected();
@@ -168,7 +168,7 @@ Status Verify(const blink::WebCryptoAlgorithm& algorithm,
const CryptoData& signature,
const CryptoData& data,
bool* signature_match) {
- if (!KeyUsageAllows(key, blink::WebCryptoKeyUsageVerify))
+ if (!key.keyUsageAllows(blink::WebCryptoKeyUsageVerify))
return Status::ErrorUnexpected();
if (algorithm.id() != key.algorithm().id())
return Status::ErrorUnexpected();
@@ -186,7 +186,7 @@ Status WrapKey(blink::WebCryptoKeyFormat format,
const blink::WebCryptoKey& wrapping_key,
const blink::WebCryptoAlgorithm& wrapping_algorithm,
std::vector<uint8_t>* buffer) {
- if (!KeyUsageAllows(wrapping_key, blink::WebCryptoKeyUsageWrapKey))
+ if (!wrapping_key.keyUsageAllows(blink::WebCryptoKeyUsageWrapKey))
return Status::ErrorUnexpected();
std::vector<uint8_t> exported_data;
@@ -205,7 +205,7 @@ Status UnwrapKey(blink::WebCryptoKeyFormat format,
bool extractable,
blink::WebCryptoKeyUsageMask usages,
blink::WebCryptoKey* key) {
- if (!KeyUsageAllows(wrapping_key, blink::WebCryptoKeyUsageUnwrapKey))
+ if (!wrapping_key.keyUsageAllows(blink::WebCryptoKeyUsageUnwrapKey))
return Status::ErrorUnexpected();
if (wrapping_algorithm.id() != wrapping_key.algorithm().id())
return Status::ErrorUnexpected();
@@ -239,7 +239,7 @@ Status DeriveBits(const blink::WebCryptoAlgorithm& algorithm,
const blink::WebCryptoKey& base_key,
unsigned int length_bits,
std::vector<uint8_t>* derived_bytes) {
- if (!KeyUsageAllows(base_key, blink::WebCryptoKeyUsageDeriveBits))
+ if (!base_key.keyUsageAllows(blink::WebCryptoKeyUsageDeriveBits))
return Status::ErrorUnexpected();
if (algorithm.id() != base_key.algorithm().id())
@@ -261,7 +261,7 @@ Status DeriveKey(const blink::WebCryptoAlgorithm& algorithm,
bool extractable,
blink::WebCryptoKeyUsageMask usages,
blink::WebCryptoKey* derived_key) {
- if (!KeyUsageAllows(base_key, blink::WebCryptoKeyUsageDeriveKey))
+ if (!base_key.keyUsageAllows(blink::WebCryptoKeyUsageDeriveKey))
return Status::ErrorUnexpected();
if (algorithm.id() != base_key.algorithm().id())
« no previous file with comments | « no previous file | components/webcrypto/webcrypto_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698