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

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

Issue 282133002: [webcryto] Validate key usages during key creation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase on master Created 6 years, 7 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/status.cc ('k') | content/child/webcrypto/webcrypto_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/webcrypto_impl.cc
diff --git a/content/child/webcrypto/webcrypto_impl.cc b/content/child/webcrypto/webcrypto_impl.cc
index 0a80ce7e0a88abcdf0499eaacd0aca092ebe6e2c..ef0740ba6629b69dd6efbd6beb6df0c2dd9071f9 100644
--- a/content/child/webcrypto/webcrypto_impl.cc
+++ b/content/child/webcrypto/webcrypto_impl.cc
@@ -134,12 +134,6 @@ void CompleteWithKeyOrError(const Status& status,
}
}
-bool IsAlgorithmAsymmetric(const blink::WebCryptoAlgorithm& algorithm) {
- // TODO(padolph): include all other asymmetric algorithms once they are
- // defined, e.g. EC and DH.
- return webcrypto::IsAlgorithmRsa(algorithm.id());
-}
-
// Gets a task runner for the current thread. The current thread is either:
//
// * The main Blink thread
@@ -405,7 +399,8 @@ void DoGenerateKeyReply(scoped_ptr<GenerateKeyState> state) {
void DoGenerateKey(scoped_ptr<GenerateKeyState> passed_state) {
GenerateKeyState* state = passed_state.get();
- state->is_asymmetric = IsAlgorithmAsymmetric(state->algorithm);
+ state->is_asymmetric =
+ webcrypto::IsAlgorithmAsymmetric(state->algorithm.id());
if (state->is_asymmetric) {
state->status = webcrypto::GenerateKeyPair(state->algorithm,
state->extractable,
@@ -420,8 +415,6 @@ void DoGenerateKey(scoped_ptr<GenerateKeyState> passed_state) {
DCHECK_EQ(state->algorithm.id(), state->private_key.algorithm().id());
DCHECK_EQ(true, state->public_key.extractable());
DCHECK_EQ(state->extractable, state->private_key.extractable());
- DCHECK_EQ(state->usage_mask, state->public_key.usages());
- DCHECK_EQ(state->usage_mask, state->private_key.usages());
}
} else {
blink::WebCryptoKey* key = &state->public_key;
« no previous file with comments | « content/child/webcrypto/status.cc ('k') | content/child/webcrypto/webcrypto_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698