| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CRYPTO_ENCRYPTOR_H_ | 5 #ifndef CRYPTO_ENCRYPTOR_H_ |
| 6 #define CRYPTO_ENCRYPTOR_H_ | 6 #define CRYPTO_ENCRYPTOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "crypto/crypto_export.h" | 14 #include "crypto/crypto_export.h" |
| 15 | 15 |
| 16 #if defined(USE_NSS_CERTS) || \ | 16 #if !defined(USE_OPENSSL) |
| 17 (!defined(USE_OPENSSL) && (defined(OS_WIN) || defined(OS_MACOSX))) | |
| 18 #include "crypto/scoped_nss_types.h" | 17 #include "crypto/scoped_nss_types.h" |
| 19 #endif | 18 #endif |
| 20 | 19 |
| 21 namespace crypto { | 20 namespace crypto { |
| 22 | 21 |
| 23 class SymmetricKey; | 22 class SymmetricKey; |
| 24 | 23 |
| 25 class CRYPTO_EXPORT Encryptor { | 24 class CRYPTO_EXPORT Encryptor { |
| 26 public: | 25 public: |
| 27 enum Mode { | 26 enum Mode { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 scoped_ptr<Counter> counter_; | 114 scoped_ptr<Counter> counter_; |
| 116 | 115 |
| 117 #if defined(USE_OPENSSL) | 116 #if defined(USE_OPENSSL) |
| 118 bool Crypt(bool do_encrypt, // Pass true to encrypt, false to decrypt. | 117 bool Crypt(bool do_encrypt, // Pass true to encrypt, false to decrypt. |
| 119 const base::StringPiece& input, | 118 const base::StringPiece& input, |
| 120 std::string* output); | 119 std::string* output); |
| 121 bool CryptCTR(bool do_encrypt, | 120 bool CryptCTR(bool do_encrypt, |
| 122 const base::StringPiece& input, | 121 const base::StringPiece& input, |
| 123 std::string* output); | 122 std::string* output); |
| 124 std::string iv_; | 123 std::string iv_; |
| 125 #elif defined(USE_NSS_CERTS) || defined(OS_WIN) || defined(OS_MACOSX) | 124 #else |
| 126 bool Crypt(PK11Context* context, | 125 bool Crypt(PK11Context* context, |
| 127 const base::StringPiece& input, | 126 const base::StringPiece& input, |
| 128 std::string* output); | 127 std::string* output); |
| 129 bool CryptCTR(PK11Context* context, | 128 bool CryptCTR(PK11Context* context, |
| 130 const base::StringPiece& input, | 129 const base::StringPiece& input, |
| 131 std::string* output); | 130 std::string* output); |
| 132 ScopedSECItem param_; | 131 ScopedSECItem param_; |
| 133 #endif | 132 #endif |
| 134 }; | 133 }; |
| 135 | 134 |
| 136 } // namespace crypto | 135 } // namespace crypto |
| 137 | 136 |
| 138 #endif // CRYPTO_ENCRYPTOR_H_ | 137 #endif // CRYPTO_ENCRYPTOR_H_ |
| OLD | NEW |