| 1 | /* Copyright 2019 The ChromiumOS Authors |
| 2 | * Use of this source code is governed by a BSD-style license that can be |
| 3 | * found in the LICENSE file. |
| 4 | * |
| 5 | * GBB accessor functions. |
| 6 | */ |
| 7 | |
| 8 | #ifndef VBOOT_REFERENCE_2GBB_H_ |
| 9 | #define VBOOT_REFERENCE_2GBB_H_ |
| 10 | |
| 11 | #include "2common.h" |
| 12 | |
| 13 | struct vb2_packed_key; |
| 14 | struct vb2_workbuf; |
| 15 | |
| 16 | /** |
| 17 | * Read the root key from the GBB, and store it onto the given workbuf. |
| 18 | * |
| 19 | * @param ctx Vboot context. |
| 20 | * @param keyp Returns a pointer to the key. The caller may discard |
| 21 | * workbuf state if it wants to free the key. |
| 22 | * @param size If pointer is non-NULL, returns the total size of key, |
| 23 | * including data. |
| 24 | * @param wb Workbuf for data storage. |
| 25 | * @return VB2_SUCCESS, or error code on error. |
| 26 | */ |
| 27 | vb2_error_t vb2_gbb_read_root_key(struct vb2_context *ctx, |
| 28 | struct vb2_packed_key **keyp, uint32_t *size, |
| 29 | struct vb2_workbuf *wb); |
| 30 | |
| 31 | /** |
| 32 | * Read the recovery key from the GBB, and store it onto the given workbuf. |
| 33 | * |
| 34 | * @param ctx Vboot context. |
| 35 | * @param keyp Returns a pointer to the key. The caller may discard |
| 36 | * workbuf state if it wants to free the key. |
| 37 | * @param size If pointer is non-NULL, returns the total size of key, |
| 38 | * including data. |
| 39 | * @param wb Workbuf for data storage. |
| 40 | * @return VB2_SUCCESS, or error code on error. |
| 41 | */ |
| 42 | vb2_error_t vb2_gbb_read_recovery_key(struct vb2_context *ctx, |
| 43 | struct vb2_packed_key **keyp, |
| 44 | uint32_t *size, struct vb2_workbuf *wb); |
| 45 | |
| 46 | #endif /* VBOOT_REFERENCE_2GBB_H_ */ |