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

Unified Diff: base/hmac_unittest.cc

Issue 88062: Separate the initialization code in the constructor of HMAC class into Init f... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 8 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
« no previous file with comments | « base/hmac_nss.cc ('k') | base/hmac_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/hmac_unittest.cc
===================================================================
--- base/hmac_unittest.cc (revision 15317)
+++ base/hmac_unittest.cc (working copy)
@@ -51,7 +51,8 @@
std::string message_data(kMessage);
- base::HMAC hmac(base::HMAC::SHA1, kClientKey, kKeySize);
+ base::HMAC hmac(base::HMAC::SHA1);
+ ASSERT_TRUE(hmac.Init(kClientKey, kKeySize));
unsigned char calculated_hmac[kDigestSize];
EXPECT_TRUE(hmac.Sign(message_data, calculated_hmac, kDigestSize));
@@ -119,9 +120,9 @@
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
- base::HMAC hmac(base::HMAC::SHA1,
- reinterpret_cast<const unsigned char*>(cases[i].key),
- cases[i].key_len);
+ base::HMAC hmac(base::HMAC::SHA1);
+ ASSERT_TRUE(hmac.Init(reinterpret_cast<const unsigned char*>(cases[i].key),
+ cases[i].key_len));
std::string data_string(cases[i].data, cases[i].data_len);
unsigned char digest[kDigestSize];
EXPECT_TRUE(hmac.Sign(data_string, digest, kDigestSize));
@@ -152,8 +153,8 @@
"\xBB\xFF\x1A\x91" }
};
- base::HMAC hmac(base::HMAC::SHA1,
- reinterpret_cast<const unsigned char*>(key), key_len);
+ base::HMAC hmac(base::HMAC::SHA1);
+ ASSERT_TRUE(hmac.Init(reinterpret_cast<const unsigned char*>(key), key_len));
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
std::string data_string(cases[i].data, cases[i].data_len);
unsigned char digest[kDigestSize];
« no previous file with comments | « base/hmac_nss.cc ('k') | base/hmac_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698