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

Side by Side Diff: content/child/webcrypto/webcrypto_util.cc

Issue 698363002: webcrypto: Add ECDSA algorithm (chromium-side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@extract_more
Patch Set: sigh, more android pedantry Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « content/child/webcrypto/webcrypto_util.h ('k') | content/content_child.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/webcrypto/webcrypto_util.h" 5 #include "content/child/webcrypto/webcrypto_util.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 130 }
131 131
132 blink::WebCryptoAlgorithm CreateRsaHashedImportAlgorithm( 132 blink::WebCryptoAlgorithm CreateRsaHashedImportAlgorithm(
133 blink::WebCryptoAlgorithmId id, 133 blink::WebCryptoAlgorithmId id,
134 blink::WebCryptoAlgorithmId hash_id) { 134 blink::WebCryptoAlgorithmId hash_id) {
135 DCHECK(blink::WebCryptoAlgorithm::isHash(hash_id)); 135 DCHECK(blink::WebCryptoAlgorithm::isHash(hash_id));
136 return blink::WebCryptoAlgorithm::adoptParamsAndCreate( 136 return blink::WebCryptoAlgorithm::adoptParamsAndCreate(
137 id, new blink::WebCryptoRsaHashedImportParams(CreateAlgorithm(hash_id))); 137 id, new blink::WebCryptoRsaHashedImportParams(CreateAlgorithm(hash_id)));
138 } 138 }
139 139
140 blink::WebCryptoAlgorithm CreateEcImportAlgorithm(
141 blink::WebCryptoAlgorithmId id,
142 blink::WebCryptoNamedCurve named_curve) {
143 return blink::WebCryptoAlgorithm::adoptParamsAndCreate(
144 id, new blink::WebCryptoEcKeyImportParams(named_curve));
145 }
146
140 bool ContainsKeyUsages(blink::WebCryptoKeyUsageMask a, 147 bool ContainsKeyUsages(blink::WebCryptoKeyUsageMask a,
141 blink::WebCryptoKeyUsageMask b) { 148 blink::WebCryptoKeyUsageMask b) {
142 return (a & b) == b; 149 return (a & b) == b;
143 } 150 }
144 151
145 // TODO(eroman): Move this helper to WebCryptoKey. 152 // TODO(eroman): Move this helper to WebCryptoKey.
146 bool KeyUsageAllows(const blink::WebCryptoKey& key, 153 bool KeyUsageAllows(const blink::WebCryptoKey& key,
147 const blink::WebCryptoKeyUsage usage) { 154 const blink::WebCryptoKeyUsage usage) {
148 return ((key.usages() & usage) != 0); 155 return ((key.usages() & usage) != 0);
149 } 156 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // avoid feeding OpenSSL data that will hang use a whitelist. 257 // avoid feeding OpenSSL data that will hang use a whitelist.
251 if (*public_exponent != 3 && *public_exponent != 65537) 258 if (*public_exponent != 3 && *public_exponent != 65537)
252 return Status::ErrorGenerateKeyPublicExponent(); 259 return Status::ErrorGenerateKeyPublicExponent();
253 260
254 return Status::Success(); 261 return Status::Success();
255 } 262 }
256 263
257 } // namespace webcrypto 264 } // namespace webcrypto
258 265
259 } // namespace content 266 } // namespace content
OLDNEW
« no previous file with comments | « content/child/webcrypto/webcrypto_util.h ('k') | content/content_child.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698