summaryrefslogtreecommitdiffstats
path: root/crypto/hmac.h
diff options
context:
space:
mode:
authorrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-30 05:18:01 +0000
committerrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-30 05:18:01 +0000
commit6df5b9e3d5890b559b903c74b57cf7ab7c1b6310 (patch)
tree79b1d83dc536e153169387337c863e2a4394b555 /crypto/hmac.h
parent80ec9ba8e66350c61b8e1911f54f9d9228b58d63 (diff)
downloadchromium_src-6df5b9e3d5890b559b903c74b57cf7ab7c1b6310.zip
chromium_src-6df5b9e3d5890b559b903c74b57cf7ab7c1b6310.tar.gz
chromium_src-6df5b9e3d5890b559b903c74b57cf7ab7c1b6310.tar.bz2
Add WARN_UNUSED_RESULT to crypto/hmac.h
BUG=none TEST=none Review URL: http://codereview.chromium.org/7522014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94826 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto/hmac.h')
-rw-r--r--crypto/hmac.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/crypto/hmac.h b/crypto/hmac.h
index 73d6dc3..e52d519 100644
--- a/crypto/hmac.h
+++ b/crypto/hmac.h
@@ -10,6 +10,7 @@
#pragma once
#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/string_piece.h"
#include "crypto/crypto_api.h"
@@ -38,11 +39,11 @@ class CRYPTO_API HMAC {
// Initializes this instance using |key| of the length |key_length|. Call Init
// only once. It returns false on the second or later calls.
// TODO(abarth): key_length should be a size_t.
- bool Init(const unsigned char* key, int key_length);
+ bool Init(const unsigned char* key, int key_length) WARN_UNUSED_RESULT;
// Initializes this instance using |key|. Call Init only once. It returns
// false on the second or later calls.
- bool Init(const base::StringPiece& key) {
+ bool Init(const base::StringPiece& key) WARN_UNUSED_RESULT {
return Init(reinterpret_cast<const unsigned char*>(key.data()),
static_cast<int>(key.size()));
}
@@ -52,7 +53,7 @@ class CRYPTO_API HMAC {
// returned in |digest|, which has |digest_length| bytes of storage available.
// TODO(abarth): digest_length should be a size_t.
bool Sign(const base::StringPiece& data, unsigned char* digest,
- int digest_length) const;
+ int digest_length) const WARN_UNUSED_RESULT;
// Verifies that the HMAC for the message in |data| equals the HMAC provided
// in |digest|, using the algorithm supplied to the constructor and the key
@@ -62,12 +63,13 @@ class CRYPTO_API HMAC {
// undermine the cryptographic integrity. |digest| must be exactly
// |DigestLength()| bytes long.
bool Verify(const base::StringPiece& data,
- const base::StringPiece& digest) const;
+ const base::StringPiece& digest) const WARN_UNUSED_RESULT;
// Verifies a truncated HMAC, behaving identical to Verify(), except
// that |digest| is allowed to be smaller than |DigestLength()|.
- bool VerifyTruncated(const base::StringPiece& data,
- const base::StringPiece& digest) const;
+ bool VerifyTruncated(
+ const base::StringPiece& data,
+ const base::StringPiece& digest) const WARN_UNUSED_RESULT;
private:
HashAlgorithm hash_alg_;