From 4fadb27376abaa79b31a16799cea9b8240d09f4a Mon Sep 17 00:00:00 2001 From: Yilong Wang <2548340423@qq.com> Date: Sun, 26 May 2024 20:23:01 +0800 Subject: [PATCH] refactor penglai config to the file penglai-config.h Signed-off-by: Yilong Wang <2548340423@qq.com> --- penglai-enclave-driver/penglai-config.h | 28 +++++++++++++++++++ .../penglai-enclave-ioctl.h | 16 +---------- 2 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 penglai-enclave-driver/penglai-config.h diff --git a/penglai-enclave-driver/penglai-config.h b/penglai-enclave-driver/penglai-config.h new file mode 100644 index 000000000..dc25936dd --- /dev/null +++ b/penglai-enclave-driver/penglai-config.h @@ -0,0 +1,28 @@ +#ifndef _PENGLAI_CONFIG_H +#define _PENGLAI_CONFIG_H + +#define NONCE 12345 +#define MD_SIZE 64 +#define MAX_ELF_SIZE 512*1024*1024 +#define MAX_STACK_SIZE 64*1024*1024 +#define DEFAULT_STACK_SIZE 1024*1024 +#define MAX_UNTRUSTED_MEM_SIZE 16*1024*1024 +#define DEFAULT_UNTRUSTED_SIZE 8*1024 + +//TODO: 64? +#define PRIVATE_KEY_SIZE 32 +//TODO: 32? +#define PUBLIC_KEY_SIZE 64 +#define HASH_SIZE 32 +#define SIGNATURE_SIZE 64 + +#define DEFAULT_CLOCK_DELAY 100000 +#define DEFAULT_UNTRUSTED_PTR 0x0000001000000000 +#define ENCLAVE_DEFAULT_KBUFFER_SIZE 0x1000UL +#define ENCLAVE_DEFAULT_KBUFFER 0xffffffe000000000UL + +#define USER_PARAM_RESUME_FROM_CUSTOM_OCALL 1000 + +#define STACK_POINT 0x0000004000000000 +#endif + diff --git a/penglai-enclave-driver/penglai-enclave-ioctl.h b/penglai-enclave-driver/penglai-enclave-ioctl.h index 1d97eda57..c6cadb04c 100644 --- a/penglai-enclave-driver/penglai-enclave-ioctl.h +++ b/penglai-enclave-driver/penglai-enclave-ioctl.h @@ -1,6 +1,7 @@ #ifndef _PENGLAI_ENCLAVE_IOCTL #define _PENGLAI_ENCLAVE_IOCTL #include "penglai-enclave.h" +#include "penglai-config.h" #include #include #include @@ -25,9 +26,6 @@ #define DEFAULT_SECURE_PAGES_ORDER 10 #define DEFAULT_CLOCK_DELAY 100000 -#define DEFAULT_UNTRUSTED_PTR 0x0000001000000000 -#define ENCLAVE_DEFAULT_KBUFFER_SIZE 0x1000UL -#define ENCLAVE_DEFAULT_KBUFFER 0xffffffe000000000UL #define USER_PARAM_RESUME_FROM_CUSTOM_OCALL 1000 @@ -66,18 +64,6 @@ struct penglai_enclave_sbi_param typedef unsigned char byte; -#define MD_SIZE 64 -#define MAX_ELF_SIZE 512*1024*1024 -#define MAX_STACK_SIZE 64*1024*1024 -#define MAX_UNTRUSTED_MEM_SIZE 16*1024*1024 - -//TODO: 64? -#define PRIVATE_KEY_SIZE 32 -//TODO: 32? -#define PUBLIC_KEY_SIZE 64 -#define HASH_SIZE 32 -#define SIGNATURE_SIZE 64 - struct sm_report_t { unsigned char hash[HASH_SIZE];