OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/encryptor.h" | 5 #include "crypto/encryptor.h" |
6 | 6 |
7 #include <openssl/aes.h> | 7 #include <openssl/aes.h> |
8 #include <openssl/evp.h> | 8 #include <openssl/evp.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "crypto/openssl_util.h" | 12 #include "crypto/openssl_util.h" |
13 #include "crypto/symmetric_key.h" | 13 #include "crypto/symmetric_key.h" |
14 | 14 |
15 namespace crypto { | 15 namespace crypto { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 const EVP_CIPHER* GetCipherForKey(SymmetricKey* key) { | 19 const EVP_CIPHER* GetCipherForKey(SymmetricKey* key) { |
20 switch (key->key().length()) { | 20 switch (key->key().length()) { |
21 case 16: return EVP_aes_128_cbc(); | 21 case 16: return EVP_aes_128_cbc(); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 out_len += tail_len; | 127 out_len += tail_len; |
128 DCHECK_LE(out_len, static_cast<int>(output_size)); | 128 DCHECK_LE(out_len, static_cast<int>(output_size)); |
129 result.resize(out_len); | 129 result.resize(out_len); |
130 | 130 |
131 output->swap(result); | 131 output->swap(result); |
132 return true; | 132 return true; |
133 } | 133 } |
134 | 134 |
135 } // namespace crypto | 135 } // namespace crypto |
OLD | NEW |