Abstract base class for trusted applications.
More...
#include <trusted_application.h>
|
int | __asylo_user_init (const char *name, const char *config, size_t config_len, char **output, size_t *output_len) |
|
int | __asylo_user_run (const char *input, size_t input_len, char **output, size_t *output_len) |
|
int | __asylo_user_fini (const char *input, size_t input_len, char **output, size_t *output_len) |
|
Abstract base class for trusted applications.
To implement an enclave application, client code declares a TrustedApplication and implements the entry points it wishes to handle. For example:
class HelloWorld : public TrustedApplication {
public:
Status
Initialize(
const EnclaveConfig &config)
override {
}
Status
Run(
const EnclaveInput &input, EnclaveOutput *output)
override {
}
Status
Finalize(
const EnclaveFinal &fini)
override {
}
};
At startup, the runtime will call the user supplied function BuildTrustedApplication and install the returned instance as the handler for enclave entries events. For instance:
Note that types derived from TrustedApplication must be trivially destructible, and any such destructor will never be invoked by the runtime.
◆ ~TrustedApplication()
virtual asylo::TrustedApplication::~TrustedApplication |
( |
| ) |
|
|
virtualdefault |
Trivial destructor.
Trivial destructor. Note that classes derived from of TrustedApplication must not add a non-trivial destructor, as they will not be called by the enclave runtime.
◆ Finalize()
virtual Status asylo::TrustedApplication::Finalize |
( |
const EnclaveFinal & |
final_input | ) |
|
|
inlinevirtual |
Implements enclave finalization behavior.
- Parameters
-
final_input | Message passed on enclave finalization. |
- Returns
- OK status or error
◆ Initialize()
virtual Status asylo::TrustedApplication::Initialize |
( |
const EnclaveConfig & |
config | ) |
|
|
inlinevirtual |
Implements enclave initialization entry-point.
- Parameters
-
config | The configuration used to initialize the enclave. |
- Returns
- An OK status or an error if the enclave could not be initialized.
◆ Run()
virtual Status asylo::TrustedApplication::Run |
( |
const EnclaveInput & |
input, |
|
|
EnclaveOutput * |
output |
|
) |
| |
|
inlinevirtual |
Implements enclave execution entry-point.
- Parameters
-
input | Message passed to determine behavior for the Run routine. |
output | Message passed back to the untrusted caller. |
- Returns
- OK status or error
◆ __asylo_user_fini
int __asylo_user_fini |
( |
const char * |
input, |
|
|
size_t |
input_len, |
|
|
char ** |
output, |
|
|
size_t * |
output_len |
|
) |
| |
|
friend |
◆ __asylo_user_init
int __asylo_user_init |
( |
const char * |
name, |
|
|
const char * |
config, |
|
|
size_t |
config_len, |
|
|
char ** |
output, |
|
|
size_t * |
output_len |
|
) |
| |
|
friend |
◆ __asylo_user_run
int __asylo_user_run |
( |
const char * |
input, |
|
|
size_t |
input_len, |
|
|
char ** |
output, |
|
|
size_t * |
output_len |
|
) |
| |
|
friend |
◆ BuildTrustedApplication()
User-supplied factory function for making a trusted application instance.
- Returns
- A new TrustedApplication instance, or nullptr on failure.
◆ GetApplicationInstance()
Returns the trusted application instance.
- Returns
- The enclave application instance or nullptr on failure.
The documentation for this class was generated from the following file: