From e9fcf7f26a788c282647f820393dd262560f60cc Mon Sep 17 00:00:00 2001 From: Gregor Haas Date: Thu, 25 Jan 2024 18:00:33 -0800 Subject: [PATCH] make sure sm_copy_key is defined for cva6 --- sm/src/platform/fpga/ariane/platform.c | 14 ++++++++++++++ sm/src/platform/fpga/ariane/platform.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/sm/src/platform/fpga/ariane/platform.c b/sm/src/platform/fpga/ariane/platform.c index 26feddd51..70465202a 100644 --- a/sm/src/platform/fpga/ariane/platform.c +++ b/sm/src/platform/fpga/ariane/platform.c @@ -1,5 +1,6 @@ /* Default platform does nothing special here */ #include "../../../enclave.h" +#include unsigned long platform_init_global_once(){ return SBI_ERR_SM_ENCLAVE_SUCCESS; @@ -42,3 +43,16 @@ uint64_t platform_random(){ x += (w += s); return (x>>32) | (x<<32); } + +// Initialization functions +extern byte dev_public_key[PUBLIC_KEY_SIZE]; + +// Todo secure boot +void sm_copy_key(void) +{ + sbi_memset(sm_hash, 0, MDSIZE); + sbi_memset(sm_signature, 0, SIGNATURE_SIZE); + sbi_memset(sm_public_key, 0, PUBLIC_KEY_SIZE); + sbi_memset(sm_private_key, 0, PRIVATE_KEY_SIZE); + sbi_memset(dev_public_key, 0, PUBLIC_KEY_SIZE); +} diff --git a/sm/src/platform/fpga/ariane/platform.h b/sm/src/platform/fpga/ariane/platform.h index 1fcc0fff1..09fa7841f 100644 --- a/sm/src/platform/fpga/ariane/platform.h +++ b/sm/src/platform/fpga/ariane/platform.h @@ -22,4 +22,8 @@ struct platform_enclave_data{ // CPU configuration #define MAX_HARTS 5 + +// Initialization functions +void sm_copy_key(void); + #endif // _PLATFORM_H_