host_common.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. #ifndef VBOOT_REFERENCE_HOST_COMMON_H_
  8. #define VBOOT_REFERENCE_HOST_COMMON_H_
  9. #include "host_key.h"
  10. #include "host_key2.h"
  11. #include "host_keyblock.h"
  12. #include "host_misc.h"
  13. #include "host_signature.h"
  14. #include "utility.h"
  15. #include "vboot_api.h"
  16. #include "vboot_struct.h"
  17. /**
  18. * Create a firmware preamble.
  19. *
  20. * @param firmware_version Firmware version
  21. * @param kernel_subkey Kernel subkey to store in preamble
  22. * @param body_signature Signature of firmware body
  23. * @param signing_key Private key to sign header with
  24. * @param flags Firmware preamble flags
  25. *
  26. * @return The preamble, or NULL if error. Caller must free() it.
  27. */
  28. struct vb2_fw_preamble *vb2_create_fw_preamble(
  29. uint32_t firmware_version,
  30. const struct vb2_packed_key *kernel_subkey,
  31. const struct vb2_signature *body_signature,
  32. const struct vb2_private_key *signing_key,
  33. uint32_t flags);
  34. /**
  35. * Create a kernel preamble.
  36. *
  37. * @param kernel_version Firmware version
  38. * @param body_load_address Load address for kernel body
  39. * @param bootloader_address Load address for bootloader
  40. * @param bootloader_size Size of bootloader in bytes
  41. * @param body_signature Signature of kernel body
  42. * @param vmlinuz_header_address Load address for 16-bit vmlinuz header
  43. * @param vmlinuz_header_size Size of 16-bit vmlinuz header in bytes
  44. * @param flags Kernel preamble flags
  45. * @param desired_size Minimum size of preamble in bytes
  46. * @param signing_key Private key to sign header with
  47. *
  48. * @return The preamble, or NULL if error. Caller must free() it.
  49. */
  50. struct vb2_kernel_preamble *vb2_create_kernel_preamble(
  51. uint32_t kernel_version,
  52. uint64_t body_load_address,
  53. uint64_t bootloader_address,
  54. uint32_t bootloader_size,
  55. const struct vb2_signature *body_signature,
  56. uint64_t vmlinuz_header_address,
  57. uint32_t vmlinuz_header_size,
  58. uint32_t flags,
  59. uint32_t desired_size,
  60. const struct vb2_private_key *signing_key);
  61. #endif /* VBOOT_REFERENCE_HOST_COMMON_H_ */