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

Side by Side Diff: components/webcrypto/algorithm_dispatch.cc

Issue 1355923002: [refactor] Misc post-NSS WebCrypto cleanups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@util_split
Patch Set: add an explicit size_t --> unsigned cast Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/webcrypto/algorithms/aes.cc » ('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 "components/webcrypto/algorithm_dispatch.h" 5 #include "components/webcrypto/algorithm_dispatch.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "components/webcrypto/algorithm_implementation.h" 8 #include "components/webcrypto/algorithm_implementation.h"
9 #include "components/webcrypto/algorithm_implementations.h" 9 #include "components/webcrypto/algorithm_implementations.h"
10 #include "components/webcrypto/algorithm_registry.h" 10 #include "components/webcrypto/algorithm_registry.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 std::vector<uint8_t> buffer; 224 std::vector<uint8_t> buffer;
225 status = DecryptDontCheckKeyUsage(wrapping_algorithm, wrapping_key, 225 status = DecryptDontCheckKeyUsage(wrapping_algorithm, wrapping_key,
226 wrapped_key_data, &buffer); 226 wrapped_key_data, &buffer);
227 if (status.IsError()) 227 if (status.IsError())
228 return status; 228 return status;
229 229
230 // NOTE that returning the details of ImportKey() failures may leak 230 // NOTE that returning the details of ImportKey() failures may leak
231 // information about the plaintext of the encrypted key (for instance the JWK 231 // information about the plaintext of the encrypted key (for instance the JWK
232 // key_ops). As long as the ImportKey error messages don't describe actual 232 // key_ops). As long as the ImportKey error messages don't describe actual
233 // key bytes however this should be OK. For more discussion see 233 // key bytes however this should be OK. For more discussion see
234 // http://crubg.com/372040 234 // http://crbug.com/372040
235 return ImportKey(format, CryptoData(buffer), algorithm, extractable, usages, 235 return ImportKey(format, CryptoData(buffer), algorithm, extractable, usages,
236 key); 236 key);
237 } 237 }
238 238
239 Status DeriveBits(const blink::WebCryptoAlgorithm& algorithm, 239 Status DeriveBits(const blink::WebCryptoAlgorithm& algorithm,
240 const blink::WebCryptoKey& base_key, 240 const blink::WebCryptoKey& base_key,
241 unsigned int length_bits, 241 unsigned int length_bits,
242 std::vector<uint8_t>* derived_bytes) { 242 std::vector<uint8_t>* derived_bytes) {
243 if (!base_key.keyUsageAllows(blink::WebCryptoKeyUsageDeriveBits)) 243 if (!base_key.keyUsageAllows(blink::WebCryptoKeyUsageDeriveBits))
244 return Status::ErrorUnexpected(); 244 return Status::ErrorUnexpected();
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 Status status = GetAlgorithmImplementation(algorithm.id(), &impl); 335 Status status = GetAlgorithmImplementation(algorithm.id(), &impl);
336 if (status.IsError()) 336 if (status.IsError())
337 return false; 337 return false;
338 338
339 status = impl->DeserializeKeyForClone(algorithm, type, extractable, usages, 339 status = impl->DeserializeKeyForClone(algorithm, type, extractable, usages,
340 key_data, key); 340 key_data, key);
341 return status.IsSuccess(); 341 return status.IsSuccess();
342 } 342 }
343 343
344 } // namespace webcrypto 344 } // namespace webcrypto
OLDNEW
« no previous file with comments | « no previous file | components/webcrypto/algorithms/aes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698