Open Enclave  0.11.0
types.h
Go to the documentation of this file.
1 // Copyright (c) Open Enclave SDK contributors.
2 // Licensed under the MIT License.
3 
10 #ifndef _OE_BITS_TYPES_H
11 #define _OE_BITS_TYPES_H
12 
13 #include "defs.h"
14 
20 #if defined(__GNUC__)
21 typedef long ssize_t;
22 typedef unsigned long size_t;
23 typedef signed char int8_t;
24 typedef unsigned char uint8_t;
25 typedef short int16_t;
26 typedef unsigned short uint16_t;
27 typedef int int32_t;
28 typedef unsigned int uint32_t;
29 typedef long int64_t;
30 typedef unsigned long uint64_t;
31 typedef unsigned long uintptr_t;
32 typedef long ptrdiff_t;
33 typedef long intptr_t;
34 typedef long time_t;
35 typedef long suseconds_t;
36 
37 #ifndef __cplusplus
38 typedef __WCHAR_TYPE__ wchar_t;
39 #endif
40 
41 #elif defined(_MSC_VER)
42 typedef long long ssize_t;
43 typedef unsigned long long size_t;
44 typedef signed char int8_t;
45 typedef unsigned char uint8_t;
46 typedef short int16_t;
47 typedef unsigned short uint16_t;
48 typedef int int32_t;
49 typedef unsigned int uint32_t;
50 typedef long long int64_t;
51 typedef unsigned long long uint64_t;
52 typedef unsigned long long uintptr_t;
53 typedef long long ptrdiff_t;
54 typedef long long intptr_t;
55 typedef long long time_t;
56 typedef long long suseconds_t;
57 #else
58 #error "unknown compiler - please adapt basic types"
59 #endif
60 
61 /* bool type */
62 #ifndef __cplusplus
63 #define true 1
64 #define false 0
65 #define bool _Bool
66 #endif
67 
68 #define OE_SCHAR_MIN (-128)
69 #define OE_SCHAR_MAX 127
70 #define OE_UCHAR_MAX 255
71 #define OE_CHAR_MIN (-128)
72 #define OE_CHAR_MAX 127
73 #define OE_CHAR_BIT 8
74 #define OE_SHRT_MIN (-1 - 0x7fff)
75 #define OE_SHRT_MAX 0x7fff
76 #define OE_USHRT_MAX 0xffff
77 #define OE_INT_MIN (-1 - 0x7fffffff)
78 #define OE_INT_MAX 0x7fffffff
79 #define OE_UINT_MAX 0xffffffffU
80 
81 #ifdef _MSC_VER
82 #define OE_LONG_MAX 0x7fffffffL
83 #elif __linux__
84 #define OE_LONG_MAX 0x7fffffffffffffffL
85 #endif
86 
87 #define OE_LONG_MIN (-OE_LONG_MAX - 1)
88 #define OE_ULONG_MAX (2UL * OE_LONG_MAX + 1)
89 #define OE_LLONG_MAX 0x7fffffffffffffffLL
90 #define OE_LLONG_MIN (-OE_LLONG_MAX - 1)
91 #define OE_ULLONG_MAX (2ULL * OE_LLONG_MAX + 1)
92 
93 #define OE_INT8_MIN (-1 - 0x7f)
94 #define OE_INT8_MAX (0x7f)
95 #define OE_UINT8_MAX (0xff)
96 #define OE_INT16_MIN (-1 - 0x7fff)
97 #define OE_INT16_MAX (0x7fff)
98 #define OE_UINT16_MAX (0xffff)
99 #define OE_INT32_MIN (-1 - 0x7fffffff)
100 #define OE_INT32_MAX (0x7fffffff)
101 #define OE_UINT32_MAX (0xffffffffu)
102 #define OE_INT64_MIN (-1 - 0x7fffffffffffffff)
103 #define OE_INT64_MAX (0x7fffffffffffffff)
104 #define OE_UINT64_MAX (0xffffffffffffffffu)
105 #define OE_SIZE_MAX OE_UINT64_MAX
106 #define OE_SSIZE_MAX OE_INT64_MAX
107 
115 typedef enum _oe_enclave_type
116 {
137  __OE_ENCLAVE_TYPE_MAX = OE_ENUM_MAX,
139 
144 typedef struct _oe_enclave oe_enclave_t;
145 
150 typedef enum _oe_seal_policy
151 {
167  _OE_SEAL_POLICY_MAX = OE_ENUM_MAX,
169 
173 typedef struct _oe_datetime
174 {
175  uint32_t year; /* format: 1970, 2018, 2020 */
176  uint32_t month; /* range: 1-12 */
177  uint32_t day; /* range: 1-31 */
178  uint32_t hours; /* range: 0-23 */
179  uint32_t minutes; /* range: 0-59 */
180  uint32_t seconds; /* range: 0-59 */
181 } oe_datetime_t;
182 
183 #endif /* _OE_BITS_TYPES_H */
enum _oe_seal_policy oe_seal_policy_t
This enumeration type defines the policy used to derive a seal key.
Unused.
Definition: types.h:167
enum _oe_enclave_type oe_enclave_type_t
This enumeration defines values for the type parameter passed to oe_create_enclave().
_oe_enclave_type
This enumeration defines values for the type parameter passed to oe_create_enclave().
Definition: types.h:115
Unused.
Definition: types.h:137
_oe_seal_policy
This enumeration type defines the policy used to derive a seal key.
Definition: types.h:150
Key is derived from the signer of the enclave.
Definition: types.h:163
OE_ENCLAVE_TYPE_SGX will force the platform to use SGX, but any platform other than x64 will not supp...
Definition: types.h:127
OE_ENCLAVE_TYPE_OPTEE will force the platform to use OP-TEE, but any platform other than one that imp...
Definition: types.h:133
OE_ENCLAVE_TYPE_AUTO will pick the type based on the target platform that is being built...
Definition: types.h:122
This struct defines a datetime up to 1 second precision.
Definition: types.h:173
Key is derived from a measurement of the enclave.
Definition: types.h:157
struct _oe_datetime oe_datetime_t
This struct defines a datetime up to 1 second precision.
struct _oe_enclave oe_enclave_t
This is an opaque handle to an enclave returned by oe_create_enclave().
Definition: types.h:144