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

Unified Diff: crypto/hmac_openssl.cc

Issue 11419270: Use size_t as the type of key_length and digest_length arguments of HMAC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix compilation errors Created 8 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 | « crypto/hmac_nss.cc ('k') | crypto/hmac_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/hmac_openssl.cc
===================================================================
--- crypto/hmac_openssl.cc (revision 170598)
+++ crypto/hmac_openssl.cc (working copy)
@@ -26,7 +26,7 @@
DCHECK(hash_alg_ == SHA1 || hash_alg_ == SHA256);
}
-bool HMAC::Init(const unsigned char* key, int key_length) {
+bool HMAC::Init(const unsigned char* key, size_t key_length) {
// Init must not be called more than once on the same HMAC object.
DCHECK(plat_->key.empty());
@@ -42,8 +42,8 @@
bool HMAC::Sign(const base::StringPiece& data,
unsigned char* digest,
- int digest_length) const {
- DCHECK_GE(digest_length, 0);
+ size_t digest_length) const {
+ DCHECK_NE(digest_length, 0u);
agl 2012/12/03 14:48:01 This change causes digest_length==0 to be rejected
DCHECK(!plat_->key.empty()); // Init must be called before Sign.
ScopedOpenSSLSafeSizeBuffer<EVP_MAX_MD_SIZE> result(digest, digest_length);
« no previous file with comments | « crypto/hmac_nss.cc ('k') | crypto/hmac_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698