diff --git a/firmware/src/powhsm/src/bc_err.c b/firmware/src/powhsm/src/bc_err.c index 8176d6db..5fcbd53f 100644 --- a/firmware/src/powhsm/src/bc_err.c +++ b/firmware/src/powhsm/src/bc_err.c @@ -74,7 +74,6 @@ void show_error(err_code_t errcode) { break; } } - (void)(msg); LOG("*** ERROR: %s\n", msg); } #else diff --git a/firmware/src/sgx/.gitignore b/firmware/src/sgx/.gitignore index 09a3f9c5..1aa71878 100644 --- a/firmware/src/sgx/.gitignore +++ b/firmware/src/sgx/.gitignore @@ -1,2 +1,11 @@ # Private key file private.pem + +# OE generated files +src/trusted/hsm_args.h +src/trusted/hsm_t.c +src/trusted/hsm_t.h +src/untrusted/hsm_args.h +src/untrusted/hsm_u.c +src/untrusted/hsm_u.h + diff --git a/firmware/src/sgx/src/untrusted/enclave_provider.c b/firmware/src/sgx/src/untrusted/enclave_provider.c index 28007f1a..ce30f851 100644 --- a/firmware/src/sgx/src/untrusted/enclave_provider.c +++ b/firmware/src/sgx/src/untrusted/enclave_provider.c @@ -33,7 +33,7 @@ static char* G_enclave_path = NULL; static oe_enclave_t* G_enclave = NULL; -bool ep_init(char* enclave_path) { +bool epro_init(char* enclave_path) { G_enclave_path = enclave_path; if (access(G_enclave_path, F_OK) != 0) { LOG("Invalid enclave path given: %s\n", G_enclave_path); @@ -42,7 +42,7 @@ bool ep_init(char* enclave_path) { return true; } -oe_enclave_t* ep_get_enclave() { +oe_enclave_t* epro_get_enclave() { if (NULL == G_enclave) { oe_enclave_t *enclave = NULL; LOG("Creating HSM enclave...\n"); @@ -61,7 +61,7 @@ oe_enclave_t* ep_get_enclave() { return G_enclave; } -void ep_finalize_enclave() { +void epro_finalize_enclave() { if (NULL != G_enclave) { oe_terminate_enclave(G_enclave); LOG("HSM enclave terminated\n"); diff --git a/firmware/src/sgx/src/untrusted/enclave_provider.h b/firmware/src/sgx/src/untrusted/enclave_provider.h index 61550fd5..37a31f91 100644 --- a/firmware/src/sgx/src/untrusted/enclave_provider.h +++ b/firmware/src/sgx/src/untrusted/enclave_provider.h @@ -32,7 +32,7 @@ * * @returns Whether initialization succeeded */ -bool ep_init(char* enclave_path); +bool epro_init(char* enclave_path); /** * @brief Returns a pointer to the HSM enclave. This function should always @@ -41,12 +41,12 @@ bool ep_init(char* enclave_path); * * @returns A valid pointer to the HSM enclave, or NULL if an error occurred */ -oe_enclave_t* ep_get_enclave(); +oe_enclave_t* epro_get_enclave(); /** * @brief Terminates the HSM enclave. After this function is called, * all ecall operations will fail. */ -void ep_finalize_enclave(); +void epro_finalize_enclave(); #endif // __ENCLAVE_PROVIDER_H diff --git a/firmware/src/sgx/src/untrusted/enclave_proxy.c b/firmware/src/sgx/src/untrusted/enclave_proxy.c index ab266360..6e402b56 100644 --- a/firmware/src/sgx/src/untrusted/enclave_proxy.c +++ b/firmware/src/sgx/src/untrusted/enclave_proxy.c @@ -22,8 +22,8 @@ * ECALLS */ -bool ep_system_init(unsigned char *msg_buffer, size_t msg_buffer_size) { - oe_enclave_t *enclave = ep_get_enclave(); +bool eprx_system_init(unsigned char *msg_buffer, size_t msg_buffer_size) { + oe_enclave_t *enclave = epro_get_enclave(); if (enclave == NULL) { LOG("Failed to retrieve the enclave. " "Unable to call system_init().\n"); @@ -37,8 +37,8 @@ bool ep_system_init(unsigned char *msg_buffer, size_t msg_buffer_size) { return result; } -unsigned int ep_system_process_apdu(unsigned int rx) { - oe_enclave_t *enclave = ep_get_enclave(); +unsigned int eprx_system_process_apdu(unsigned int rx) { + oe_enclave_t *enclave = epro_get_enclave(); if (enclave == NULL) { LOG("Failed to retrieve the enclave. " "Unable to call system_process_command().\n"); diff --git a/firmware/src/sgx/src/untrusted/enclave_proxy.h b/firmware/src/sgx/src/untrusted/enclave_proxy.h index 46e1c637..4565ab12 100644 --- a/firmware/src/sgx/src/untrusted/enclave_proxy.h +++ b/firmware/src/sgx/src/untrusted/enclave_proxy.h @@ -6,11 +6,11 @@ /** * @brief See system_init in system.h within the trusted sources */ -bool ep_system_init(unsigned char *msg_buffer, size_t msg_buffer_size); +bool eprx_system_init(unsigned char *msg_buffer, size_t msg_buffer_size); /** * @brief See system_process_apdu in system.h within the trusted sources */ -unsigned int ep_system_process_apdu(unsigned int rx); +unsigned int eprx_system_process_apdu(unsigned int rx); #endif // __HSM_PROXY \ No newline at end of file diff --git a/firmware/src/sgx/src/untrusted/main.c b/firmware/src/sgx/src/untrusted/main.c index 203b057e..56dfc1fd 100644 --- a/firmware/src/sgx/src/untrusted/main.c +++ b/firmware/src/sgx/src/untrusted/main.c @@ -129,13 +129,13 @@ int main(int argc, char **argv) { LOG("SGX powHSM starting...\n"); LOG("Initialising enclave provider...\n"); - if (!ep_init(arguments.enclave_path)) { + if (!epro_init(arguments.enclave_path)) { LOG("Error initialising enclave provider\n"); goto main_error; } LOG("Initialising system...\n"); - if (!ep_system_init(io_apdu_buffer, sizeof(io_apdu_buffer))) { + if (!eprx_system_init(io_apdu_buffer, sizeof(io_apdu_buffer))) { LOG("Error initialising system\n"); goto main_error; } @@ -157,7 +157,7 @@ int main(int argc, char **argv) { rx = io_exchange(tx); if (rx) { - tx = ep_system_process_apdu(rx); + tx = eprx_system_process_apdu(rx); } }