gbb_access.h 2.5 KB

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