| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |