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

Unified Diff: crypto/hmac_win.cc

Issue 7972024: Update SHA1_LENGTH -> kSHA1Length to match previous change to SHA256_LENGTH. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 months 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
Index: crypto/hmac_win.cc
===================================================================
--- crypto/hmac_win.cc (revision 102606)
+++ crypto/hmac_win.cc (working copy)
@@ -12,6 +12,7 @@
#include "base/logging.h"
#include "crypto/scoped_capi_types.h"
+#include "crypto/sha2.h"
wtc 2011/09/24 01:39:41 BUG(kind of): Please also undo the changes in this
#include "crypto/third_party/nss/blapi.h"
#include "crypto/third_party/nss/sha256.h"
@@ -39,15 +40,15 @@
if (key_len > SHA256_BLOCK_SIZE) {
SHA256_Begin(&ctx);
SHA256_Update(&ctx, key, key_len);
- SHA256_End(&ctx, key0, NULL, SHA256_LENGTH);
- memset(key0 + SHA256_LENGTH, 0, SHA256_BLOCK_SIZE - SHA256_LENGTH);
+ SHA256_End(&ctx, key0, NULL, kSHA256Length);
+ memset(key0 + kSHA256Length, 0, SHA256_BLOCK_SIZE - kSHA256Length);
} else {
memcpy(key0, key, key_len);
memset(key0 + key_len, 0, SHA256_BLOCK_SIZE - key_len);
}
unsigned char padded_key[SHA256_BLOCK_SIZE];
- unsigned char inner_hash[SHA256_LENGTH];
+ unsigned char inner_hash[kSHA256Length];
// XOR key0 with ipad.
for (int i = 0; i < SHA256_BLOCK_SIZE; ++i)
@@ -57,7 +58,7 @@
SHA256_Begin(&ctx);
SHA256_Update(&ctx, padded_key, SHA256_BLOCK_SIZE);
SHA256_Update(&ctx, text, text_len);
- SHA256_End(&ctx, inner_hash, NULL, SHA256_LENGTH);
+ SHA256_End(&ctx, inner_hash, NULL, kSHA256Length);
// XOR key0 with opad.
for (int i = 0; i < SHA256_BLOCK_SIZE; ++i)
@@ -66,7 +67,7 @@
// Compute the outer hash.
SHA256_Begin(&ctx);
SHA256_Update(&ctx, padded_key, SHA256_BLOCK_SIZE);
- SHA256_Update(&ctx, inner_hash, SHA256_LENGTH);
+ SHA256_Update(&ctx, inner_hash, kSHA256Length);
SHA256_End(&ctx, output, NULL, output_len);
}
@@ -103,7 +104,7 @@
}
if (hash_alg_ == SHA256) {
- if (key_length < SHA256_LENGTH / 2)
+ if (key_length < kSHA256Length / 2)
return false; // Key is too short.
plat_->raw_key_.assign(key, key + key_length);
return true;

Powered by Google App Engine
This is Rietveld 408576698