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_openssl.h" | 5 #include "crypto/aead_openssl.h" |
6 | 6 |
7 #if defined(USE_OPENSSL) | 7 #if defined(USE_OPENSSL) |
8 | 8 |
9 #include <openssl/aes.h> | |
10 #include <openssl/evp.h> | |
11 #include <string> | 9 #include <string> |
12 | 10 |
13 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
14 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
15 #include "crypto/openssl_util.h" | 13 #include "crypto/openssl_util.h" |
| 14 #include "third_party/boringssl/src/include/openssl/aead.h" |
16 | 15 |
17 namespace crypto { | 16 namespace crypto { |
18 | 17 |
19 Aead::Aead(AeadAlgorithm algorithm) : key_(nullptr) { | 18 Aead::Aead(AeadAlgorithm algorithm) : key_(nullptr) { |
20 EnsureOpenSSLInit(); | 19 EnsureOpenSSLInit(); |
21 switch (algorithm) { | 20 switch (algorithm) { |
22 case AES_128_CTR_HMAC_SHA256: | 21 case AES_128_CTR_HMAC_SHA256: |
23 aead_ = EVP_aead_aes_128_ctr_hmac_sha256(); | 22 aead_ = EVP_aead_aes_128_ctr_hmac_sha256(); |
24 break; | 23 break; |
25 } | 24 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 return EVP_AEAD_key_length(aead_); | 115 return EVP_AEAD_key_length(aead_); |
117 } | 116 } |
118 | 117 |
119 size_t Aead::NonceLength() const { | 118 size_t Aead::NonceLength() const { |
120 return EVP_AEAD_nonce_length(aead_); | 119 return EVP_AEAD_nonce_length(aead_); |
121 } | 120 } |
122 | 121 |
123 } // namespace | 122 } // namespace |
124 | 123 |
125 #endif | 124 #endif |
OLD | NEW |