From 2c9f0def901b383bb003c4d10c198cabec1277f6 Mon Sep 17 00:00:00 2001 From: "gspencer@chromium.org" Date: Wed, 11 Jan 2012 23:17:14 +0000 Subject: This adds support for encrypted ONC import to Chrome. We now can import standalone ONC files that are encrypted by the Spigots management app. TBR=joaodasilva@chromium.org BUG=chromium-os:19397 TEST=Ran new unit tests, imported encrypted ONC on device. Review URL: http://codereview.chromium.org/8949056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117321 0039d316-1c4b-4281-b951-d872f2087c98 --- crypto/hmac.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'crypto/hmac.cc') diff --git a/crypto/hmac.cc b/crypto/hmac.cc index 9131313..7176248 100644 --- a/crypto/hmac.cc +++ b/crypto/hmac.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,9 +8,19 @@ #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 might get optimized away, 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); + return result; +} + size_t HMAC::DigestLength() const { switch (hash_alg_) { case SHA1: -- cgit v1.1