xref: /xnu-12377.61.12/EXTERNAL_HEADERS/image4/coprocessor/bootpc.h (revision 4d495c6e23c53686cf65f45067f79024cf5dcee8) !
1 /*
2  * Copyright © 2017-2024 Apple Inc. All rights reserved.
3  *
4  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5  *
6  * This file contains Original Code and/or Modifications of Original Code
7  * as defined in and that are subject to the Apple Public Source License
8  * Version 2.0 (the 'License'). You may not use this file except in
9  * compliance with the License. The rights granted to you under the License
10  * may not be used to create, or enable the creation or redistribution of,
11  * unlawful or unlicensed copies of an Apple operating system, or to
12  * circumvent, violate, or enable the circumvention or violation of, any
13  * terms of an Apple operating system software license agreement.
14  *
15  * Please obtain a copy of the License at
16  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17  *
18  * The Original Code and all software distributed under the License are
19  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23  * Please see the License for the specific language governing rights and
24  * limitations under the License.
25  *
26  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27  */
28 /*!
29  * @header
30  * Boot Policy Closure environment and associated handles.
31  */
32 #ifndef __IMAGE4_API_COPROCESSOR_BOOTPC_H
33 #define __IMAGE4_API_COPROCESSOR_BOOTPC_H
34 
35 #include <image4/image4.h>
36 #include <image4/types.h>
37 
38 __BEGIN_DECLS
39 OS_ASSUME_NONNULL_BEGIN
40 OS_ASSUME_PTR_ABI_SINGLE_BEGIN
41 
42 /*!
43  * @const IMAGE4_COPROCESSOR_BOOTPC
44  * An environment that facilitates computing boot policy closures without
45  * performing trust evaluation on the manifest signature.
46  *
47  * Handles for this environment are enumerated in the
48  * {@link image4_coprocessor_handle_bootpc_t} type.
49  *
50  * @section Supported Algorithms
51  * The choice of algorithm should be made based on the algorithm that produced
52  * the policy closure digest which is being compared.
53  *
54  * @discussion
55  * This coprocessor environment should only be used to compute a policy closure
56  * hash that is to be compared to a known-trustworthy measurement. It should not
57  * be used to produce a measurement that is to be nominated for signing. The
58  * algorithm choice should be made based on the algorithm that produced the
59  * trustworthy measurement.
60  *
61  * @availability
62  * This constant first became available in API version 20240223.
63  */
64 IMAGE4_API_AVAILABLE_FALL_2024
65 OS_EXPORT
66 const image4_coprocessor_t _image4_coprocessor_bootpc;
67 #define IMAGE4_COPROCESSOR_BOOTPC (&_image4_coprocessor_bootpc)
68 IMAGE4_XNU_AVAILABLE_INDIRECT(_image4_coprocessor_bootpc);
69 
70 /*!
71  * @typedef image4_coprocessor_handle_bootpc_t
72  * Handles describing supported boot policy closure environments.
73  *
74  * @const IMAGE4_COPROCESSOR_HANDLE_BOOTPC_SHA2_224
75  * A policy closure whose digest is computed with sha2-224.
76  *
77  * @const IMAGE4_COPROCESSOR_HANDLE_BOOTPC_SHA2_256
78  * A policy closure whose digest is computed with sha2-256.
79  *
80  * @const IMAGE4_COPROCESSOR_HANDLE_BOOTPC_SHA2_384
81  * A policy closure whose digest is computed with sha2-384.
82  *
83  * @const IMAGE4_COPROCESSOR_HANDLE_BOOTPC_SHA2_512
84  * A policy closure whose digest is computed with sha2-512.
85  */
86 OS_CLOSED_ENUM(image4_coprocessor_handle_bootpc, image4_coprocessor_handle_t,
87 	IMAGE4_COPROCESSOR_HANDLE_BOOTPC_SHA2_224 = 0,
88 	IMAGE4_COPROCESSOR_HANDLE_BOOTPC_SHA2_256,
89 	IMAGE4_COPROCESSOR_HANDLE_BOOTPC_SHA2_384,
90 	IMAGE4_COPROCESSOR_HANDLE_BOOTPC_SHA2_512,
91 	_IMAGE4_COPROCESSOR_HANDLE_BOOTPC_CNT,
92 );
93 
94 /*!
95  * @const IMAGE4_COPROCESSOR_HANDLE_BOOTPC_DEFAULT
96  * The default handle for {@link IMAGE4_COPROCESSOR_BOOTPC}. This constant
97  * enables `DEFAULT` to be used as the second and third arguments to
98  * {@link image4_environment_init_coproc} and
99  * {@link image4_environment_new_coproc} respectively.
100  */
101 #define IMAGE4_COPROCESSOR_HANDLE_BOOTPC_DEFAULT \
102 	IMAGE4_COPROCESSOR_HANDLE_BOOTPC_SHA2_384
103 
104 OS_ASSUME_PTR_ABI_SINGLE_END
105 OS_ASSUME_NONNULL_END
106 __END_DECLS
107 
108 #endif // __IMAGE4_API_COPROCESSOR_BOOTPC_H
109