1/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 *
5 * Host-side functions for verified boot.
6 */
7
8#ifndef VBOOT_REFERENCE_HOST_COMMON_H_
9#define VBOOT_REFERENCE_HOST_COMMON_H_
10
11/*
12 * Host is allowed direct use of stdlib funcs such as malloc() and free(),
13 * since it's using the stub implementation from firmware/lib/stub.
14 */
15#define _STUB_IMPLEMENTATION_
16
17#include "cryptolib.h"
18#include "host_key.h"
19#include "host_keyblock.h"
20#include "host_misc.h"
21#include "host_signature.h"
22#include "utility.h"
23#include "vboot_api.h"
24#include "vboot_struct.h"
25
26/**
27 * Create a firmware preamble, signed with [signing_key].
28 *
29 * Caller owns the returned pointer, and must free it with Free().
30 *
31 * Returns NULL if error.
32 */
33VbFirmwarePreambleHeader *CreateFirmwarePreamble(
34	uint64_t firmware_version,
35	const VbPublicKey *kernel_subkey,
36	const VbSignature *body_signature,
37	const VbPrivateKey *signing_key,
38	uint32_t flags);
39
40/**
41 * Create a kernel preamble, signed with [signing_key].
42 *
43 * Caller owns the returned pointer, and must free it with Free().
44 *
45 * Returns NULL if error.
46 */
47VbKernelPreambleHeader *CreateKernelPreamble(
48	uint64_t kernel_version,
49	uint64_t body_load_address,
50	uint64_t bootloader_address,
51	uint64_t bootloader_size,
52	const VbSignature *body_signature,
53	uint64_t vmlinuz_header_address,
54	uint64_t vmlinuz_header_size,
55	uint32_t flags,
56	uint64_t desired_size,
57	const VbPrivateKey *signing_key);
58
59#endif  /* VBOOT_REFERENCE_HOST_COMMON_H_ */
60