Skip to content

Commit 62dc69d

Browse files
committed
Add 'const' to sgx_create_enclave_ex()
Signed-off-by: Zhang Lili Z <[email protected]>
1 parent a169a69 commit 62dc69d

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

SampleCode/Switchless/App/App.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ int initialize_enclave(const sgx_uswitchless_config_t* us_config)
199199
/* Step 2: call sgx_create_enclave to initialize an enclave instance */
200200
/* Debug Support: set 2nd parameter to 1 */
201201

202-
void* enclave_ex_p[32] = { 0 };
202+
const void* enclave_ex_p[32] = { 0 };
203203

204204
enclave_ex_p[SGX_CREATE_ENCLAVE_EX_SWITCHLESS_BIT_IDX] = (void*)us_config;
205205

common/inc/sgx_urts.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ sgx_status_t SGXAPI sgx_create_enclave_ex(const char * file_name,
8282
sgx_enclave_id_t * enclave_id,
8383
sgx_misc_attribute_t * misc_attr,
8484
const uint32_t ex_features,
85-
void* ex_features_p[32]);
85+
const void* ex_features_p[32]);
8686

8787

8888
sgx_status_t SGXAPI sgx_create_encrypted_enclave(

psw/urts/linux/urts.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
#include "urts_com.h"
4242

43-
static bool inline _check_ex_params_(const uint32_t ex_features, void* ex_features_p[32])
43+
static bool inline _check_ex_params_(const uint32_t ex_features, const void* ex_features_p[32])
4444
{
4545
//update last feature index if it fails here
4646
se_static_assert(_SGX_LAST_EX_FEATURE_IDX_ == SGX_CREATE_ENCLAVE_EX_SWITCHLESS_BIT_IDX);
@@ -64,7 +64,7 @@ extern "C" sgx_status_t __sgx_create_enclave_ex(const char *file_name,
6464
sgx_enclave_id_t *enclave_id,
6565
sgx_misc_attribute_t *misc_attr,
6666
const uint32_t ex_features,
67-
void* ex_features_p[32])
67+
const void* ex_features_p[32])
6868
{
6969
sgx_status_t ret = SGX_SUCCESS;
7070

@@ -120,7 +120,7 @@ extern "C" sgx_status_t sgx_create_enclave_ex(const char *file_name,
120120
sgx_enclave_id_t *enclave_id,
121121
sgx_misc_attribute_t *misc_attr,
122122
const uint32_t ex_features,
123-
void* ex_features_p[32])
123+
const void* ex_features_p[32])
124124
{
125125

126126
return __sgx_create_enclave_ex(file_name, debug, launch_token,
@@ -139,7 +139,7 @@ sgx_create_encrypted_enclave(
139139
uint8_t* sealed_key)
140140
{
141141
uint32_t ex_features = SGX_CREATE_ENCLAVE_EX_PCL;
142-
void* ex_features_p[32] = { 0 };
142+
const void* ex_features_p[32] = { 0 };
143143
ex_features_p[SGX_CREATE_ENCLAVE_EX_PCL_BIT_IDX] = (void*)sealed_key;
144144

145145
return __sgx_create_enclave_ex(file_name, debug, launch_token,

psw/urts/urts_com.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static int __create_enclave(BinParser &parser,
193193
sgx_enclave_id_t *enclave_id,
194194
sgx_misc_attribute_t *misc_attr,
195195
const uint32_t ex_features,
196-
void* ex_features_p[32])
196+
const void* ex_features_p[32])
197197
{
198198
// The "parser" will be registered into "loader" and "loader" will be registered into "enclave".
199199
// After enclave is created, "parser" and "loader" are not needed any more.
@@ -425,7 +425,7 @@ static int __create_enclave(BinParser &parser,
425425

426426
sgx_status_t _create_enclave_ex(const bool debug, se_file_handle_t pfile, se_file_t& file, le_prd_css_file_t *prd_css_file,
427427
sgx_launch_token_t *launch, int *launch_updated, sgx_enclave_id_t *enclave_id,
428-
sgx_misc_attribute_t *misc_attr, const uint32_t ex_features, void* ex_features_p[32])
428+
sgx_misc_attribute_t *misc_attr, const uint32_t ex_features, const void* ex_features_p[32])
429429
{
430430
unsigned int ret = SGX_SUCCESS;
431431
sgx_status_t lt_result = SGX_SUCCESS;

0 commit comments

Comments
 (0)