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 "content/child/webcrypto/algorithm_dispatch.h" | 5 #include "content/child/webcrypto/algorithm_dispatch.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/child/webcrypto/algorithm_implementation.h" | 8 #include "content/child/webcrypto/algorithm_implementation.h" |
9 #include "content/child/webcrypto/algorithm_registry.h" | 9 #include "content/child/webcrypto/algorithm_registry.h" |
10 #include "content/child/webcrypto/crypto_data.h" | 10 #include "content/child/webcrypto/crypto_data.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 key = &result->secret_key(); | 110 key = &result->secret_key(); |
111 if (result->type() == GenerateKeyResult::TYPE_PUBLIC_PRIVATE_KEY_PAIR) | 111 if (result->type() == GenerateKeyResult::TYPE_PUBLIC_PRIVATE_KEY_PAIR) |
112 key = &result->private_key(); | 112 key = &result->private_key(); |
113 if (key == NULL) | 113 if (key == NULL) |
114 return Status::ErrorUnexpected(); | 114 return Status::ErrorUnexpected(); |
115 | 115 |
116 // This should only fail if an algorithm is implemented incorrectly and | 116 // This should only fail if an algorithm is implemented incorrectly and |
117 // does not do its own check of the usages. | 117 // does not do its own check of the usages. |
118 if (key->usages() == 0) { | 118 if (key->usages() == 0) { |
119 DCHECK(false) << "Key usages for generateKey() must not be empty"; | 119 DCHECK(false) << "Key usages for generateKey() must not be empty"; |
120 return Status::ErrorCreateKeyEmptyUsages(); | 120 return Status::ErrorKeyEmptyUsages(); |
121 } | 121 } |
122 return status; | 122 return status; |
123 } | 123 } |
124 | 124 |
125 Status ImportKey(blink::WebCryptoKeyFormat format, | 125 Status ImportKey(blink::WebCryptoKeyFormat format, |
126 const CryptoData& key_data, | 126 const CryptoData& key_data, |
127 const blink::WebCryptoAlgorithm& algorithm, | 127 const blink::WebCryptoAlgorithm& algorithm, |
128 bool extractable, | 128 bool extractable, |
129 blink::WebCryptoKeyUsageMask usages, | 129 blink::WebCryptoKeyUsageMask usages, |
130 blink::WebCryptoKey* key) { | 130 blink::WebCryptoKey* key) { |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 return false; | 338 return false; |
339 | 339 |
340 status = impl->DeserializeKeyForClone(algorithm, type, extractable, usages, | 340 status = impl->DeserializeKeyForClone(algorithm, type, extractable, usages, |
341 key_data, key); | 341 key_data, key); |
342 return status.IsSuccess(); | 342 return status.IsSuccess(); |
343 } | 343 } |
344 | 344 |
345 } // namespace webcrypto | 345 } // namespace webcrypto |
346 | 346 |
347 } // namespace content | 347 } // namespace content |
OLD | NEW |