diff options
author | gspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-11 23:17:14 +0000 |
---|---|---|
committer | gspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-11 23:17:14 +0000 |
commit | 2c9f0def901b383bb003c4d10c198cabec1277f6 (patch) | |
tree | b151b0f99cf928e3aaf4eeddf39a98bf301313db /crypto/hmac.cc | |
parent | 98a4a4fedccd40287db03233947f48c02906b74d (diff) | |
download | chromium_src-2c9f0def901b383bb003c4d10c198cabec1277f6.zip chromium_src-2c9f0def901b383bb003c4d10c198cabec1277f6.tar.gz chromium_src-2c9f0def901b383bb003c4d10c198cabec1277f6.tar.bz2 |
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
Diffstat (limited to 'crypto/hmac.cc')
-rw-r--r-- | crypto/hmac.cc | 12 |
1 files changed, 11 insertions, 1 deletions
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: |