blob: b94d0cdb6be6a5576b1beb99145e9f34c634210a [file] [log] [blame]
Simon Glass527ba812013-07-25 08:48:47 -06001/* 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 * Access to portions of the GBB using the region API.
6 */
7
8#ifndef VBOOT_REFERENCE_GBB_ACCESS_H_
9#define VBOOT_REFERENCE_GBB_ACCESS_H_
10
11#include "vboot_api.h"
12
13struct BmpBlockHeader;
14struct ImageInfo;
15struct GoogleBinaryBlockHeader;
16struct ScreenLayout;
17struct VbPublicKey;
18
19/**
20 * Read the GBB header
21 *
22 * This accesses the GBB and reads its header.
23 *
24 * @param cparams Vboot common parameters
25 * @param gbb Place to put GBB header
26 */
27VbError_t VbGbbReadHeader_static(VbCommonParams *cparams,
28 struct GoogleBinaryBlockHeader *gbb);
29
30/**
31 * Read the root key from the GBB
32 *
33 * @param cparams Vboot common parameters
34 * @param keyp Returns a pointer to the key. The caller must call
35 * VbExFree() on the key when finished with it.
36 * @return VBERROR_... error, VBERROR_SUCCESS on success,
37 */
38VbError_t VbGbbReadRootKey(VbCommonParams *cparams,
39 struct VbPublicKey **keyp);
40
41/**
42 * Read the recovery key from the GBB
43 *
44 * @param cparams Vboot common parameters
45 * @param keyp Returns a pointer to the key. The caller must call
46 * VbExFree() on the key when finished with it.
47 * @return VBERROR_... error, VBERROR_SUCCESS on success,
48 */
49VbError_t VbGbbReadRecoveryKey(VbCommonParams *cparams,
50 struct VbPublicKey **keyp);
51
52/**
53 * Read the bitmap block header from the GBB
54 *
55 * @param cparams Vboot common parameters
56 * @param hdr The header is placed in this block
57 * @return VBERROR_... error, VBERROR_SUCCESS on success,
58 */
59VbError_t VbGbbReadBmpHeader(VbCommonParams *cparams,
60 struct BmpBlockHeader *hdr);
61
62/**
63 * Read a image from the GBB
64 *
65 * The caller must call VbExFree() on *image_datap when finished with it.
66 *
67 * @param cparams Vboot common parameters
68 * @param localization Localization/language number
69 * @param screen_index Index of screen to display (VB_SCREEN_...)
70 * @param image_num Image number within the screen
71 * @param layout Returns layout information (x, y position)
72 * @param image_info Returns information about the image (format)
73 * @param image_datap Returns a pointer to the image data
74 * @param iamge_data_sizep Return size of image data
75 * @return VBERROR_... error, VBERROR_SUCCESS on success,
76 */
77VbError_t VbGbbReadImage(VbCommonParams *cparams,
78 uint32_t localization, uint32_t screen_index,
79 uint32_t image_num, struct ScreenLayout *layout,
80 struct ImageInfo *image_info, char **image_datap,
81 uint32_t *image_data_sizep);
82
83#endif