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; |