Files
OpenCellular/tests/vb2_convert_structs.c
Randall Spangler fc73f08765 vboot2: Use new hostlib functions in unit tests
This removes the hacky conversion from old-style packed keys and
signatures, which existed only because at the time we didn't have the
ability in hostlib to create new-format key and signature structs
directly.

BUG=chromium:423882
BRANCH=none
TEST=VBOOT2=1 make runtests

Change-Id: Id7cb3dfce740f2546464a4caae2629af864d7b45
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231543
2014-12-01 20:30:41 +00:00

32 lines
765 B
C

/* Copyright (c) 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.
*
* Convert structs from vboot1 data format to new vboot2 structs
*/
#include "2sysincludes.h"
#include "2common.h"
#include "host_common.h"
#include "host_key2.h"
#include "host_signature2.h"
#include "vb2_convert_structs.h"
#include "test_common.h"
struct vb2_signature2 *vb2_create_hash_sig(const uint8_t *data,
uint32_t size,
enum vb2_hash_algorithm hash_alg)
{
const struct vb2_private_key *key;
struct vb2_signature2 *sig;
if (vb2_private_key_hash(&key, hash_alg))
return NULL;
if (vb2_sign_data(&sig, data, size, key, NULL))
return NULL;
return sig;
}