Index: crypto/openpgp_symmetric_encryption.cc |
=================================================================== |
--- crypto/openpgp_symmetric_encryption.cc (revision 102606) |
+++ crypto/openpgp_symmetric_encryption.cc (working copy) |
@@ -13,6 +13,7 @@ |
#include "base/logging.h" |
#include "base/rand_util.h" |
+#include "base/sha1.h" |
wtc
2011/09/24 01:39:41
BUG: please undo the changes in this file. This f
|
#include "crypto/scoped_nss_types.h" |
#include "crypto/nss_util.h" |
@@ -543,7 +544,7 @@ |
unsigned out_used = 2; |
const size_t plaintext_size = reader->size(); |
- if (plaintext_size < SHA1_LENGTH + 2) { |
+ if (plaintext_size < kSHA1Length + 2) { |
// Too small to contain an MDC trailer. |
return false; |
} |
@@ -568,27 +569,27 @@ |
// The plaintext should be followed by a Modification Detection Code |
// packet. This packet is specified such that the header is always |
// serialized as exactly these two bytes: |
- if (plaintext[plaintext_size - SHA1_LENGTH - 2] != 0xd3 || |
- plaintext[plaintext_size - SHA1_LENGTH - 1] != 0x14) { |
+ if (plaintext[plaintext_size - kSHA1Length - 2] != 0xd3 || |
+ plaintext[plaintext_size - kSHA1Length - 1] != 0x14) { |
return false; |
} |
HASHContext* hash_context = HASH_Create(HASH_AlgSHA1); |
HASH_Begin(hash_context); |
HASH_Update(hash_context, prefix_copy, sizeof(prefix_copy)); |
- HASH_Update(hash_context, plaintext, plaintext_size - SHA1_LENGTH); |
- uint8 digest[SHA1_LENGTH]; |
+ HASH_Update(hash_context, plaintext, plaintext_size - kSHA1Length); |
+ uint8 digest[kSHA1Length]; |
unsigned num_hash_bytes; |
HASH_End(hash_context, digest, &num_hash_bytes, sizeof(digest)); |
HASH_Destroy(hash_context); |
- if (memcmp(digest, &plaintext[plaintext_size - SHA1_LENGTH], |
- SHA1_LENGTH) != 0) { |
+ if (memcmp(digest, &plaintext[plaintext_size - kSHA1Length], |
+ kSHA1Length) != 0) { |
return false; |
} |
*out_plaintext = base::StringPiece(reinterpret_cast<char*>(plaintext), |
- plaintext_size - SHA1_LENGTH); |
+ plaintext_size - kSHA1Length); |
return true; |
} |
@@ -736,7 +737,7 @@ |
HASH_Update(hash_context, iv, sizeof(iv)); |
HASH_Update(hash_context, iv + kBlockSize - 2, 2); |
HASH_Update(hash_context, plaintext_copy.data(), plaintext_copy.size()); |
- uint8 digest[SHA1_LENGTH]; |
+ uint8 digest[kSHA1Length]; |
unsigned num_hash_bytes; |
HASH_End(hash_context, digest, &num_hash_bytes, sizeof(digest)); |
HASH_Destroy(hash_context); |