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

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: Handling decryption errors better 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
Index: crypto/hmac.cc
diff --git a/crypto/hmac.cc b/crypto/hmac.cc
index 9131313d9e0514d4a4794c40427213862dcd0104..0265fae9017d8399ee8ef1773b3837a242f43e63 100644
--- a/crypto/hmac.cc
+++ b/crypto/hmac.cc
@@ -8,9 +8,21 @@
#include "base/logging.h"
#include "crypto/secure_util.h"
+#include "crypto/symmetric_key.h"
namespace crypto {
+bool HMAC::Init(const SymmetricKey& key) {
+ std::string raw_key;
+ key.GetRawKey(&raw_key);
Ryan Sleevi 2012/01/04 01:33:43 GetRawKey can fail (eg: non-exportable) bool resu
+ bool result = Init(raw_key);
+ // Zero out key copy.
+ raw_key.assign(raw_key.length(), std::string::value_type());
+ raw_key.clear();
+ raw_key.reserve(0);
Ryan Sleevi 2012/01/04 01:33:43 Unfortunately, it's possible (and in practice, lik
Greg Spencer (Chromium) 2012/01/05 22:18:03 I took this code from the HMAC destructor on mac,
Ryan Sleevi 2012/01/05 22:34:11 std::fill() just gets turned into a memset(), due
+ return result;
+}
+
size_t HMAC::DigestLength() const {
switch (hash_alg_) {
case SHA1:

Powered by Google App Engine
This is Rietveld 408576698