xref: /rk3399_ARM-atf/include/drivers/measured_boot/rse/dice_prot_env.h (revision 06f3c7058c42a9f1a9f7df75ea2de71a000855e8)
1 /*
2  * Copyright (c) 2024, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef DICE_PROT_ENV_H
8 #define DICE_PROT_ENV_H
9 
10 #include <stdbool.h>
11 #include <stddef.h>
12 #include <stdint.h>
13 
14 #include <drivers/measured_boot/metadata.h>
15 
16 #define DPE_INVALID_ID	UINT32_MAX
17 
18 struct dpe_metadata {
19 	unsigned int id;
20 	uint32_t cert_id;
21 	uint8_t signer_id[SIGNER_ID_MAX_SIZE];
22 	size_t  signer_id_size;
23 	uint8_t version[VERSION_MAX_SIZE];
24 	size_t  version_size;
25 	uint8_t sw_type[SW_TYPE_MAX_SIZE];
26 	size_t  sw_type_size;
27 	bool allow_new_context_to_derive;
28 	bool retain_parent_context;
29 	bool create_certificate;
30 	int target_locality;
31 	void *pk_oid;
32 };
33 
34 void dpe_init(struct dpe_metadata *metadata);
35 
36 /* Returns 0 in case of success otherwise -1. */
37 int dpe_measure_and_record(struct dpe_metadata *metadata,
38 			   uintptr_t data_base, uint32_t data_size,
39 			   uint32_t data_id);
40 
41 int dpe_set_signer_id(struct dpe_metadata *metadata,
42 		      const void *pk_oid, const void *pk_ptr, size_t pk_len);
43 
44 /* Child components inherit their first valid context handle from their parents.
45  * How to share context handle is platform specific.
46  */
47 void plat_dpe_share_context_handle(int *ctx_handle, int *parent_ctx_handle);
48 void plat_dpe_get_context_handle(int *ctx_handle);
49 
50 #endif /* DICE_PROT_ENV_H */
51