OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "crypto/aead.h" | 5 #include "crypto/aead.h" |
6 | 6 |
7 #include <openssl/aes.h> | |
8 #include <openssl/evp.h> | |
9 #include <stddef.h> | 7 #include <stddef.h> |
10 #include <stdint.h> | 8 #include <stdint.h> |
11 #include <string> | 9 #include <string> |
12 | 10 |
13 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
14 #include "crypto/openssl_util.h" | 12 #include "crypto/openssl_util.h" |
| 13 #include "third_party/boringssl/src/include/openssl/aes.h" |
| 14 #include "third_party/boringssl/src/include/openssl/evp.h" |
15 | 15 |
16 namespace crypto { | 16 namespace crypto { |
17 | 17 |
18 Aead::Aead(AeadAlgorithm algorithm) : key_(nullptr) { | 18 Aead::Aead(AeadAlgorithm algorithm) : key_(nullptr) { |
19 EnsureOpenSSLInit(); | 19 EnsureOpenSSLInit(); |
20 switch (algorithm) { | 20 switch (algorithm) { |
21 case AES_128_CTR_HMAC_SHA256: | 21 case AES_128_CTR_HMAC_SHA256: |
22 aead_ = EVP_aead_aes_128_ctr_hmac_sha256(); | 22 aead_ = EVP_aead_aes_128_ctr_hmac_sha256(); |
23 break; | 23 break; |
24 } | 24 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 size_t Aead::KeyLength() const { | 115 size_t Aead::KeyLength() const { |
116 return EVP_AEAD_key_length(aead_); | 116 return EVP_AEAD_key_length(aead_); |
117 } | 117 } |
118 | 118 |
119 size_t Aead::NonceLength() const { | 119 size_t Aead::NonceLength() const { |
120 return EVP_AEAD_nonce_length(aead_); | 120 return EVP_AEAD_nonce_length(aead_); |
121 } | 121 } |
122 | 122 |
123 } // namespace | 123 } // namespace |
OLD | NEW |