Open Enclave  0.18.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
seal.h
Go to the documentation of this file.
1 // Copyright (c) Open Enclave SDK contributors.
2 // Licensed under the MIT License.
3 
13 #ifndef _OE_SEAL_H
14 #define _OE_SEAL_H
15 
18 #include <openenclave/bits/types.h>
19 
20 OE_EXTERNC_BEGIN
21 
28 typedef struct _oe_seal_setting
29 {
30  int type;
31  uint32_t size;
32  union
33  {
34  uint64_t q;
35  uint32_t d;
36  uint16_t w;
37  uint8_t b;
38  const void*
39  p;
40  } value;
42 
43 /*
44  * TEE agnostic seal settings supported by OE SDK
45  */
47 {
53 
61 
67 
74 
81 };
82 
83 #define __OE_SEAL_SET_POINTER(t, p, s) \
84  { \
85  (t), s, \
86  { \
87  (uint64_t)(p) \
88  } \
89  }
90 #define __OE_SEAL_SET_VALUE(t, v) __OE_SEAL_SET_POINTER(t, v, 0)
91 
98 #define OE_SEAL_SET_POLICY(w) __OE_SEAL_SET_VALUE(OE_SEAL_SETTING_POLICY, w)
99 
111 #define OE_SEAL_SET_CONTEXT(p, s) \
112  __OE_SEAL_SET_POINTER(OE_SEAL_SETTING_ADDITIONAL_CONTEXT, p, s)
113 
126 #define OE_SEAL_SET_IV(p, s) __OE_SEAL_SET_POINTER(OE_SEAL_SETTING_IV, p, s)
127 
158  const oe_uuid_t* plugin_id,
159  const oe_seal_setting_t* settings,
160  size_t settings_count,
161  const uint8_t* plaintext,
162  size_t plaintext_size,
163  const uint8_t* additional_data,
164  size_t additional_data_size,
165  uint8_t** blob,
166  size_t* blob_size);
167 
189  const uint8_t* blob,
190  size_t blob_size,
191  const uint8_t* additional_data,
192  size_t additional_data_size,
193  uint8_t** plaintext,
194  size_t* plaintext_size);
195 
200 {
204  const oe_uuid_t id;
205 
232  const oe_seal_setting_t* settings,
233  size_t settings_count,
234  const uint8_t* plaintext,
235  size_t plaintext_size,
236  const uint8_t* additional_data,
237  size_t additional_data_size,
238  uint8_t** blob,
239  size_t* blob_size);
240 
263  const uint8_t* blob,
264  size_t blob_size,
265  const uint8_t* additional_data,
266  size_t additional_data_size,
267  uint8_t** plaintext,
268  size_t* plaintext_size);
270 
285  const oe_seal_plugin_definition_t* plugin,
286  bool make_default);
287 
297 
298 OE_EXTERNC_END
299 
300 #endif /* _OE_SEAL_H */
_oe_seal_setting::type
int type
Setting type. See oe_seal_setting_type_t for details.
Definition: seal.h:30
oe_seal_setting_type_t
oe_seal_setting_type_t
Definition: seal.h:46
oe_seal_plugin_definition_t
struct _oe_seal_plugin_definition oe_seal_plugin_definition_t
Seal plug-in definition.
OE_SEAL_SETTING_POLICY
@ OE_SEAL_SETTING_POLICY
Desired sealing policy - either OE_SEAL_POLICY_UNIQUE or OE_SEAL_POLICY_PRODUCT.
Definition: seal.h:52
types.h
oe_unseal
oe_result_t oe_unseal(const uint8_t *blob, size_t blob_size, const uint8_t *additional_data, size_t additional_data_size, uint8_t **plaintext, size_t *plaintext_size)
Unseal a blob sealed by oe_seal().
oe_register_seal_plugin
oe_result_t oe_register_seal_plugin(const oe_seal_plugin_definition_t *plugin, bool make_default)
Register a plug-in to be used by oe_seal() and oe_unseal().
OE_SEAL_SETTING_ADDITIONAL_CONTEXT
@ OE_SEAL_SETTING_ADDITIONAL_CONTEXT
Additional context to be included in seal key derivation.
Definition: seal.h:60
_oe_seal_plugin_definition::unseal
oe_result_t(* unseal)(const uint8_t *blob, size_t blob_size, const uint8_t *additional_data, size_t additional_data_size, uint8_t **plaintext, size_t *plaintext_size)
Callback function to be called by oe_unseal() when unsealing a blob.
Definition: seal.h:262
_oe_uuid_t
Struct containing the definition for an UUID.
Definition: evidence.h:55
_oe_seal_plugin_definition::id
const oe_uuid_t id
UUID of the seal plug-in.
Definition: seal.h:204
oe_unregister_seal_plugin
oe_result_t oe_unregister_seal_plugin(const oe_uuid_t *plugin_id)
Unregister a plug-in identified by its UUID.
_oe_seal_plugin_definition
Seal plug-in definition.
Definition: seal.h:199
_oe_seal_setting::d
uint32_t d
double-word value. size should be set to 0.
Definition: seal.h:35
_oe_seal_setting::w
uint16_t w
word value. size should be set to 0.
Definition: seal.h:36
_oe_seal_setting::size
uint32_t size
Size of the buffer pointed to by value.p.
Definition: seal.h:31
result.h
_oe_seal_setting::b
uint8_t b
byte value. size should be set to 0.
Definition: seal.h:37
oe_seal_setting_t
struct _oe_seal_setting oe_seal_setting_t
Seal settings as TLV tuples.
OE_SEAL_SETTING_IV
@ OE_SEAL_SETTING_IV
IV (Initialization Vector) to use should the underlying cipher require one.
Definition: seal.h:66
_oe_seal_setting::q
uint64_t q
quad-word value. size should be set to 0.
Definition: seal.h:34
evidence.h
oe_seal
oe_result_t oe_seal(const oe_uuid_t *plugin_id, const oe_seal_setting_t *settings, size_t settings_count, const uint8_t *plaintext, size_t plaintext_size, const uint8_t *additional_data, size_t additional_data_size, uint8_t **blob, size_t *blob_size)
Seal data to an enclave using AEAD (Authenticated Encryption with Additioonal Data).
OE_SEAL_SETTING_MAX
@ OE_SEAL_SETTING_MAX
Upper bound of seal setting types.
Definition: seal.h:73
_oe_seal_setting::p
const void * p
buffer. size should be set to the buffer size in bytes.
Definition: seal.h:39
_oe_seal_plugin_definition::seal
oe_result_t(* seal)(const oe_seal_setting_t *settings, size_t settings_count, const uint8_t *plaintext, size_t plaintext_size, const uint8_t *additional_data, size_t additional_data_size, uint8_t **blob, size_t *blob_size)
Callback function to be called by oe_seal() when sealing a blob.
Definition: seal.h:231
OE_SEAL_SETTING_PLUGIN_DEFINED
@ OE_SEAL_SETTING_PLUGIN_DEFINED
Lower bound of plug-in defined setting types.
Definition: seal.h:80
oe_result_t
enum _oe_result oe_result_t
This enumeration type defines return codes for Open Enclave functions.
_oe_seal_setting
Seal settings as TLV tuples.
Definition: seal.h:28