adapte to chcore kernel

Signed-off-by: suwanghw <wangsu14@huawei.com>
This commit is contained in:
suwanghw
2023-07-12 18:20:57 +08:00
parent ecdd2621f5
commit 8753a22aeb
19 changed files with 47 additions and 23 deletions
Regular → Executable
View File
+4
View File
@@ -88,3 +88,7 @@ CONFIG_ARCH_ARM=y
CONFIG_ARCH_AARCH64=y
CONFIG_ARM_CORTEX_A53=y
CONFIG_CC_STACKPROTECTOR_STRONG=y
#
# Log
#
TLOG_USE_TEE_PRINT=y
@@ -89,3 +89,7 @@ CONFIG_ARCH_ARM=y
CONFIG_ARCH_AARCH64=y
CONFIG_ARM_CORTEX_A53=y
CONFIG_CC_STACKPROTECTOR_STRONG=y
#
# Log
#
TLOG_USE_TEE_PRINT=y
+5 -3
View File
@@ -52,8 +52,10 @@ const struct task_info_st *get_teeos_builtin_task_infos(void)
#define RPMB_HUK_HEAP_DIV 2
#define SSA_DEFAULT_HEAP_HEAPMGR_MUL 24
#define HUK_DEFAULT_HEAP_HEAPMGR_MUL 24
#define PERM_SRV_STACK_SIZE (DEFAULT_STACK_SIZE * 8)
#define PERM_SRV_HEAP_SIZE (DEFAULT_HEAP_SIZE * 3)
#define HUk_SRV_STACK_SIZE (DEFAULT_STACK_SIZE * 2)
#define HUK_SRV_HEAP_SIZE (DEFAULT_HEAP_SIZE * 2)
#define PERM_SRV_STACK_SIZE (DEFAULT_STACK_SIZE * 16)
#define PERM_SRV_HEAP_SIZE (DEFAULT_HEAP_SIZE * 8)
#define PERM_SRV_DEFAULT_HEAP_HEAPMGR_MUL (DEFAULT_HEAP_SIZE * 24)
/* build in service propertys for teeos */
@@ -65,7 +67,7 @@ const struct ta_property g_teeos_service_property[] = {
true, false, false, false, NULL, 0 },
#endif
#if (defined TEE_SUPPORT_HUK_SERVICE_32BIT || defined TEE_SUPPORT_HUK_SERVICE_64BIT)
{ TEE_SERVICE_HUK, DEFAULT_STACK_SIZE / RPMB_HUK_STACK_DIV, DEFAULT_HEAP_SIZE / RPMB_HUK_HEAP_DIV,
{ TEE_SERVICE_HUK, HUk_SRV_STACK_SIZE, HUK_SRV_HEAP_SIZE,
true, false, false, false, NULL, 0 },
#endif
#if (defined TEE_SUPPORT_PERM_64BIT || defined TEE_SUPPORT_PERM_32BIT)
+1 -1
View File
@@ -133,7 +133,7 @@ struct ta2ta_info_t {
#define session_id_of_context(context) (context & 0x0000ffff)
#define GLOBAL_TSK_ID 0
#define SMCMGR_PID 1
#define SMCMGR_PID 6
#define REET_TSK_ID SMCMGR_PID
#define TASK_ID_NULL 0xFFFFFFFF
@@ -53,7 +53,7 @@ struct service_struct *get_cur_service(void)
return g_cur_service;
}
static TEE_Result call_ta_invoke_close_session(const smc_cmd_t *cmd, uint32_t cmd_type, uint32_t cmd_id,
static TEE_Result __attribute__((noinline)) call_ta_invoke_close_session(const smc_cmd_t *cmd, uint32_t cmd_type, uint32_t cmd_id,
global_to_ta_msg *entry_msg)
{
TEE_Result ret;
+1 -1
View File
@@ -17,7 +17,7 @@ include $(BUILD_CONFIG)/var.mk
tarunner_c_files := $(wildcard src/*.c)
# Libraries
LIBS := c_shared${TARG}
LIBS := c_shared$(TARG) tee_shared$(TARG)
inc-flags += -I$(SYSLIB)/libspawn_common/include/
inc-flags += -I$(DRVLIB)/libdrv_shared/src/
-1
View File
@@ -48,7 +48,6 @@ static const char *g_tarunner_path = "/tarunner_a32.elf";
static const char *g_drv_so_path = "libdrv_shared_a32.so";
static const char *g_tee_share_so_path = "libtee_shared_a32.so";
#endif
const char *g_debug_prefix = "tarunner";
static int32_t param_check(int32_t argc, const char * const * argv)
{
+1 -1
View File
@@ -30,7 +30,7 @@ $(BUILD_DIR)/$(TA_NAME): $(BUILD_DIR)/$(TARGETS)
cp $< $@
# Libraries
LIBS := c_shared$(TARG)
LIBS := c_shared$(TARG) tee_shared$(TARG)
LDFLAGS += --dynamic-linker=libc_shared$(TARG).so
include $(BUILD_SERVICE)/svc-common.mk
-2
View File
@@ -80,9 +80,7 @@ __attribute__((noreturn)) void *tee_idle_thread(void *arg)
error("StartTZ done\n");
while (1) {
debug("calling smc_switch_req\n");
err = smc_switch_req(CAP_TEESMC_REQ_IDLE);
debug("smc_switch_req return err=%x\n", err);
if (err != 0)
panic("something wrong");
}
+1 -1
View File
@@ -17,7 +17,7 @@
#include <stdbool.h>
#include <ipclib.h>
#include <priorities.h>
#define SMCMGR_STACK_SIZE 0x2000
#define SMCMGR_STACK_SIZE 0x8000
#define PAY_LOAD_SIZE 24
#define MAGIC_MSG "IDLE_0xDEADBEEF"
@@ -333,8 +333,11 @@ int32_t tlv_to_uuid(const char *uuid_buff, uint32_t size, struct tee_uuid *uuid)
}
uint32_t i;
uint64_t data[UUID_STRUCT_LEN] = { 0 };
//TODO
uint64_t data[UUID_STRUCT_LEN];
for (i = 0; i < UUID_STRUCT_LEN; i++) {
data[i] = 0;
}
const char *ptr = uuid_buff;
uint8_t flag = 0;
flag |= (uint8_t)(trans_str_to_int(ptr, UUID_TIMELOW_LEN, BASE_OF_HEX, &data[DATA_TIMELOW_IDX]) != 0);
@@ -622,6 +622,22 @@ index 53516a06c6..e14c9c638f 100644
#define SN_hmac "HMAC"
#define LN_hmac "hmac"
#define NID_hmac 855
diff --git a/crypto/threads_pthread.c b/crypto/threads_pthread.c
index 1774a2b2a..870fd3892 100644
--- a/crypto/threads_pthread.c
+++ b/crypto/threads_pthread.c
@@ -131,6 +131,12 @@ int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))
void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)
{
+ if (key == NULL)
+ return NULL;
+
+ if (*key == 0)
+ pthread_key_create(key, NULL);
+
return pthread_getspecific(*key);
}
--
2.17.1
+1
View File
@@ -17,6 +17,7 @@ cd $opensslpath
# config and generate dso_conf.h
echo "before ./config "
chmod +x ./config
./config
make include/crypto/dso_conf.h
cp "$2"/lib/teelib/libopenssl/include/opensslconf.h $opensslpath/include/openssl/
+3 -1
View File
@@ -14,4 +14,6 @@ cd "$1"/openssl
git checkout .
git clean -df
rm -rf $2"/lib/teelib/libopenssl/openssl
if [ -d "$2"/lib/teelib/libopenssl/openssl ]; then
rm -rf "$2"/lib/teelib/libopenssl/openssl
fi
+1 -1
View File
@@ -54,7 +54,7 @@ extern const char *g_debug_prefix;
#ifdef TLOG_USE_TEE_PRINT
#define tlogv(fmt, args...) tee_print(LOG_LEVEL_VERBO, "%s %d:" fmt "", TAG_VERB, __LINE__, ##args)
#else
#define tlogd(fmt, args...) printf("[%s] %s %d:" fmt " ", g_debug_prefix, TAG_VERB, __LINE__, ##args)
#define tlogv(fmt, args...) printf("[%s] %s %d:" fmt " ", g_debug_prefix, TAG_VERB, __LINE__, ##args)
#endif /* TLOG_USE_TEE_PRINT */
#else
#define tlogv(fmt, args...) \
+1
View File
@@ -17,6 +17,7 @@
#include "tee_init.h"
#include "timer_export.h"
#include "tee_tag.h"
#include "teecall.h"
enum log_source_type {
COMMON_SOURCE = 0,
-6
View File
@@ -14,12 +14,6 @@
#include <stdint.h>
#include <stddef.h>
static inline int debug_rdr_logitem(char *str, size_t str_len)
{
(void)str;
(void)str_len;
return 0;
}
uint8_t get_log_source(const char *driver_tag);
char *get_log_tag(const char *driver_tag, const char *debug_prefix);
+1 -1
View File
@@ -97,7 +97,7 @@ CPPFLAGS += -DDYN_IMPORT_CERT=1
CFILES := $(filter-out , $(CFILES))
endif
CFLAGS += -fvisibility=hidden
CFLAGS += -fvisibility=hidden -Wno-pointer-to-int-cast
ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE),openssl)
CFLAGS += -DOPENSSL_ENABLE
endif