| 1 | // |
| 2 | // CTConfig.h |
| 3 | // CoreTrust |
| 4 | // |
| 5 | // Copyright © 2021 Apple. All rights reserved. |
| 6 | // |
| 7 | |
| 8 | #ifndef _CORETRUST_CONFIG_H_ |
| 9 | #define _CORETRUST_CONFIG_H_ |
| 10 | |
| 11 | #if EFI |
| 12 | // This requires $(SDKROOT)/usr/local/efi/include/Platform to be in your header |
| 13 | // search path. |
| 14 | #include <Apple/Common/Library/Include/EfiCompatibility.h> |
| 15 | #else // !EFI |
| 16 | #include <stddef.h> |
| 17 | #include <stdint.h> |
| 18 | #include <stdbool.h> |
| 19 | #endif // !EFI |
| 20 | |
| 21 | /* Bounds attributes */ |
| 22 | #if __has_include(<ptrcheck.h>) |
| 23 | #include <ptrcheck.h> |
| 24 | #else |
| 25 | #define __single |
| 26 | #define __unsafe_indexable |
| 27 | #define __counted_by(N) |
| 28 | #define __sized_by(N) |
| 29 | #define __ended_by(E) |
| 30 | #define __ptrcheck_abi_assume_single() |
| 31 | #define __ptrcheck_abi_assume_unsafe_indexable() |
| 32 | #define __unsafe_forge_bidi_indexable(T, P, S) ((T)(P)) |
| 33 | #define __unsafe_forge_single(T, P) ((T)(P)) |
| 34 | #endif |
| 35 | |
| 36 | #if EFI |
| 37 | #if defined(__cplusplus) |
| 38 | #define __BEGIN_DECLS extern "C" { |
| 39 | #define __END_DECLS } |
| 40 | #else |
| 41 | #define __BEGIN_DECLS |
| 42 | #define __END_DECLS |
| 43 | #endif |
| 44 | #else // !EFI |
| 45 | #include <sys/cdefs.h> |
| 46 | #endif // !EFI |
| 47 | |
| 48 | __BEGIN_DECLS |
| 49 | |
| 50 | #if EFI |
| 51 | typedef UINT8 CT_uint8_t; |
| 52 | typedef UINT32 CT_uint32_t; |
| 53 | typedef INT32 CT_int; |
| 54 | typedef UINT64 CT_uint64_t; |
| 55 | typedef size_t CT_size_t; |
| 56 | typedef BOOLEAN CT_bool; |
| 57 | #else // !EFI |
| 58 | typedef uint8_t CT_uint8_t; |
| 59 | typedef uint32_t CT_uint32_t; |
| 60 | typedef uint64_t CT_uint64_t; |
| 61 | typedef size_t CT_size_t; |
| 62 | typedef int CT_int; |
| 63 | typedef bool CT_bool; |
| 64 | #endif // !EFI |
| 65 | |
| 66 | __END_DECLS |
| 67 | |
| 68 | #endif /* _CORETRUST_CONFIG_H_ */ |
| 69 | |