blob: e9a2d0d30c0ba2b05f362301eea6f2b2ae55ca40 [file] [log] [blame]
// Copyright 2014 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "privetd/openssl_utils.h"
#include <algorithm>
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <base/logging.h>
namespace privetd {
chromeos::Blob HmacSha256(const chromeos::SecureBlob& key,
const chromeos::Blob& data) {
chromeos::Blob mac(kSha256OutputSize);
uint32_t len = 0;
CHECK(HMAC(EVP_sha256(),, key.size(),,
data.size(),, &len));
CHECK_EQ(len, kSha256OutputSize);
return mac;
} // namespace privetd