Software APIs
rom_ext_boot_policy.h
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #ifndef OPENTITAN_SW_DEVICE_SILICON_CREATOR_ROM_EXT_ROM_EXT_BOOT_POLICY_H_
6 #define OPENTITAN_SW_DEVICE_SILICON_CREATOR_ROM_EXT_ROM_EXT_BOOT_POLICY_H_
7 
8 #include "sw/device/silicon_creator/lib/boot_data.h"
9 #include "sw/device/silicon_creator/lib/error.h"
10 #include "sw/device/silicon_creator/lib/manifest.h"
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif // __cplusplus
15 
16 /**
17  * Type alias for the first owner boot stage entry point.
18  *
19  * The entry point address obtained from the first owner boot stage manifest
20  * must be cast to a pointer to this type before being called.
21  */
22 typedef void owner_stage_entry_point(void);
23 
24 /**
25  * Manifests of first boot owner boot stages in descending order according to
26  * their security versions.
27  *
28  * These boot stages must be verified prior to handing over execution.
29  */
31  /**
32  * First owner boot stage manifests in descending order according to
33  * their security versions.
34  */
35  const manifest_t *ordered[2];
37 
38 /**
39  * Returns the manifests of first owner boot stages that should be attempted to
40  * boot in descending order according to their security versions.
41  *
42  * These boot stages must be verified prior to handing over execution.
43  *
44  * @param boot_data Boot data struct.
45  * @return Manifests of first owner boot stages in descending order according to
46  * their security versions.
47  */
49 rom_ext_boot_policy_manifests_t rom_ext_boot_policy_manifests_get(
50  const boot_data_t *boot_data);
51 
52 /**
53  * Checks the fields of a first owner boot stage manifest.
54  *
55  * This function performs bounds checks on the fields of the manifest, checks
56  * that its `identifier` is correct, and its `security_version` is greater than
57  * or equal to the minimum required security version.
58  *
59  * @param manifest A first boot owner boot stage manifest.
60  * @param boot_data The boot data for the current lifecycle state.
61  * @return Result of the operation.
62  */
64 rom_error_t rom_ext_boot_policy_manifest_check(const manifest_t *manifest,
65  const boot_data_t *boot_data);
66 
67 #ifdef __cplusplus
68 } // extern "C"
69 #endif // __cplusplus
70 
71 #endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_ROM_EXT_ROM_EXT_BOOT_POLICY_H_