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

Unified Diff: crypto/encryptor.h

Issue 8511050: Unify the error checking of crypto::Encryptor and add WARN_UNUSED_RESULT to prevent misuse. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/password_manager/encryptor_unittest.cc ('k') | crypto/encryptor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/encryptor.h
diff --git a/crypto/encryptor.h b/crypto/encryptor.h
index 6b236199e75dcbea6532c881388315f7bfae6580..5e919ca5e7e3c1ce650e0e689d1ae4809f8c2082 100644
--- a/crypto/encryptor.h
+++ b/crypto/encryptor.h
@@ -9,6 +9,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/string_piece.h"
#include "build/build_config.h"
@@ -39,7 +40,7 @@ class CRYPTO_EXPORT Encryptor {
~Counter();
// Increment the counter value.
- bool Increment();
+ bool Increment() WARN_UNUSED_RESULT;
// Write the content of the counter to |buf|. |buf| should have enough
// space for |GetLengthInBytes()|.
@@ -63,20 +64,24 @@ class CRYPTO_EXPORT Encryptor {
//
// If |mode| is CBC, |iv| must not be empty; if it is CTR, then |iv| must be
// empty.
- bool Init(SymmetricKey* key, Mode mode, const base::StringPiece& iv);
+ bool Init(SymmetricKey* key,
+ Mode mode,
+ const base::StringPiece& iv) WARN_UNUSED_RESULT;
// Encrypts |plaintext| into |ciphertext|. |plaintext| may only be empty if
// the mode is CBC.
- bool Encrypt(const base::StringPiece& plaintext, std::string* ciphertext);
+ bool Encrypt(const base::StringPiece& plaintext,
+ std::string* ciphertext) WARN_UNUSED_RESULT;
// Decrypts |ciphertext| into |plaintext|. |ciphertext| must not be empty.
- bool Decrypt(const base::StringPiece& ciphertext, std::string* plaintext);
+ bool Decrypt(const base::StringPiece& ciphertext,
+ std::string* plaintext) WARN_UNUSED_RESULT;
// Sets the counter value when in CTR mode. Currently only 128-bits
// counter value is supported.
//
// Returns true only if update was successful.
- bool SetCounter(const base::StringPiece& counter);
+ bool SetCounter(const base::StringPiece& counter) WARN_UNUSED_RESULT;
// TODO(albertb): Support streaming encryption.
« no previous file with comments | « chrome/browser/password_manager/encryptor_unittest.cc ('k') | crypto/encryptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698