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 * 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 13 struct BmpBlockHeader; 14 struct ImageInfo; 15 struct GoogleBinaryBlockHeader; 16 struct ScreenLayout; 17 struct 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 */ 27 VbError_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 */ 38 VbError_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 */ 49 VbError_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 */ 59 VbError_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 */ 77 VbError_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 84