Skip to content

Commit

Permalink
rename init to finalize
Browse files Browse the repository at this point in the history
  • Loading branch information
evgenyp67 committed Mar 27, 2024
1 parent b49b3be commit 2a5afeb
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/attestation/host/host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ Host::dispatch_ocall(RunData& run_data) {
Report
Host::run(const std::string& nonce) {
Keystone::Enclave enclave;
enclave.init(eapp_file_.c_str(), rt_file_.c_str(), ld_file_.c_str(), params_);
enclave.finalize(eapp_file_.c_str(), rt_file_.c_str(), ld_file_.c_str(), params_);

RunData run_data{
SharedBuffer{enclave.getSharedBuffer(), enclave.getSharedBufferSize()},
Expand Down
2 changes: 1 addition & 1 deletion examples/hello-native/host/host_native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ main(int argc, char** argv) {
params.setFreeMemSize(1024 * 1024);
params.setUntrustedSize(1024 * 1024);

enclave.init(argv[1], argv[2], argv[3], params);
enclave.finalize(argv[1], argv[2], argv[3], params);

enclave.registerOcallDispatch(incoming_call_dispatch);

Expand Down
2 changes: 1 addition & 1 deletion examples/hello/host/host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ main(int argc, char** argv) {
params.setFreeMemSize(256 * 1024);
params.setUntrustedSize(256 * 1024);

enclave.init(argv[1], argv[2], argv[3], params);
enclave.finalize(argv[1], argv[2], argv[3], params);

enclave.registerOcallDispatch(incoming_call_dispatch);
edge_call_init_internals(
Expand Down
2 changes: 1 addition & 1 deletion examples/tests/test-runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ main(int argc, char** argv) {
asm volatile("rdcycle %0" : "=r"(cycles1));
}

enclave.init(eapp_file, rt_file, ld_file, params);
enclave.finalize(eapp_file, rt_file, ld_file, params);

if (self_timing) {
asm volatile("rdcycle %0" : "=r"(cycles2));
Expand Down
4 changes: 2 additions & 2 deletions sdk/include/host/Enclave.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ class Enclave {

public:
Enclave();
Enclave(Params params);
~Enclave();
Error measureSelf(char* hash);
static Error measure(char* hash, const char* eapppath, const char* runtimepath, const char* loaderpath, Params params);
// shared buffer is utm
void* getSharedBuffer();
size_t getSharedBufferSize();
Error registerOcallDispatch(OcallFunc func);
// TODO(Evgeny): rename init to something else. finalize?
Error init(const char* filepath, const char* runtime, const char* loaderpath, Params parameters);
Error finalize(const char* filepath, const char* runtime, const char* loaderpath, Params _params);
Error destroy();
Error run(uintptr_t* ret = nullptr);

Expand Down
5 changes: 4 additions & 1 deletion sdk/src/host/Enclave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ namespace Keystone {
Enclave::Enclave() {
}

Enclave::Enclave(Params params) : params(params) {
}

Enclave::~Enclave() {
assert(destroy() == Error::Success);
}
Expand Down Expand Up @@ -283,7 +286,7 @@ Enclave::finalize() {
}

Error
Enclave::init(const char* eapppath, const char* runtimepath, const char* loaderpath, Params _params) {
Enclave::finalize(const char* eapppath, const char* runtimepath, const char* loaderpath, Params _params) {
params = _params;

Error err = addStandard(eapppath, runtimepath, loaderpath);
Expand Down

0 comments on commit 2a5afeb

Please sign in to comment.