Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Side by Side Diff: crypto/encryptor.h

Issue 1870233002: Convert crypto to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « crypto/ec_signature_creator_unittest.cc ('k') | crypto/encryptor_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory>
11 #include <string> 12 #include <string>
12 13
13 #include "base/memory/scoped_ptr.h"
14 #include "base/strings/string_piece.h" 14 #include "base/strings/string_piece.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "crypto/crypto_export.h" 16 #include "crypto/crypto_export.h"
17 17
18 #if !defined(USE_OPENSSL) 18 #if !defined(USE_OPENSSL)
19 #include "crypto/scoped_nss_types.h" 19 #include "crypto/scoped_nss_types.h"
20 #endif 20 #endif
21 21
22 namespace crypto { 22 namespace crypto {
23 23
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 // Mask the |plaintext| message using |mask|. The output will be written to 107 // Mask the |plaintext| message using |mask|. The output will be written to
108 // |ciphertext|. |ciphertext| must have at least |plaintext_len| bytes. 108 // |ciphertext|. |ciphertext| must have at least |plaintext_len| bytes.
109 void MaskMessage(const void* plaintext, 109 void MaskMessage(const void* plaintext,
110 size_t plaintext_len, 110 size_t plaintext_len,
111 const void* mask, 111 const void* mask,
112 void* ciphertext) const; 112 void* ciphertext) const;
113 113
114 SymmetricKey* key_; 114 SymmetricKey* key_;
115 Mode mode_; 115 Mode mode_;
116 scoped_ptr<Counter> counter_; 116 std::unique_ptr<Counter> counter_;
117 117
118 #if defined(USE_OPENSSL) 118 #if defined(USE_OPENSSL)
119 bool Crypt(bool do_encrypt, // Pass true to encrypt, false to decrypt. 119 bool Crypt(bool do_encrypt, // Pass true to encrypt, false to decrypt.
120 const base::StringPiece& input, 120 const base::StringPiece& input,
121 std::string* output); 121 std::string* output);
122 bool CryptCTR(bool do_encrypt, 122 bool CryptCTR(bool do_encrypt,
123 const base::StringPiece& input, 123 const base::StringPiece& input,
124 std::string* output); 124 std::string* output);
125 std::string iv_; 125 std::string iv_;
126 #else 126 #else
127 bool Crypt(PK11Context* context, 127 bool Crypt(PK11Context* context,
128 const base::StringPiece& input, 128 const base::StringPiece& input,
129 std::string* output); 129 std::string* output);
130 bool CryptCTR(PK11Context* context, 130 bool CryptCTR(PK11Context* context,
131 const base::StringPiece& input, 131 const base::StringPiece& input,
132 std::string* output); 132 std::string* output);
133 ScopedSECItem param_; 133 ScopedSECItem param_;
134 #endif 134 #endif
135 }; 135 };
136 136
137 } // namespace crypto 137 } // namespace crypto
138 138
139 #endif // CRYPTO_ENCRYPTOR_H_ 139 #endif // CRYPTO_ENCRYPTOR_H_
OLDNEW
« no previous file with comments | « crypto/ec_signature_creator_unittest.cc ('k') | crypto/encryptor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698