| 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 <openssl/aes.h> | |
| 6 #include <openssl/bn.h> | |
| 7 #include <openssl/cipher.h> | |
| 8 #include <stddef.h> | 5 #include <stddef.h> |
| 9 #include <stdint.h> | 6 #include <stdint.h> |
| 10 #include <string.h> | 7 #include <string.h> |
| 11 | 8 |
| 12 #include "base/logging.h" | 9 #include "base/logging.h" |
| 13 #include "base/macros.h" | 10 #include "base/macros.h" |
| 14 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 15 #include "base/numerics/safe_math.h" | 12 #include "base/numerics/safe_math.h" |
| 16 #include "components/webcrypto/algorithms/aes.h" | 13 #include "components/webcrypto/algorithms/aes.h" |
| 17 #include "components/webcrypto/algorithms/util.h" | 14 #include "components/webcrypto/algorithms/util.h" |
| 18 #include "components/webcrypto/blink_key_handle.h" | 15 #include "components/webcrypto/blink_key_handle.h" |
| 19 #include "components/webcrypto/crypto_data.h" | 16 #include "components/webcrypto/crypto_data.h" |
| 20 #include "components/webcrypto/status.h" | 17 #include "components/webcrypto/status.h" |
| 21 #include "crypto/openssl_util.h" | 18 #include "crypto/openssl_util.h" |
| 22 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" | 19 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" |
| 20 #include "third_party/boringssl/src/include/openssl/aes.h" |
| 21 #include "third_party/boringssl/src/include/openssl/bn.h" |
| 22 #include "third_party/boringssl/src/include/openssl/cipher.h" |
| 23 | 23 |
| 24 namespace webcrypto { | 24 namespace webcrypto { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 const EVP_CIPHER* GetAESCipherByKeyLength(size_t key_length_bytes) { | 28 const EVP_CIPHER* GetAESCipherByKeyLength(size_t key_length_bytes) { |
| 29 // 192-bit AES is intentionally unsupported (http://crbug.com/533699). | 29 // 192-bit AES is intentionally unsupported (http://crbug.com/533699). |
| 30 switch (key_length_bytes) { | 30 switch (key_length_bytes) { |
| 31 case 16: | 31 case 16: |
| 32 return EVP_aes_128_ctr(); | 32 return EVP_aes_128_ctr(); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 } | 254 } |
| 255 }; | 255 }; |
| 256 | 256 |
| 257 } // namespace | 257 } // namespace |
| 258 | 258 |
| 259 std::unique_ptr<AlgorithmImplementation> CreateAesCtrImplementation() { | 259 std::unique_ptr<AlgorithmImplementation> CreateAesCtrImplementation() { |
| 260 return base::WrapUnique(new AesCtrImplementation); | 260 return base::WrapUnique(new AesCtrImplementation); |
| 261 } | 261 } |
| 262 | 262 |
| 263 } // namespace webcrypto | 263 } // namespace webcrypto |
| OLD | NEW |