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

Unified Diff: components/webcrypto/algorithms/pbkdf2.cc

Issue 2163053002: [webcrypto] Check for empty key usages *after* key creation rather than before, to match the spec's… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 | « components/webcrypto/algorithms/hmac.cc ('k') | components/webcrypto/algorithms/rsa.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/webcrypto/algorithms/pbkdf2.cc
diff --git a/components/webcrypto/algorithms/pbkdf2.cc b/components/webcrypto/algorithms/pbkdf2.cc
index 976d73d69b4aa1fec6a443835d3306abed631f53..c2aaf6de15a8c2528b9a991c788fd47aef977dfc 100644
--- a/components/webcrypto/algorithms/pbkdf2.cc
+++ b/components/webcrypto/algorithms/pbkdf2.cc
@@ -27,12 +27,15 @@ class Pbkdf2Implementation : public AlgorithmImplementation {
public:
Pbkdf2Implementation() {}
- Status VerifyKeyUsagesBeforeImportKey(
- blink::WebCryptoKeyFormat format,
- blink::WebCryptoKeyUsageMask usages) const override {
+ Status ImportKey(blink::WebCryptoKeyFormat format,
+ const CryptoData& key_data,
+ const blink::WebCryptoAlgorithm& algorithm,
+ bool extractable,
+ blink::WebCryptoKeyUsageMask usages,
+ blink::WebCryptoKey* key) const override {
switch (format) {
case blink::WebCryptoKeyFormatRaw:
- return CheckSecretKeyCreationUsages(kAllKeyUsages, usages);
+ return ImportKeyRaw(key_data, algorithm, extractable, usages, key);
default:
return Status::ErrorUnsupportedImportKeyFormat();
}
@@ -42,7 +45,11 @@ class Pbkdf2Implementation : public AlgorithmImplementation {
const blink::WebCryptoAlgorithm& algorithm,
bool extractable,
blink::WebCryptoKeyUsageMask usages,
- blink::WebCryptoKey* key) const override {
+ blink::WebCryptoKey* key) const {
+ Status status = CheckKeyCreationUsages(kAllKeyUsages, usages);
+ if (status.IsError())
+ return status;
+
const blink::WebCryptoKeyAlgorithm key_algorithm =
blink::WebCryptoKeyAlgorithm::createWithoutParams(
blink::WebCryptoAlgorithmIdPbkdf2);
« no previous file with comments | « components/webcrypto/algorithms/hmac.cc ('k') | components/webcrypto/algorithms/rsa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698