19 #ifndef ASYLO_PLATFORM_PRIMITIVES_TRUSTED_PRIMITIVES_H_ 20 #define ASYLO_PLATFORM_PRIMITIVES_TRUSTED_PRIMITIVES_H_ 25 #include "asylo/platform/primitives/extent.h" 26 #include "asylo/platform/primitives/primitive_status.h" 27 #include "asylo/platform/primitives/primitives.h" 28 #include "asylo/platform/primitives/util/message.h" 29 #include "asylo/util/asylo_macros.h" 62 static void DebugPuts(
const char *message);
116 size_t size)
noexcept;
190 bool IsNull()
const {
return callback ==
nullptr; }
212 template <
typename T>
void * context
Uninterpreted data passed by the runtime to invocations of the handler.
Definition: trusted_primitives.h:199
static bool IsInsideEnclave(const void *addr, size_t size) ASYLO_MUST_USE_RESULT
A predicate that decides if a region of memory is internal to the enclave.
bool IsNull() const
A predicate for whether the callback is initialized.
Definition: trusted_primitives.h:190
Trusted runtime primitive interface.
Definition: trusted_primitives.h:42
static void DebugPuts(const char *message)
Writes a message to a stream suitable for debug output.
void operator()(void *ptr) const
Definition: trusted_primitives.h:206
operator bool() const
Implicit bool conversion for null checks.
Definition: trusted_primitives.h:193
Deleter for untrusted memory for use with std::unique_ptr.
Definition: trusted_primitives.h:205
static bool IsOutsideEnclave(const void *addr, size_t size) ASYLO_MUST_USE_RESULT
A predicate that decides if a region of memory is external to the enclave.
ABSL_CONST_INIT const char kStatusMoveAssignmentMsg[]
EntryHandler(Callback callback, void *context)
Initializes an entry handler with a callback and a context pointer.
Definition: trusted_primitives.h:184
EntryHandler(Callback callback)
Constructs an entry handler with a callback and null context.
Definition: trusted_primitives.h:175
static void UntrustedLocalFree(void *ptr) noexcept
Calls untrusted local counterpart to free memory allocated by malloc in local untrusted code or by ca...
static void * UntrustedLocalMemcpy(void *dest, const void *src, size_t size) noexcept
Copies size bytes of memory from src to dest.
static void BestEffortAbort(const char *message)
Aborts the enclave on a best-effort basis.
static void * UntrustedLocalAlloc(size_t size) noexcept ASYLO_MUST_USE_RESULT
Allocates size bytes of untrusted local memory.
static int CreateThread()
Creates a new thread.
EntryHandler()
Constructs a null handler.
Definition: trusted_primitives.h:170
Callback callback
Callback function to invoke for this entry.
Definition: trusted_primitives.h:196
Callback structure for dispatching messages passed to the enclave.
Definition: trusted_primitives.h:162
static PrimitiveStatus UntrustedCall(uint64_t untrusted_selector, MessageWriter *input, MessageReader *output) ASYLO_MUST_USE_RESULT
Exits the enclave synchronously at an entry point to untrusted code designated by untrusted_selector...
static PrimitiveStatus RegisterEntryHandler(uint64_t trusted_selector, const EntryHandler &handler) ASYLO_MUST_USE_RESULT
Registers a callback as the handler routine for an enclave entry point trusted_selector.