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

Unified Diff: crypto/hmac.cc

Issue 8949056: This adds support for encrypted ONC import (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More Review Changes Created 8 years, 12 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
« chrome/browser/chromeos/cros/network_library.cc ('K') | « crypto/hmac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/hmac.cc
diff --git a/crypto/hmac.cc b/crypto/hmac.cc
index 9131313d9e0514d4a4794c40427213862dcd0104..39103cccfa6430c7b6983dc58ecd59a1e5dd9d49 100644
--- a/crypto/hmac.cc
+++ b/crypto/hmac.cc
@@ -8,9 +8,24 @@
#include "base/logging.h"
#include "crypto/secure_util.h"
+#include "crypto/symmetric_key.h"
namespace crypto {
+bool HMAC::Init(SymmetricKey* key) {
+ std::string raw_key;
+ bool result = key->GetRawKey(&raw_key) && Init(raw_key);
+ // Zero out key copy. This probably just gets optimized away,
kmixter1 2012/01/05 23:27:53 I don't think the stuff after fill will have any e
Greg Spencer (Chromium) 2012/01/05 23:41:06 OK, I'll do that. Why is mine different (other th
kmixter1 2012/01/06 17:55:59 I was trying to use data() to get at the actual in
+ // but one can hope. Using std::string to store key info at all is a larger
+ // problem.
+ std::fill(raw_key.begin(), raw_key.end(), 0);
+ // Trying to keep the call above from being optimized away by assigning info
+ // from the object to a volatile.
+ volatile char *optimization_blocker = const_cast<char*>(raw_key.c_str());
+ optimization_blocker = NULL;
+ return result;
+}
+
size_t HMAC::DigestLength() const {
switch (hash_alg_) {
case SHA1:
« chrome/browser/chromeos/cros/network_library.cc ('K') | « crypto/hmac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698