summaryrefslogtreecommitdiff
path: root/firmware/include/gbb_access.h
blob: 09a88fa00d4153cdd48b559aa26e8467eff8763a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* Copyright (c) 2013 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.
 *
 * Access to portions of the GBB using the region API.
 */

#ifndef VBOOT_REFERENCE_GBB_ACCESS_H_
#define VBOOT_REFERENCE_GBB_ACCESS_H_

#include "vboot_api.h"

#ifdef __cplusplus
extern "C" {
#endif  /* __cplusplus */

struct vb2_context;
struct VbPublicKey;

/**
 * Read the root key from the GBB
 *
 * @param ctx		Vboot context
 * @param keyp		Returns a pointer to the key. The caller must call
 *			free() on the key when finished with it.
 * @return VBERROR_... error, VBERROR_SUCCESS on success,
 */
VbError_t VbGbbReadRootKey(struct vb2_context *ctx,
			   struct VbPublicKey **keyp);

/**
 * Read the recovery key from the GBB
 *
 * @param ctx		Vboot context
 * @param keyp		Returns a pointer to the key. The caller must call
 *			free() on the key when finished with it.
 * @return VBERROR_... error, VBERROR_SUCCESS on success,
 */
VbError_t VbGbbReadRecoveryKey(struct vb2_context *ctx,
			       struct VbPublicKey **keyp);

/**
 * Read the hardware ID from the GBB
 *
 * @param ctx		Vboot context
 * @param hwid		Place to put HWID, which will be null-terminated
 * @param max_size	Maximum size of HWID including terminated null
 *			character (suggest 256). If this size is too small
 *			then VBERROR_INVALID_PARAMETER is returned.
 * @return VBERROR_... error, VBERROR_SUCCESS on success,
 */
VbError_t VbGbbReadHWID(struct vb2_context *ctx, char *hwid, uint32_t max_size);

#ifdef __cplusplus
}
#endif  /* __cplusplus */

#endif