diff options
author | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-04 00:50:35 +0000 |
---|---|---|
committer | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-04 00:50:35 +0000 |
commit | 673266c4267a4bee5c8e63934d65f9accd534f42 (patch) | |
tree | 4bff6f58cddc30a7e7206fd37d9ed50f3b43bd21 /crypto/hmac.h | |
parent | 62e832e0f78a47a64d2a9e19757d89f144e04993 (diff) | |
download | chromium_src-673266c4267a4bee5c8e63934d65f9accd534f42.zip chromium_src-673266c4267a4bee5c8e63934d65f9accd534f42.tar.gz chromium_src-673266c4267a4bee5c8e63934d65f9accd534f42.tar.bz2 |
Use size_t as the type of the key_length and digest_length arguments
of HMAC::Init() and HMAC::Sign().
R=agl@chromium.org,bradnelson@chromium.org,thakis@chromium.org
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/11419270
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170852 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto/hmac.h')
-rw-r--r-- | crypto/hmac.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/crypto/hmac.h b/crypto/hmac.h index c9bae65..d527d16 100644 --- a/crypto/hmac.h +++ b/crypto/hmac.h @@ -38,7 +38,6 @@ class CRYPTO_EXPORT 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. // // NOTE: the US Federal crypto standard FIPS 198, Section 3 says: // The size of the key, K, shall be equal to or greater than L/2, where L @@ -47,7 +46,7 @@ class CRYPTO_EXPORT HMAC { // this requirement is gone. But a system crypto library may still enforce // this old requirement. If the key is shorter than this recommended value, // Init() may fail. - bool Init(const unsigned char* key, int key_length) WARN_UNUSED_RESULT; + bool Init(const unsigned char* key, size_t key_length) WARN_UNUSED_RESULT; // Initializes this instance using |key|. Call Init // only once. It returns false on the second or later calls. @@ -57,15 +56,14 @@ class CRYPTO_EXPORT HMAC { // false on the second or later calls. bool Init(const base::StringPiece& key) WARN_UNUSED_RESULT { return Init(reinterpret_cast<const unsigned char*>(key.data()), - static_cast<int>(key.size())); + key.size()); } // Calculates the HMAC for the message in |data| using the algorithm supplied // to the constructor and the key supplied to the Init method. The HMAC is // 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 WARN_UNUSED_RESULT; + size_t 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 |