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

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

Issue 512023002: Refactor the interface for generating keys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Run git-cl format Created 6 years, 2 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 | « content/child/webcrypto/algorithm_dispatch.h ('k') | content/child/webcrypto/algorithm_implementation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/algorithm_dispatch.cc
diff --git a/content/child/webcrypto/algorithm_dispatch.cc b/content/child/webcrypto/algorithm_dispatch.cc
index 758f5e9da1bc61f87b8355878858df390c08398c..a7b53bab647bff3e6e8238f3cf0087a3d7c72204 100644
--- a/content/child/webcrypto/algorithm_dispatch.cc
+++ b/content/child/webcrypto/algorithm_dispatch.cc
@@ -102,45 +102,16 @@ Status Digest(const blink::WebCryptoAlgorithm& algorithm,
return impl->Digest(algorithm, data, buffer);
}
-Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm,
- bool extractable,
- blink::WebCryptoKeyUsageMask usage_mask,
- blink::WebCryptoKey* key) {
+Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm,
+ bool extractable,
+ blink::WebCryptoKeyUsageMask usage_mask,
+ GenerateKeyResult* result) {
const AlgorithmImplementation* impl = NULL;
Status status = GetAlgorithmImplementation(algorithm.id(), &impl);
if (status.IsError())
return status;
- status = impl->VerifyKeyUsagesBeforeGenerateKey(usage_mask);
- if (status.IsError())
- return status;
-
- return impl->GenerateSecretKey(algorithm, extractable, usage_mask, key);
-}
-
-Status GenerateKeyPair(const blink::WebCryptoAlgorithm& algorithm,
- bool extractable,
- blink::WebCryptoKeyUsageMask combined_usage_mask,
- blink::WebCryptoKey* public_key,
- blink::WebCryptoKey* private_key) {
- const AlgorithmImplementation* impl = NULL;
- Status status = GetAlgorithmImplementation(algorithm.id(), &impl);
- if (status.IsError())
- return status;
-
- blink::WebCryptoKeyUsageMask public_usage_mask;
- blink::WebCryptoKeyUsageMask private_usage_mask;
- status = impl->VerifyKeyUsagesBeforeGenerateKeyPair(
- combined_usage_mask, &public_usage_mask, &private_usage_mask);
- if (status.IsError())
- return status;
-
- return impl->GenerateKeyPair(algorithm,
- extractable,
- public_usage_mask,
- private_usage_mask,
- public_key,
- private_key);
+ return impl->GenerateKey(algorithm, extractable, usage_mask, result);
}
// Note that this function may be called from the target Blink thread.
« no previous file with comments | « content/child/webcrypto/algorithm_dispatch.h ('k') | content/child/webcrypto/algorithm_implementation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698