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

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: Created 9 years, 1 month 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 | « no previous file | crypto/encryptor.cc » ('j') | crypto/encryptor_mac.cc » ('J')
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 a40726673a43e5f02e1d2ef4f25fcb848a3341f7..0d52098b7d49e53f887701df275e45745c931f14 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()|.
@@ -62,19 +63,22 @@ class CRYPTO_EXPORT Encryptor {
// key or the initialization vector cannot be used.
//
// When |mode| is CTR then |iv| should 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|.
- 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|.
- 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 | « no previous file | crypto/encryptor.cc » ('j') | crypto/encryptor_mac.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698