Skip to content

Commit

Permalink
Merge pull request keystone-enclave#188 from keystone-enclave/dev-sdk…
Browse files Browse the repository at this point in the history
…-refactor

Refactoring SDK: change tests to comply with new version
  • Loading branch information
dayeol authored Jun 24, 2020
2 parents 6b0903e + 46a97ff commit df45ec7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion sdk
Submodule sdk updated 58 files
+10 −0 .clang-format
+5 −6 .travis.yml
+19 −2 CMakeLists.txt
+0 −5 Makefile
+3 −6 common/include/sha3.h
+0 −0 common/src/sha3.c
+1 −1 examples/tests/edge_wrapper.h
+1 −1 examples/tests/test-runner.cpp
+23 −0 lib/CMakeLists.txt
+14 −14 lib/host/CMakeLists.txt
+59 −0 lib/host/include/ElfFile.hpp
+77 −0 lib/host/include/Enclave.hpp
+63 −0 lib/host/include/Error.hpp
+70 −0 lib/host/include/KeystoneDevice.hpp
+154 −0 lib/host/include/Memory.hpp
+64 −0 lib/host/include/Params.hpp
+8 −11 lib/host/include/common.h
+0 −56 lib/host/include/elffile.h
+0 −177 lib/host/include/hash_util.h
+22 −0 lib/host/include/hash_util.hpp
+1 −85 lib/host/include/keystone.h
+0 −66 lib/host/include/keystone_device.h
+32 −40 lib/host/include/keystone_user.h
+0 −56 lib/host/include/memory.h
+6 −1 lib/host/include/page.h
+0 −44 lib/host/include/params.h
+0 −37 lib/host/include/sha3.h
+37 −41 lib/host/src/ElfFile.cpp
+460 −0 lib/host/src/Enclave.cpp
+184 −0 lib/host/src/KeystoneDevice.cpp
+297 −0 lib/host/src/Memory.cpp
+56 −0 lib/host/src/PhysicalEnclaveMemory.cpp
+51 −0 lib/host/src/SimulatedEnclaveMemory.cpp
+0 −0 lib/host/src/elf.c
+0 −0 lib/host/src/elf32.c
+0 −0 lib/host/src/elf64.c
+38 −0 lib/host/src/hash_util.cpp
+0 −531 lib/host/src/keystone.cpp
+0 −92 lib/host/src/keystone_device.cpp
+0 −56 lib/host/src/memory.cpp
+0 −164 lib/host/src/sha3.cpp
+7 −8 lib/verifier/CMakeLists.txt
+0 −38 lib/verifier/Makefile
+1 −1 lib/verifier/ed25519/keypair.c
+1 −1 lib/verifier/ed25519/sign.c
+2 −2 lib/verifier/ed25519/verify.c
+1 −1 lib/verifier/report.h
+48 −0 tests/CMakeLists.txt
+0 −37 tests/Makefile
+18 −16 tests/keystone_test.cpp
+5 −10 tests/scripts/setup_binary.sh
+5 −0 tests/test_binary/CMakeLists.txt
+0 −0 tests/test_binary/tests/.gitignore
+0 −0 tests/test_binary/tests/Makefile
+0 −0 tests/test_binary/tests/app.lds
+0 −0 tests/test_binary/tests/app.mk
+0 −0 tests/test_binary/tests/stack/Makefile
+0 −0 tests/test_binary/tests/stack/stack.s
4 changes: 2 additions & 2 deletions tests/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ SDK_VERIFIER_LIB := $(SDK_LIB_DIR)/libkeystone-verifier.a
SDK_INCLUDE_HOST_DIR := $(SDK_LIB_DIR)/host/include
SDK_INCLUDE_EDGE_DIR := $(SDK_LIB_DIR)/edge/include
SDK_INCLUDE_VERIFIER_DIR := $(SDK_LIB_DIR)/verifier

SDK_INCLUDE_COMMON_DIR := $(KEYSTONE_SDK_DIR)/common/include
O := $(shell pwd)

RUNTIME := eyrie-rt
RUNNER := test-runner.riscv
CCFLAGS := -I$(SDK_INCLUDE_HOST_DIR) -I$(SDK_INCLUDE_EDGE_DIR) -I$(SDK_INCLUDE_VERIFIER_DIR) -std=c++11
CCFLAGS := -I$(SDK_INCLUDE_HOST_DIR) -I$(SDK_INCLUDE_EDGE_DIR) -I$(SDK_INCLUDE_VERIFIER_DIR) -I$(SDK_INCLUDE_COMMON_DIR) -std=c++11
LDFLAGS := -L$(SDK_LIB_DIR)

TESTS=stack fibonacci long-nop loop malloc fib-bench untrusted attestation data-sealing
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/edge_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define OCALL_GET_STRING 4


int edge_init(Keystone* enclave){
int edge_init(Keystone::Enclave* enclave){

enclave->registerOcallDispatch(incoming_call_dispatch);
register_call(OCALL_PRINT_BUFFER, print_buffer_wrapper);
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/edge_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ typedef struct packaged_str{

typedef unsigned char byte;

int edge_init(Keystone* enclave);
int edge_init(Keystone::Enclave* enclave);

void print_buffer_wrapper(void* buffer);
unsigned long print_buffer(char* str);
Expand Down
13 changes: 9 additions & 4 deletions tests/tests/test-runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ int main(int argc, char** argv)
}
}

Keystone enclave;
Params params;
Keystone::Enclave enclave;
Keystone::Params params;
unsigned long cycles1,cycles2,cycles3,cycles4;

params.setFreeMemSize(freemem_size);
Expand All @@ -133,7 +133,7 @@ int main(int argc, char** argv)
asm volatile ("rdcycle %0" : "=r" (cycles3));
}

int retcode = 0;
Keystone::Error retcode = Keystone::Error::Success;
if( !load_only )
retcode = enclave.run();

Expand All @@ -143,5 +143,10 @@ int main(int argc, char** argv)
printf("[keystone-test] Runtime: %lu cycles\r\n", cycles4-cycles3);
}

return retcode;
if (retcode != Keystone::Error::Success)
{
printf("Test Failed\n");
}

return 0;
}

0 comments on commit df45ec7

Please sign in to comment.