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

Side by Side Diff: crypto/encryptor.h

Issue 2218903002: Remove unused private functions from Encryptor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | crypto/encryptor.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
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 // Sets the counter value when in CTR mode. Currently only 128-bits 78 // Sets the counter value when in CTR mode. Currently only 128-bits
79 // counter value is supported. 79 // counter value is supported.
80 // 80 //
81 // Returns true only if update was successful. 81 // Returns true only if update was successful.
82 bool SetCounter(const base::StringPiece& counter); 82 bool SetCounter(const base::StringPiece& counter);
83 83
84 // TODO(albertb): Support streaming encryption. 84 // TODO(albertb): Support streaming encryption.
85 85
86 private: 86 private:
87 // Generates a mask using |counter_| to be used for encryption in CTR mode.
88 // Resulting mask will be written to |mask| with |mask_len| bytes.
89 //
90 // Make sure there's enough space in mask when calling this method.
91 // Reserve at least |plaintext_len| + 16 bytes for |mask|.
92 //
93 // The generated mask will always have at least |plaintext_len| bytes and
94 // will be a multiple of the counter length.
95 //
96 // This method is used only in CTR mode.
97 //
98 // Returns false if this call failed.
99 bool GenerateCounterMask(size_t plaintext_len,
100 uint8_t* mask,
101 size_t* mask_len);
102
103 // Mask the |plaintext| message using |mask|. The output will be written to
104 // |ciphertext|. |ciphertext| must have at least |plaintext_len| bytes.
105 void MaskMessage(const void* plaintext,
106 size_t plaintext_len,
107 const void* mask,
108 void* ciphertext) const;
109
110 SymmetricKey* key_; 87 SymmetricKey* key_;
111 Mode mode_; 88 Mode mode_;
112 std::unique_ptr<Counter> counter_; 89 std::unique_ptr<Counter> counter_;
113 90
114 bool Crypt(bool do_encrypt, // Pass true to encrypt, false to decrypt. 91 bool Crypt(bool do_encrypt, // Pass true to encrypt, false to decrypt.
115 const base::StringPiece& input, 92 const base::StringPiece& input,
116 std::string* output); 93 std::string* output);
117 bool CryptCTR(bool do_encrypt, 94 bool CryptCTR(bool do_encrypt,
118 const base::StringPiece& input, 95 const base::StringPiece& input,
119 std::string* output); 96 std::string* output);
120 std::string iv_; 97 std::string iv_;
121 }; 98 };
122 99
123 } // namespace crypto 100 } // namespace crypto
124 101
125 #endif // CRYPTO_ENCRYPTOR_H_ 102 #endif // CRYPTO_ENCRYPTOR_H_
OLDNEW
« no previous file with comments | « no previous file | crypto/encryptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698