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