summaryrefslogtreecommitdiffstats
path: root/crypto/hmac.h
diff options
context:
space:
mode:
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_;