3 * Supported chip environments.
8 #ifndef __IMG4_INDIRECT
9 #error "Please #include <img4/firmware.h> instead of this file directly"
10 #endif // __IMG4_INDIRECT
16 OS_ASSUME_NONNULL_BEGIN
19 * @typedef img4_chip_t
20 * An opaque type describing a destination chip environment for the firmware
23 IMG4_API_AVAILABLE_20200508
24 typedef struct _img4_chip img4_chip_t
;
27 * @typedef img4_chip_select_array_t
28 * A type representing a list of chips from which the implementation may select.
30 IMG4_API_AVAILABLE_20200724
31 typedef const img4_chip_t
*_Nullable
const *img4_chip_select_array_t
;
34 * @const IMG4_CHIP_INSTANCE_STRUCT_VERSION
35 * The version of the {@link img4_chip_instance_t} supported by the
38 #define IMG4_CHIP_INSTANCE_STRUCT_VERSION (1u)
41 * @typedef img4_chip_instance_omit_t
42 * A bitfield describing omitted identifiers from a chip instance.
44 * @const IMG4_CHIP_INSTANCE_OMIT_CEPO
45 * The chip instance has no epoch.
47 * @const IMG4_CHIP_INSTANCE_OMIT_BORD
48 * The chip instance has no board identifier.
50 * @const IMG4_CHIP_INSTANCE_OMIT_CHIP
51 * The chip instance has no chip identifier.
53 * @const IMG4_CHIP_INSTANCE_OMIT_SDOM
54 * The chip instance has no security domain.
56 * @const IMG4_CHIP_INSTANCE_OMIT_ECID
57 * The chip instance has no unique chip identifier.
59 * @const IMG4_CHIP_INSTANCE_OMIT_CPRO
60 * The chip instance has no certificate production status.
62 * @const IMG4_CHIP_INSTANCE_OMIT_CSEC
63 * The chip instance has no certificate security mode.
65 * @const IMG4_CHIP_INSTANCE_OMIT_EPRO
66 * The chip instance has no effective production status.
68 * @const IMG4_CHIP_INSTANCE_OMIT_ESEC
69 * The chip instance has no effective security mode.
71 * @const IMG4_CHIP_INSTANCE_OMIT_IUOU
72 * The chip instance has no internal-use-only-unit property.
74 * @const IMG4_CHIP_INSTANCE_OMIT_RSCH
75 * The chip instance has no research fusing state.
77 * @const IMG4_CHIP_INSTANCE_OMIT_EUOU
78 * The chip instance has no engineering-use-only-unit property.
80 OS_CLOSED_OPTIONS(img4_chip_instance_omit
, uint64_t,
81 IMG4_CHIP_INSTANCE_OMIT_CEPO
= (1 << 0),
82 IMG4_CHIP_INSTANCE_OMIT_BORD
= (1 << 1),
83 IMG4_CHIP_INSTANCE_OMIT_CHIP
= (1 << 2),
84 IMG4_CHIP_INSTANCE_OMIT_SDOM
= (1 << 3),
85 IMG4_CHIP_INSTANCE_OMIT_ECID
= (1 << 4),
86 IMG4_CHIP_INSTANCE_OMIT_CPRO
= (1 << 5),
87 IMG4_CHIP_INSTANCE_OMIT_CSEC
= (1 << 6),
88 IMG4_CHIP_INSTANCE_OMIT_EPRO
= (1 << 7),
89 IMG4_CHIP_INSTANCE_OMIT_ESEC
= (1 << 8),
90 IMG4_CHIP_INSTANCE_OMIT_IUOU
= (1 << 9),
91 IMG4_CHIP_INSTANCE_OMIT_RSCH
= (1 << 10),
92 IMG4_CHIP_INSTANCE_OMIT_EUOU
= (1 << 11),
96 * @typedef img4_chip_instance_t
97 * An structure describing an instance of a chip.
100 * The version of the structure. Initialize to
101 * {@link IMG4_CHIP_INSTANCE_STRUCT_VERSION}.
103 * @field chid_chip_family
104 * The chip family of which this is an instance.
107 * The identifiers which are absent from the chip instance.
110 * The certificate epoch of the chip instance.
113 * The board identifier of the chip instance.
116 * The chip identifier of the chip instance.
119 * The security domain of the chip instance.
122 * The unique chip identifier of the chip instance.
125 * The certificate production status of the chip instance.
128 * The certificate security mode of the chip instance.
131 * The effective production status of the chip instance.
134 * The effective security mode of the chip instance.
137 * The internal use-only unit status of the chip instance.
140 * The research mode of the chip instance.
143 * The engineering use-only unit status of the chip instance.
145 * Added in version 1 of the structure.
147 IMG4_API_AVAILABLE_20200508
148 typedef struct _img4_chip_instance
{
149 img4_struct_version_t chid_version
;
150 const img4_chip_t
*chid_chip_family
;
151 img4_chip_instance_omit_t chid_omit
;
164 } img4_chip_instance_t
;
167 * @const IMG4_CHIP_AP_SHA1
168 * The Application Processor on an Apple ARM SoC with an embedded sha1
171 * This chip environment represents one unique instance of such a chip.
173 #if !XNU_KERNEL_PRIVATE
174 IMG4_API_AVAILABLE_20200508
176 const img4_chip_t _img4_chip_ap_sha1
;
177 #define IMG4_CHIP_AP_SHA1 (&_img4_chip_ap_sha1)
179 #define IMG4_CHIP_AP_SHA1 (img4if->i4if_v7.chip_ap_sha1)
183 * @const IMG4_CHIP_AP_SHA2_384
184 * The Application Processor on an Apple ARM SoC with an embedded sha2-384
187 * This chip environment represents one unique instance of such a chip.
189 #if !XNU_KERNEL_PRIVATE
190 IMG4_API_AVAILABLE_20200508
192 const img4_chip_t _img4_chip_ap_sha2_384
;
193 #define IMG4_CHIP_AP_SHA2_384 (&_img4_chip_ap_sha2_384)
195 #define IMG4_CHIP_AP_SHA2_384 (img4if->i4if_v7.chip_ap_sha2_384)
199 * @const IMG4_CHIP_AP_HYBRID
200 * An Intel x86 processor whose chain of trust is rooted in an
201 * {@link IMG4_CHIP_AP_SHA2_384} environment. Firmwares executed on this chip
202 * are authenticated against the characteristics of the corresponding AP chip
205 * This chip environment represents one unique instance of such a chip pair.
207 #if !XNU_KERNEL_PRIVATE
208 IMG4_API_AVAILABLE_20200508
210 const img4_chip_t _img4_chip_ap_hybrid
;
211 #define IMG4_CHIP_AP_HYBRID (&_img4_chip_ap_hybrid)
213 #define IMG4_CHIP_AP_HYBRID (img4if->i4if_v7.chip_ap_hybrid)
217 * @const IMG4_CHIP_AP_REDUCED
218 * An Application Processor on an Apple ARM SoC operating in a reduced security
221 * This chip cannot be uniquely identified.
223 #if !XNU_KERNEL_PRIVATE
224 IMG4_API_AVAILABLE_20200508
226 const img4_chip_t _img4_chip_ap_reduced
;
227 #define IMG4_CHIP_AP_REDUCED (&_img4_chip_ap_reduced)
229 #define IMG4_CHIP_AP_REDUCED (img4if->i4if_v7.chip_ap_reduced)
233 * @const IMG4_CHIP_AP_PERMISSIVE
234 * An Application Processor on an Apple ARM SoC operating with no secure boot
237 * This chip cannot be uniquely identified.
239 #if !XNU_KERNEL_PRIVATE
240 IMG4_API_AVAILABLE_20200508
242 const img4_chip_t _img4_chip_ap_permissive
;
243 #define IMG4_CHIP_AP_PERMISSIVE (&_img4_chip_ap_permissive)
245 #define IMG4_CHIP_AP_PERMISSIVE (img4if->i4if_v8.chip_ap_permissive)
249 * @const IMG4_CHIP_AP_HYBRID_MEDIUM
250 * An Intel x86 processor whose chain of trust is rooted in an
251 * {@link IMG4_CHIP_AP_SHA2_384} environment and is operating in a "medium
252 * security" mode due to a user-approved security degradation.
254 * This chip cannot be uniquely identified.
256 #if !XNU_KERNEL_PRIVATE
257 IMG4_API_AVAILABLE_20200508
259 const img4_chip_t _img4_chip_ap_hybrid_medium
;
260 #define IMG4_CHIP_AP_HYBRID_MEDIUM (&_img4_chip_ap_hybrid_medium)
262 #define IMG4_CHIP_AP_HYBRID_MEDIUM (img4if->i4if_v8.chip_ap_hybrid_medium)
266 * @const IMG4_CHIP_AP_HYBRID_RELAXED
267 * An Intel x86 processor whose chain of trust is rooted in an
268 * {@link IMG4_CHIP_AP_SHA2_384} environment and is operating with no secure
269 * boot enforcement due to a user-approved security degradation.
271 * This chip cannot be uniquely identified.
273 #if !XNU_KERNEL_PRIVATE
274 IMG4_API_AVAILABLE_20200508
276 const img4_chip_t _img4_chip_ap_hybrid_relaxed
;
277 #define IMG4_CHIP_AP_HYBRID_RELAXED (&_img4_chip_ap_hybrid_relaxed)
279 #define IMG4_CHIP_AP_HYBRID_RELAXED (img4if->i4if_v8.chip_ap_hybrid_relaxed)
283 * @const IMG4_CHIP_AP_SOFTWARE_FF00
284 * A software-defined chip environment whose firmwares are executed on any
285 * Application Processor on an Apple ARM SoC. The firmwares are loadable trust
286 * caches shipped with OTA update brains.
288 * This chip cannot be uniquely identified.
290 #if !XNU_KERNEL_PRIVATE
291 IMG4_API_AVAILABLE_20200508
293 const img4_chip_t _img4_chip_ap_software_ff00
;
294 #define IMG4_CHIP_AP_SOFTWARE_FF00 (&_img4_chip_ap_software_ff00)
296 #define IMG4_CHIP_AP_SOFTWARE_FF00 (img4if->i4if_v7.chip_ap_software_ff00)
300 * @const IMG4_CHIP_AP_SOFTWARE_FF01
301 * A software-defined chip environment whose firmwares are executed on any
302 * Application Processor on an Apple ARM SoC. The firmwares are loadable trust
303 * caches which are shipped in the Install Assistant and loaded by an
304 * unprivileged trampoline.
306 * This chip cannot be uniquely identified.
308 #if !XNU_KERNEL_PRIVATE
309 IMG4_API_AVAILABLE_20200508
311 const img4_chip_t _img4_chip_ap_software_ff01
;
312 #define IMG4_CHIP_AP_SOFTWARE_FF01 (&_img4_chip_ap_software_ff01)
314 #define IMG4_CHIP_AP_SOFTWARE_FF01 (img4if->i4if_v7.chip_ap_software_ff01)
318 * @const IMG4_CHIP_X86
319 * An Intel x86 processor which cannot be uniquely identified.
321 #if !XNU_KERNEL_PRIVATE
322 IMG4_API_AVAILABLE_20200508
324 const img4_chip_t _img4_chip_x86
;
325 #define IMG4_CHIP_X86 (&_img4_chip_x86)
327 #define IMG4_CHIP_X86 (img4if->i4if_v7.chip_x86)
331 * @const IMG4_CHIP_X86_SOFTWARE_8012
332 * A software-defined chip environment describing a virtualized x86 processor.
333 * Since the virtual machine is at the mercy of the VM, support for any sort of
334 * chip identity may not be available. Therefore this environment is returned
335 * from {@link img4_chip_select_personalized_ap} and
336 * {@link img4_chip_select_effective_ap} when it is called on a virtual machine
337 * so that the appropriate chip environment is present entirely in software.
339 * This environment provides an equivalent software identity to that of
340 * the {@link IMG4_CHIP_X86} chip environment on non-Gibraltar Macs.
343 * Do not use this environment directly.
345 #if !XNU_KERNEL_PRIVATE
346 IMG4_API_AVAILABLE_20200508
348 const img4_chip_t _img4_chip_x86_software_8012
;
349 #define IMG4_CHIP_X86_SOFTWARE_8012 (&_img4_chip_x86_software_8012)
351 #define IMG4_CHIP_X86_SOFTWARE_8012 (img4if->i4if_v7.chip_x86_software_8012)
355 * @function img4_chip_init_from_buff
356 * Initializes a buffer as a chip object.
359 * A pointer to the storage to use for the chip object.
362 * The size of the buffer.
365 * The caller is expected to pass a buffer that is "big enough". If the provided
366 * buffer is too small, the implementation will abort the caller.
370 * uint8_t _buff[IMG4_CHIP_SIZE_RECOMMENDED];
371 * img4_chip_t *chip = NULL;
373 * chip = img4_chip_init_from_buff(_buff, sizeof(_buff));
375 #if !XNU_KERNEL_PRIVATE
376 IMG4_API_AVAILABLE_20200508
377 OS_EXPORT OS_WARN_RESULT OS_NONNULL1
379 img4_chip_init_from_buff(void *buff
, size_t len
);
381 #define img4_chip_init_from_buff (img4if->i4if_v7.chip_init_from_buff)
385 * @function img4_chip_select_personalized_ap
386 * Returns the chip appropriate for personalized verification against the host
390 * The personalized chip environment for the host which corresponds to its
393 #if !XNU_KERNEL_PRIVATE
394 IMG4_API_AVAILABLE_20200508
395 OS_EXPORT OS_WARN_RESULT
397 img4_chip_select_personalized_ap(void);
399 #define img4_chip_select_personalized_ap(...) \
400 (img4if->i4if_v7.chip_select_personalized_ap(__VA_ARGS__))
404 * @function img4_chip_select_effective_ap
405 * Returns the chip appropriate for verification against the host AP.
408 * The currently enforced chip environment for the host. This interface is
409 * generally only useful on the AP.
411 #if !XNU_KERNEL_PRIVATE
412 IMG4_API_AVAILABLE_20200508
413 OS_EXPORT OS_WARN_RESULT
415 img4_chip_select_effective_ap(void);
417 #define img4_chip_select_effective_ap(...) \
418 (img4if->i4if_v7.chip_select_effective_ap(__VA_ARGS__))
422 * @function img4_chip_instantiate
423 * Returns an instantiation of the given chip using the default runtime where
427 * The chip to instantiate.
429 * @param chip_instance
430 * Upon successful return, storage to be populated with the instantiated chip.
431 * Upon failure, the contents of this storage are undefined.
434 * Upon success, zero is returned. Otherwise, one of the following error codes
437 * [EXDEV] There was an error querying the runtime's identity oracle
438 * [ENODATA] The expected property in the runtime's identity oracle was
439 * of an unexpected type
440 * [EOVERFLOW] The expected property in the runtime's identity oracle had
441 * a value that was too large to be represented in the
444 #if !XNU_KERNEL_PRIVATE
445 IMG4_API_AVAILABLE_20200508
446 OS_EXPORT OS_WARN_RESULT OS_NONNULL1 OS_NONNULL2
448 img4_chip_instantiate(const img4_chip_t
*chip
,
449 img4_chip_instance_t
*chip_instance
);
451 #define img4_chip_instantiate(...) \
452 (img4if->i4if_v7.chip_instantiate(__VA_ARGS__))
456 * @function img4_chip_custom
457 * Returns a custom chip derived from the given chip instance. The
458 * {@link chid_chip_family} field of the given instance will be used as a
459 * template from which to derive the new chip.
461 * @param chip_instance
462 * The instance of the custom chip.
464 * The memory referenced by this pointer must be static or otherwise guaranteed
465 * to be valid for the duration of the caller's use of the custom chip.
468 * A pointer to storage for the new custom chip.
470 * The memory referenced by this pointer must be static or otherwise guaranteed
471 * to be valid for the duration of the caller's use of the custom chip.
473 * This pointer should be obtained as the result of a call to
474 * {@link img4_chip_init_from_buff}.
479 #if !XNU_KERNEL_PRIVATE
480 IMG4_API_AVAILABLE_20200508
481 OS_EXPORT OS_WARN_RESULT OS_NONNULL1
483 img4_chip_custom(const img4_chip_instance_t
*chip_instance
, img4_chip_t
*chip
);
485 #define img4_chip_custom(...) (img4if->i4if_v7.chip_custom(__VA_ARGS__))
488 OS_ASSUME_NONNULL_END
490 #endif // __IMG4_CHIP_H