From d566ed96c01664102e554cd5d60bbb8b831cbb72 Mon Sep 17 00:00:00 2001 From: pengxuanyao Date: Thu, 27 Apr 2023 20:06:42 +0800 Subject: [PATCH 1/2] fix bugs in enclave.c: * add parameter definition for check_enclave_authentication * add parameter declaration for platform_check_enclave_authentication --- opensbi-0.9/include/sm/platform/pmp/platform_thread.h | 2 +- opensbi-0.9/include/sm/platform/spmp/platform_thread.h | 2 +- opensbi-0.9/lib/sbi/sm/enclave.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/opensbi-0.9/include/sm/platform/pmp/platform_thread.h b/opensbi-0.9/include/sm/platform/pmp/platform_thread.h index 36a7e720a..6fcf6ecf2 100644 --- a/opensbi-0.9/include/sm/platform/pmp/platform_thread.h +++ b/opensbi-0.9/include/sm/platform/pmp/platform_thread.h @@ -6,7 +6,7 @@ void platform_enter_enclave_world(); void platform_exit_enclave_world(); int platform_check_in_enclave_world(); -int platform_check_enclave_authentication(); +int platform_check_enclave_authentication(struct enclave_t* enclave); void platform_switch_to_enclave_ptbr(struct thread_state_t* thread, uintptr_t ptbr); void platform_switch_to_host_ptbr(struct thread_state_t* thread, uintptr_t ptbr); diff --git a/opensbi-0.9/include/sm/platform/spmp/platform_thread.h b/opensbi-0.9/include/sm/platform/spmp/platform_thread.h index ee306ba87..d1189a793 100644 --- a/opensbi-0.9/include/sm/platform/spmp/platform_thread.h +++ b/opensbi-0.9/include/sm/platform/spmp/platform_thread.h @@ -9,7 +9,7 @@ void platform_exit_enclave_world(); int platform_check_in_enclave_world(); -int platform_check_enclave_authentication(); +int platform_check_enclave_authentication(struct enclave_t* enclave); void platform_switch_to_enclave_ptbr(struct thread_state_t* thread, uintptr_t ptbr); diff --git a/opensbi-0.9/lib/sbi/sm/enclave.c b/opensbi-0.9/lib/sbi/sm/enclave.c index 1bca95abf..8a990d404 100644 --- a/opensbi-0.9/lib/sbi/sm/enclave.c +++ b/opensbi-0.9/lib/sbi/sm/enclave.c @@ -52,9 +52,9 @@ int check_in_enclave_world() return 0; } -static int check_enclave_authentication() +static int check_enclave_authentication(struct enclave_t* enclave) { - if(platform_check_enclave_authentication() < 0) + if(platform_check_enclave_authentication(enclave) < 0) return -1; return 0; From 06ff232c412255c811ff6d6a9c7ceaf45df6b65b Mon Sep 17 00:00:00 2001 From: pengxuanyao Date: Thu, 27 Apr 2023 20:16:30 +0800 Subject: [PATCH 2/2] fix bugs in enclave.c: * add parameter definition for check_enclave_authentication * add parameter declaration for platform_check_enclave_authentication --- opensbi-1.0/include/sm/platform/pmp/platform_thread.h | 2 +- opensbi-1.0/include/sm/platform/spmp/platform_thread.h | 2 +- opensbi-1.0/lib/sbi/sm/enclave.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/opensbi-1.0/include/sm/platform/pmp/platform_thread.h b/opensbi-1.0/include/sm/platform/pmp/platform_thread.h index 36a7e720a..6fcf6ecf2 100644 --- a/opensbi-1.0/include/sm/platform/pmp/platform_thread.h +++ b/opensbi-1.0/include/sm/platform/pmp/platform_thread.h @@ -6,7 +6,7 @@ void platform_enter_enclave_world(); void platform_exit_enclave_world(); int platform_check_in_enclave_world(); -int platform_check_enclave_authentication(); +int platform_check_enclave_authentication(struct enclave_t* enclave); void platform_switch_to_enclave_ptbr(struct thread_state_t* thread, uintptr_t ptbr); void platform_switch_to_host_ptbr(struct thread_state_t* thread, uintptr_t ptbr); diff --git a/opensbi-1.0/include/sm/platform/spmp/platform_thread.h b/opensbi-1.0/include/sm/platform/spmp/platform_thread.h index ee306ba87..d1189a793 100644 --- a/opensbi-1.0/include/sm/platform/spmp/platform_thread.h +++ b/opensbi-1.0/include/sm/platform/spmp/platform_thread.h @@ -9,7 +9,7 @@ void platform_exit_enclave_world(); int platform_check_in_enclave_world(); -int platform_check_enclave_authentication(); +int platform_check_enclave_authentication(struct enclave_t* enclave); void platform_switch_to_enclave_ptbr(struct thread_state_t* thread, uintptr_t ptbr); diff --git a/opensbi-1.0/lib/sbi/sm/enclave.c b/opensbi-1.0/lib/sbi/sm/enclave.c index 1bca95abf..8a990d404 100644 --- a/opensbi-1.0/lib/sbi/sm/enclave.c +++ b/opensbi-1.0/lib/sbi/sm/enclave.c @@ -52,9 +52,9 @@ int check_in_enclave_world() return 0; } -static int check_enclave_authentication() +static int check_enclave_authentication(struct enclave_t* enclave) { - if(platform_check_enclave_authentication() < 0) + if(platform_check_enclave_authentication(enclave) < 0) return -1; return 0;