xref: /xnu-10063.121.3/EXTERNAL_HEADERS/CoreEntitlements/CoreEntitlementsPriv.h (revision 2c2f96dc2b9a4408a43d3150ae9c105355ca3daa)
1 //
2 //  CoreEntitlementsPriv.h
3 //  CoreEntitlements
4 //
5 
6 #ifndef CORE_ENTITLEMENTS_PRIV_H
7 #define CORE_ENTITLEMENTS_PRIV_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 #include <CoreEntitlements/CoreEntitlements.h>
14 #include <CoreEntitlements/EntitlementsPriv.h>
15 
16 #define CE_BRIDGE_STRUCT_VERSION 3
17 #define CCDER_ENTITLEMENTS (CCDER_SEQUENCE | CCDER_CONSTRUCTED | CCDER_APPLICATION)
18 
19 __ptrcheck_abi_assume_single();
20 
21 /*!
22  * @typedef coreentitlements_t
23  * Wraps up all the CoreEntitlements functions into a nice bundle to be used in the kernel
24  */
25 typedef struct {
26     uint64_t version;
27     typeof(&CEAcquireUnmanagedContext) AcquireUnmanagedContext;
28     typeof(&CEValidate) Validate;
29     typeof(&CEContextQuery) ContextQuery;
30     typeof(&CEConjureContextFromDER) ConjureContextFromDER;
31 
32     typeof(&der_vm_context_create) der_vm_context_create;
33     typeof(&der_vm_execute) der_vm_execute;
34     typeof(&der_vm_iterate) der_vm_iterate;
35     typeof(&der_vm_context_is_valid) der_vm_context_is_valid;
36     typeof(&der_vm_CEType_from_context) der_vm_CEType_from_context;
37     typeof(&der_vm_integer_from_context) der_vm_integer_from_context;
38     typeof(&der_vm_string_from_context) der_vm_string_from_context;
39     typeof(&der_vm_bool_from_context) der_vm_bool_from_context;
40 
41     typeof(kCENoError) kNoError;
42     typeof(kCEAPIMisuse) kAPIMisuse;
43     typeof(kCEInvalidArgument) kInvalidArgument;
44     typeof(kCEAllocationFailed) kAllocationFailed;
45     typeof(kCEMalformedEntitlements) kMalformedEntitlements;
46     typeof(kCEQueryCannotBeSatisfied) kQueryCannotBeSatisfied;
47 #if CE_ACCELERATION_SUPPORTED
48     typeof(kCENotEligibleForAcceleration) kNotEligibleForAcceleration;
49 #endif
50 
51     typeof(&CEGetErrorString) GetErrorString;
52 
53     typeof(&der_vm_buffer_from_context) der_vm_buffer_from_context;
54     typeof(&CEContextIsSubset) CEContextIsSubset;
55 
56 #if CE_ACCELERATION_SUPPORTED
57     typeof(&CEIndexSizeForContext) IndexSizeForContext;
58     typeof(&CEBuildIndexForContext) BuildIndexForContext;
59     typeof(&CEFreeIndexForContext) FreeIndexForContext;
60     typeof(&CEContextIsAccelerated) ContextIsAccelerated;
61 #endif
62 } coreentitlements_t;
63 
64 #ifdef __BLOCKS__
65 typedef bool (^iteration_trampoline_t)(der_vm_iteration_context ctx);
66 bool der_vm_block_trampoline(der_vm_iteration_context ctx);
67 #endif
68 
69 /*
70  These are private for now, they're essentially inverse functions for CESerialize.
71 
72  */
73 CEError_t CESizeDeserialization(CEQueryContext_t ctx, size_t* requiredElements);
74 CEError_t CEDeserialize(CEQueryContext_t ctx, CESerializedElement_t *__counted_by(elementsLength) elements, size_t elementsLength);
75 
76 #ifdef __cplusplus
77 }
78 #endif
79 
80 #endif
81