warning fix

Signed-off-by: suwanghw <wangsu14@huawei.com>
This commit is contained in:
suwanghw
2023-11-16 23:01:27 +08:00
parent c184d1ea5a
commit 56de66a130
43 changed files with 1743 additions and 1743 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
add_device_ko(LOCAL_MODULE tzdriver
KO_SRC_FOLDER ${CMAKE_CURRENT_SOURCE_DIR})
KO_SRC_FOLDER ${CMAKE_CURRENT_SOURCE_DIR})
+1 -1
View File
@@ -36,7 +36,7 @@
#define IOC_CMD_1 1
#define IOC_CMD_2 2
#define STORAGE_IOC_MAX_RPMB_CMD 3
#define RPMB_EMMC_CID_SIZE 32
#define RPMB_EMMC_CID_SIZE 32
#define RPMB_CTRL_MAGIC 0x5A5A5A5A
#define RPMB_REQ 1 /* RPMB request mark */
#define RPMB_RESP (1 << 1) /* RPMB response mark*/
+7 -7
View File
@@ -45,17 +45,17 @@
#include <linux/err.h>
#include <crypto/hash.h>
#define CHECK_ACCESS_SUCC 0
#define CHECK_ACCESS_FAIL 0xffff
#define CHECK_ACCESS_SUCC 0
#define CHECK_ACCESS_FAIL 0xffff
#define CHECK_PATH_HASH_FAIL 0xff01
#define CHECK_SECLABEL_FAIL 0xff02
#define CHECK_SECLABEL_FAIL 0xff02
#define CHECK_CODE_HASH_FAIL 0xff03
#define ENTER_BYPASS_CHANNEL 0xff04
#define BUF_MAX_SIZE 1024
#define MAX_PATH_SIZE 512
#define SHA256_DIGEST_LENTH 32
#define MAX_SCTX_LEN 128
#define BUF_MAX_SIZE 1024
#define MAX_PATH_SIZE 512
#define SHA256_DIGEST_LENTH 32
#define MAX_SCTX_LEN 128
struct sdesc {
struct shash_desc shash;
+2 -2
View File
@@ -503,8 +503,8 @@ error:
#ifdef CONFIG_AUTH_SUPPORT_UNAME
#define PASSWD_FILE "/etc/passwd"
#define UID_POS 2U
#define DECIMAL 10
#define UID_POS 2U
#define DECIMAL 10
static int uid_compare(uint32_t uid, const char* uid_str, uint32_t uid_len)
{
uint32_t uid_num = 0;
+7 -7
View File
@@ -58,13 +58,13 @@
#include "auth_base_impl.h"
#ifdef CONFIG_CMS_CAHASH_AUTH
#define HASH_FILE_MAX_SIZE CONFIG_HASH_FILE_SIZE
#define HASH_FILE_MAX_SIZE CONFIG_HASH_FILE_SIZE
#else
#define HASH_FILE_MAX_SIZE (16 * 1024)
#define HASH_FILE_MAX_SIZE (16 * 1024)
#endif
#define AGENT_BUFF_SIZE (4 * 1024)
#define AGENT_MAX 32
#define PAGE_ORDER_RATIO 2
#define AGENT_BUFF_SIZE (4 * 1024)
#define AGENT_MAX 32
#define PAGE_ORDER_RATIO 2
static struct list_head g_tee_agent_list;
@@ -214,7 +214,7 @@ static int get_ca_path_and_uid(struct ca_info *ca)
ca->uid = cred->uid.val;
tlogd("ca_task->comm is %s, path is %s, ca uid is %u\n",
current->comm, path, cred->uid.val);
current->comm, path, cred->uid.val);
put_cred(cred);
put_task_struct(current);
@@ -556,7 +556,7 @@ int agent_process_work(const struct tc_ns_smc_cmd *smc_cmd,
tlogd("agent process work: wakeup the agent");
wake_up(&event_data->wait_event_wq);
tlogd("agent 0x%x request, goto sleep, pe->run=%d\n",
agent_id, atomic_read(&event_data->ca_run));
agent_id, atomic_read(&event_data->ca_run));
ret = wait_agent_response(event_data);
atomic_set(&event_data->ca_run, 0);
+11 -11
View File
@@ -16,22 +16,22 @@
#include <linux/fs.h>
#include "teek_ns_client.h"
#define MAX_PATH_SIZE 512
#define AGENT_FS_ID 0x46536673 /* FSfs */
#define AGENT_MISC_ID 0x4d495343 /* MISC */
#define MAX_PATH_SIZE 512
#define AGENT_FS_ID 0x46536673 /* FSfs */
#define AGENT_MISC_ID 0x4d495343 /* MISC */
#ifdef CONFIG_RPMB_AGENT
#define TEE_RPMB_AGENT_ID 0x4abe6198 /* RPMB */
#define TEE_RPMB_AGENT_ID 0x4abe6198 /* RPMB */
#endif
#define AGENT_SOCKET_ID 0x69e85664 /* socket */
#define AGENT_SOCKET_ID 0x69e85664 /* socket */
#define SECFILE_LOAD_AGENT_ID 0x4c4f4144 /* SECFILE-LOAD-AGENT */
#define TEE_SECE_AGENT_ID 0x53656345 /* npu agent id */
#define TEE_FACE_AGENT1_ID 0x46616365 /* face agent id */
#define TEE_FACE_AGENT2_ID 0x46616345 /* face agent id */
#define TEE_VLTMM_AGENT_ID 0x564c544d /* vltmm agent id */
#define SYSTEM_UID 1000
#define MS_TO_NS 1000000
#define TEE_SECE_AGENT_ID 0x53656345 /* npu agent id */
#define TEE_FACE_AGENT1_ID 0x46616365 /* face agent id */
#define TEE_FACE_AGENT2_ID 0x46616345 /* face agent id */
#define TEE_VLTMM_AGENT_ID 0x564c544d /* vltmm agent id */
#define SYSTEM_UID 1000
#define MS_TO_NS 1000000
enum agent_state_type {
AGENT_CRASHED = 0,
+49 -49
View File
@@ -25,28 +25,28 @@
* All requests with FFA_MSG_SEND_DIRECT_REQ and FFA_MSG_SEND_DIRECT_RESP
* are using the AArch32 SMC calling convention with register usage as
* defined in FF-A specification:
* w0: Function ID (0x8400006F or 0x84000070)
* w1: Source/Destination IDs
* w2: Reserved (MBZ)
* w0: Function ID (0x8400006F or 0x84000070)
* w1: Source/Destination IDs
* w2: Reserved (MBZ)
* w3-w7: Implementation defined, free to be used below
*/
#define TZ_FFA_VERSION_MAJOR 1
#define TZ_FFA_VERSION_MINOR 0
#define TZ_FFA_BLOCKING_CALL(id) (id)
#define TZ_FFA_YIELDING_CALL_BIT 31
#define TZ_FFA_YIELDING_CALL(id) ((id) | BIT(TZ_FFA_YIELDING_CALL_BIT))
#define TZ_FFA_BLOCKING_CALL(id) (id)
#define TZ_FFA_YIELDING_CALL_BIT 31
#define TZ_FFA_YIELDING_CALL(id) ((id) | BIT(TZ_FFA_YIELDING_CALL_BIT))
/*
* Returns the API version implemented, currently follows the FF-A version.
* Call register usage:
* w3: Service ID, TZ_FFA_GET_API_VERSION
* w3: Service ID, TZ_FFA_GET_API_VERSION
* w4-w7: Not used (MBZ)
*
* Return register usage:
* w3: TZ_FFA_VERSION_MAJOR
* w4: TZ_FFA_VERSION_MINOR
* w3: TZ_FFA_VERSION_MAJOR
* w4: TZ_FFA_VERSION_MINOR
* w5-w7: Not used (MBZ)
*/
#define TZ_FFA_GET_API_VERSION TZ_FFA_BLOCKING_CALL(0)
@@ -59,15 +59,15 @@
* Trusted OS, not of the API.
*
* Call register usage:
* w3: Service ID, TZ_FFA_GET_OS_VERSION
* w3: Service ID, TZ_FFA_GET_OS_VERSION
* w4-w7: Unused (MBZ)
*
* Return register usage:
* w3: CFG_TZ_REVISION_MAJOR
* w4: CFG_TZ_REVISION_MINOR
* w5: TEE_IMPL_GIT_SHA1 (or zero if not supported)
* w3: CFG_TZ_REVISION_MAJOR
* w4: CFG_TZ_REVISION_MINOR
* w5: TEE_IMPL_GIT_SHA1 (or zero if not supported)
*/
#define TZ_FFA_GET_OS_VERSION TZ_FFA_BLOCKING_CALL(1)
#define TZ_FFA_GET_OS_VERSION TZ_FFA_BLOCKING_CALL(1)
/*
* Exchange capabilities between normal world and secure world.
@@ -76,15 +76,15 @@
* capabilities may be added.
*
* Call register usage:
* w3: Service ID, TZ_FFA_EXCHANGE_CAPABILITIES
* w3: Service ID, TZ_FFA_EXCHANGE_CAPABILITIES
* w4-w7: Not used (MBZ)
*
* Return register usage:
* w3: Error code, 0 on success
* w4: Bit[7:0]: Number of parameters needed for RPC to be supplied
* as the second MSG arg struct for
* TZ_FFA_YIELDING_CALL_WITH_ARG.
* Bit[31:8]: Reserved (MBZ)
* w3: Error code, 0 on success
* w4: Bit[7:0]: Number of parameters needed for RPC to be supplied
* as the second MSG arg struct for
* TZ_FFA_YIELDING_CALL_WITH_ARG.
* Bit[31:8]: Reserved (MBZ)
* w5-w7: Not used (MBZ)
*/
#define TZ_FFA_EXCHANGE_CAPABILITIES TZ_FFA_BLOCKING_CALL(2)
@@ -93,59 +93,59 @@
* Unregister shared memory
*
* Call register usage:
* w3: Service ID, TZ_FFA_YIELDING_CALL_UNREGISTER_SHM
* w4: Shared memory handle, lower bits
* w5: Shared memory handle, higher bits
* w3: Service ID, TZ_FFA_YIELDING_CALL_UNREGISTER_SHM
* w4: Shared memory handle, lower bits
* w5: Shared memory handle, higher bits
* w6-w7: Not used (MBZ)
*
* Return register usage:
* w3: Error code, 0 on success
* w3: Error code, 0 on success
* w4-w7: Not used (MBZ)
*/
#define TZ_FFA_UNREGISTER_SHM TZ_FFA_BLOCKING_CALL(3)
#define TZ_FFA_UNREGISTER_SHM TZ_FFA_BLOCKING_CALL(3)
/*
* Call with struct TZ_msg_arg as argument in the supplied shared memory
* with a zero internal offset and normal cached memory attributes
* Register usage:
* w3: Service ID, TZ_FFA_YIELDING_CALL_WITH_ARG
* w4: Lower 32 bits of a 64-bit Shared memory handle
* w5: Upper 32 bits of a 64-bit Shared memory handle
* w6: Offset into shared memory pointing to a struct TZ_msg_arg
* right after the parameters of this struct (at offset
* TZ_MSG_GET_ARG_SIZE(num_params) follows a struct TZ_msg_arg
* for RPC, this struct has reserved space for the number of RPC
* parameters as returned by TZ_FFA_EXCHANGE_CAPABILITIES.
* w7: Not used (MBZ)
* w3: Service ID, TZ_FFA_YIELDING_CALL_WITH_ARG
* w4: Lower 32 bits of a 64-bit Shared memory handle
* w5: Upper 32 bits of a 64-bit Shared memory handle
* w6: Offset into shared memory pointing to a struct TZ_msg_arg
* right after the parameters of this struct (at offset
* TZ_MSG_GET_ARG_SIZE(num_params) follows a struct TZ_msg_arg
* for RPC, this struct has reserved space for the number of RPC
* parameters as returned by TZ_FFA_EXCHANGE_CAPABILITIES.
* w7: Not used (MBZ)
* Resume from RPC. Register usage:
* w3: Service ID, TZ_FFA_YIELDING_CALL_RESUME
* w3: Service ID, TZ_FFA_YIELDING_CALL_RESUME
* w4-w6: Not used (MBZ)
* w7: Resume info
* w7: Resume info
*
* Normal return (yielding call is completed). Register usage:
* w3: Error code, 0 on success
* w4: TZ_FFA_YIELDING_CALL_RETURN_DONE
* w3: Error code, 0 on success
* w4: TZ_FFA_YIELDING_CALL_RETURN_DONE
* w5-w7: Not used (MBZ)
*
* RPC interrupt return (RPC from secure world). Register usage:
* w3: Error code == 0
* w4: Any defined RPC code but TZ_FFA_YIELDING_CALL_RETURN_DONE
* w3: Error code == 0
* w4: Any defined RPC code but TZ_FFA_YIELDING_CALL_RETURN_DONE
* w5-w6: Not used (MBZ)
* w7: Resume info
* w7: Resume info
*
* Possible error codes in register w3:
* 0: Success
* FFA_DENIED: w4 isn't one of TZ_FFA_YIELDING_CALL_START
* TZ_FFA_YIELDING_CALL_RESUME
* 0: Success
* FFA_DENIED: w4 isn't one of TZ_FFA_YIELDING_CALL_START
* TZ_FFA_YIELDING_CALL_RESUME
*
* Possible error codes for TZ_FFA_YIELDING_CALL_START
* FFA_BUSY: Number of OP-TEE OS threads exceeded,
* try again later
* FFA_DENIED: RPC shared memory object not found
* FFA_INVALID_PARAMETER: Bad shared memory handle or offset into the memory
* FFA_BUSY: Number of OP-TEE OS threads exceeded,
* try again later
* FFA_DENIED: RPC shared memory object not found
* FFA_INVALID_PARAMETER: Bad shared memory handle or offset into the memory
*
* Possible error codes for TZ_FFA_YIELDING_CALL_RESUME
* FFA_INVALID_PARAMETER: Bad resume info
* FFA_INVALID_PARAMETER: Bad resume info
*/
#define TZ_FFA_YIELDING_CALL_WITH_ARG TZ_FFA_YIELDING_CALL(0)
#define TZ_FFA_YIELDING_CALL_RESUME TZ_FFA_YIELDING_CALL(1)
+2 -2
View File
@@ -44,7 +44,7 @@
#include "tlogger.h"
#include "dynamic_ion_mem.h"
#define MAX_SHARED_SIZE 0x100000 /* 1 MiB */
#define MAX_SHARED_SIZE 0x100000 /* 1 MiB */
static void free_operation(const struct tc_call_params *call_params,
struct tc_op_params *op_params);
@@ -294,7 +294,7 @@ int write_to_client(void __user *dest, size_t dest_size,
ret = memcpy_s(dest, dest_size, src, size);
if (ret != EOK) {
tloge("write to client fail. line=%d, ret=%d\n",
__LINE__, ret);
__LINE__, ret);
return ret;
}
return ret;
+1 -1
View File
@@ -333,7 +333,7 @@ int tc_ns_load_secfile(struct tc_ns_dev_file *dev_file,
}
if (ioctl_arg.sec_file_info.secfile_type >= LOAD_TYPE_MAX ||
ioctl_arg.sec_file_info.secfile_type == LOAD_PATCH) {
ioctl_arg.sec_file_info.secfile_type == LOAD_PATCH) {
tloge("invalid secfile type: %d!", ioctl_arg.sec_file_info.secfile_type);
return -EINVAL;
}
+31 -31
View File
@@ -78,9 +78,9 @@
#endif
#include "smc_call.h"
#define PREEMPT_COUNT 10000
#define HZ_COUNT 10
#define IDLED_COUNT 100
#define PREEMPT_COUNT 10000
#define HZ_COUNT 10
#define IDLED_COUNT 100
/*
* when cannot find smc entry, will sleep 1ms
* because the task will be killed in 25s if it not return,
@@ -89,17 +89,17 @@
#define FIND_SMC_ENTRY_SLEEP 1
#define FIND_SMC_ENTRY_RETRY_MAX_COUNT (CMD_MAX_EXECUTE_TIME * S_TO_MS / FIND_SMC_ENTRY_SLEEP)
#define CPU_ZERO 0
#define CPU_ONE 1
#define CPU_FOUR 4
#define CPU_FIVE 5
#define CPU_SIX 6
#define CPU_ZERO 0
#define CPU_ONE 1
#define CPU_FOUR 4
#define CPU_FIVE 5
#define CPU_SIX 6
#define CPU_SEVEN 7
#define LOW_BYTE 0xF
#define LOW_BYTE 0xF
#define PENDING2_RETRY (-1)
#define PENDING2_RETRY (-1)
#define RETRY_WITH_PM 1
#define RETRY_WITH_PM 1
#define CLEAN_WITHOUT_PM 2
#define MAX_CHAR 0xff
@@ -122,8 +122,8 @@ static struct task_struct *g_ipi_helper_thread;
static DEFINE_KTHREAD_WORKER(g_ipi_helper_worker);
enum cmd_reuse {
CLEAR, /* clear this cmd index */
RESEND, /* use this cmd index resend */
CLEAR, /* clear this cmd index */
RESEND, /* use this cmd index resend */
};
struct cmd_reuse_info {
@@ -155,20 +155,20 @@ static uint32_t g_siq_queue[MAX_SIQ_NUM];
DEFINE_MUTEX(g_siq_lock);
enum smc_ops_exit {
SMC_OPS_NORMAL = 0x0,
SMC_OPS_SCHEDTO = 0x1,
SMC_OPS_START_SHADOW = 0x2,
SMC_OPS_START_FIQSHD = 0x3,
SMC_OPS_PROBE_ALIVE = 0x4,
SMC_OPS_ABORT_TASK = 0x5,
SMC_EXIT_NORMAL = 0x0,
SMC_EXIT_PREEMPTED = 0x1,
SMC_EXIT_SHADOW = 0x2,
SMC_EXIT_ABORT = 0x3,
SMC_EXIT_MAX = 0x4,
SMC_OPS_NORMAL = 0x0,
SMC_OPS_SCHEDTO = 0x1,
SMC_OPS_START_SHADOW = 0x2,
SMC_OPS_START_FIQSHD = 0x3,
SMC_OPS_PROBE_ALIVE = 0x4,
SMC_OPS_ABORT_TASK = 0x5,
SMC_EXIT_NORMAL = 0x0,
SMC_EXIT_PREEMPTED = 0x1,
SMC_EXIT_SHADOW = 0x2,
SMC_EXIT_ABORT = 0x3,
SMC_EXIT_MAX = 0x4,
};
#define SHADOW_EXIT_RUN 0x1234dead
#define SHADOW_EXIT_RUN 0x1234dead
#define SMC_EXIT_TARGET_SHADOW_EXIT 0x1
#define SYM_NAME_LEN_MAX 16
@@ -925,10 +925,10 @@ static int siq_thread_fn(void *arg)
}
#ifdef CONFIG_TEE_AUDIT
#define MAX_UPLOAD_INFO_LEN 4
#define INFO_HIGH_OFFSET 24U
#define INFO_MID_OFFSET 16U
#define INFO_LOW_OFFSET 8U
#define MAX_UPLOAD_INFO_LEN 4
#define INFO_HIGH_OFFSET 24U
#define INFO_MID_OFFSET 16U
#define INFO_LOW_OFFSET 8U
static void upload_audit_event(unsigned int eventindex)
{
@@ -1418,9 +1418,9 @@ static void print_crash_msg(union crash_inf *crash_info)
crash_info->crash_msg.sym_name_append, SYM_NAME_LEN_2) != EOK)
tloge("memcpy sym_name_append failed!\n");
tloge("====crash app:%s user_sym:%s + <0x%x/0x%x>\n",
crash_app_name, syms, off, crash_info->crash_msg.size);
crash_app_name, syms, off, crash_info->crash_msg.size);
tloge("====crash far:0x%x fault:%x\n",
crash_info->crash_msg.far, crash_info->crash_msg.fault);
crash_info->crash_msg.far, crash_info->crash_msg.fault);
}
}
+6 -6
View File
@@ -55,29 +55,29 @@ struct pending_entry {
#ifdef DIV_ROUND_UP
#undef DIV_ROUND_UP
#endif
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
#define BITS_PER_BYTE 8
#define BITS_PER_BYTE 8
#ifdef BITS_TO_LONGS
#undef BITS_TO_LONGS
#endif
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(uint64_t))
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(uint64_t))
#ifdef BIT_MASK
#undef BIT_MASK
#endif
#define BIT_MASK(nr) (1UL << (((uint64_t)(nr)) % sizeof(uint64_t)))
#define BIT_MASK(nr) (1UL << (((uint64_t)(nr)) % sizeof(uint64_t)))
#ifdef BIT_WORD
#undef BIT_WORD
#endif
#define BIT_WORD(nr) ((nr) / sizeof(uint64_t))
#define BIT_WORD(nr) ((nr) / sizeof(uint64_t))
#ifdef DECLARE_BITMAP
#undef DECLARE_BITMAP
#endif
#define DECLARE_BITMAP(name, bits) uint64_t name[BITS_TO_LONGS(bits)]
#define DECLARE_BITMAP(name, bits) uint64_t name[BITS_TO_LONGS(bits)]
#define SIQ_DUMP_TIMEOUT 1U
#define SIQ_DUMP_SHELL 2U
+2 -2
View File
@@ -1140,8 +1140,8 @@ const struct dev_pm_ops g_tzdriver_pm_ops = {
static struct platform_driver g_tz_platform_driver = {
.driver = {
.name = "trusted_core",
.owner = THIS_MODULE,
.name = "trusted_core",
.owner = THIS_MODULE,
#ifdef CONFIG_ACPI
.acpi_match_table = ACPI_PTR(g_tzdriver_acpi_match),
#else
+1 -1
View File
@@ -350,7 +350,7 @@ EXPORT_SYMBOL(teek_initialize_context);
*/
void teek_finalize_context(struct teec_context *context)
{
if (!get_tz_init_flag()) return;
if (!get_tz_init_flag()) return;
tlogd("teek_finalize_context started\n");
if (!context || !context->dev) {
tloge("context or dev is null, not correct\n");
+5 -5
View File
@@ -22,11 +22,11 @@
#include "tc_ns_log.h"
#include "smc_call.h"
#define S4_ADDR_4G 0xffffffff
#define RESERVED_SECOS_PHYMEM_BASE 0x22800000
#define RESERVED_SECOS_PHYMEM_SIZE (0x3000000)
#define RESERVED_SECOS_S4_BASE 0x27760000
#define RESERVED_SECOS_S4_SIZE (0x100000)
#define S4_ADDR_4G 0xffffffff
#define RESERVED_SECOS_PHYMEM_BASE 0x22800000
#define RESERVED_SECOS_PHYMEM_SIZE (0x3000000)
#define RESERVED_SECOS_S4_BASE 0x27760000
#define RESERVED_SECOS_S4_SIZE (0x100000)
static char *g_s4_kernel_mem_addr;
static char *g_s4_buffer_vaddr;
+2 -2
View File
@@ -16,8 +16,8 @@
#define TZ_PM_H
#include <linux/platform_device.h>
#define TSP_S4_SUSPEND 0xB200000C
#define TSP_S4_RESUME 0xB200000D
#define TSP_S4_SUSPEND 0xB200000C
#define TSP_S4_RESUME 0xB200000D
#define TSP_S4_ENCRYPT_AND_COPY 0xB2000010
#define TSP_S4_DECRYPT_AND_COPY 0xB2000011
+5 -5
View File
@@ -231,8 +231,8 @@ static int find_notify_sess(
mutex_lock(&dev_list->dev_lock);
list_for_each_entry(temp_dev_file, &dev_list->dev_file_list, head) {
tlogd("dev file id1 = %u, id2 = %u\n",
temp_dev_file->dev_file_id,
tc_notify_data_timer->dev_file_id);
temp_dev_file->dev_file_id,
tc_notify_data_timer->dev_file_id);
if (temp_dev_file->dev_file_id ==
tc_notify_data_timer->dev_file_id) {
mutex_lock(&temp_dev_file->service_lock);
@@ -276,8 +276,8 @@ static void tc_notify_timer_fn(struct notify_data_entry *notify_data_entry)
tc_notify_data_timer = &(notify_data_entry->context.timer);
notify_data_entry->filled = 0;
tlogd("notify data timer type is 0x%x, timer ID is 0x%x\n",
tc_notify_data_timer->property.type,
tc_notify_data_timer->property.timer_id);
tc_notify_data_timer->property.type,
tc_notify_data_timer->property.timer_id);
walk_callback_list(tc_notify_data_timer);
if (find_notify_sess(tc_notify_data_timer, &temp_ses, &enc_found) != 0)
@@ -703,7 +703,7 @@ int tz_spi_init(struct device *class_dev, struct device_node *np)
g_notify_data_entry_shadow =
&g_notify_data->entry[NOTIFY_DATA_ENTRY_SHADOW - 1];
tlogd("target is: %llx\n",
g_notify_data_entry_shadow->context.shadow.target_tcb);
g_notify_data_entry_shadow->context.shadow.target_tcb);
}
return 0;
+15 -15
View File
@@ -23,13 +23,13 @@
#ifndef CONFIG_TEE_FAULT_MANAGER
static inline void fault_monitor_start(int32_t type)
{
(void)type;
return;
(void)type;
return;
}
static inline void fault_monitor_end(void)
{
return;
return;
}
#endif
@@ -42,14 +42,14 @@ static inline void init_kthread_cpumask(void)
static inline void tz_kthread_bind_mask(struct task_struct *kthread)
{
(void)kthread;
(void)kthread;
}
static inline void tz_workqueue_bing_mask(struct workqueue_struct *wq,
uint32_t flag)
uint32_t flag)
{
(void)wq;
(void)flag;
(void)wq;
(void)flag;
}
#ifdef CONFIG_LINEPATCH_ENABLE
@@ -57,8 +57,8 @@ static inline void tz_workqueue_bing_mask(struct workqueue_struct *wq,
#else
static inline int livepatch_init(const struct device *dev)
{
(void)dev;
return 0;
(void)dev;
return 0;
}
static inline void livepatch_down_read_sem(void)
{
@@ -77,8 +77,8 @@ static inline void free_livepatch(void)
#else
static inline void tee_trace_add_event(enum tee_event_id id, uint64_t add_info)
{
(void)id;
(void)add_info;
(void)id;
(void)add_info;
}
static inline void free_event_mem(void)
{
@@ -93,18 +93,18 @@ static inline void free_interrupt_trace(void)
#else
static inline bool is_tee_rebooting(void)
{
return false;
return false;
}
static inline int tee_init_reboot_thread(void)
{
return 0;
return 0;
}
static inline int tee_wake_up_reboot(void)
{
return 0;
return 0;
}
static inline void free_reboot_thread(void)
{
return;
return;
}
#endif
+3 -3
View File
@@ -20,9 +20,9 @@
#include <linux/types.h>
#include <linux/version.h>
#define UUID_LEN 16
#define PARAM_NUM 4
#define ADDR_TRANS_NUM 32
#define UUID_LEN 16
#define PARAM_NUM 4
#define ADDR_TRANS_NUM 32
#define teec_param_types(param0_type, param1_type, param2_type, param3_type) \
((param3_type) << 12 | (param2_type) << 8 | \
+6 -6
View File
@@ -88,13 +88,13 @@ struct teec_tui_parameter {
/* tui event type */
uint32_t value;
/* return value, is keycode if tui event is getkeycode */
uint32_t notch; /* notch size of phone */
uint32_t width; /* width of foldable screen */
uint32_t height; /* height of foldable screen */
uint32_t fold_state; /* state of foldable screen */
uint32_t notch; /* notch size of phone */
uint32_t width; /* width of foldable screen */
uint32_t height; /* height of foldable screen */
uint32_t fold_state; /* state of foldable screen */
uint32_t display_state; /* one state of folded state */
uint32_t phy_width; /* real width of the mobile */
uint32_t phy_height; /* real height of the mobile */
uint32_t phy_width; /* real width of the mobile */
uint32_t phy_height; /* real height of the mobile */
};
struct teec_operation {
+21 -21
View File
@@ -25,35 +25,35 @@
#include "tc_ns_log.h"
#define TC_NS_CLIENT_IOC_MAGIC 't'
#define TC_NS_CLIENT_DEV "tc_ns_client"
#define TC_NS_CLIENT_DEV "tc_ns_client"
#define TC_PRIV_DEV "tc_private"
#define TC_NS_CLIENT_DEV_NAME "/dev/tc_ns_client"
#define EXCEPTION_MEM_SIZE (8*1024) /* mem for exception handling */
#ifdef CONFIG_THIRDPARTY_COMPATIBLE
#define TSP_REQUEST 0x32000008
#define TSP_RESPONSE 0xBE000005
#define TSP_REQUEST 0x32000008
#define TSP_RESPONSE 0xBE000005
#else
#define TSP_REQUEST 0xB2000008
#define TSP_RESPONSE 0xB2000009
#define TSP_REQUEST 0xB2000008
#define TSP_RESPONSE 0xB2000009
#endif
#define TSP_REE_SIQ 0xB200000A
#define TSP_CRASH 0xB200000B
#define TSP_REBOOT 0xB200000E
#define TSP_CPU_ON 0xB200000F
#define TSP_REBOOT_DONE 0xB2000010
#define TSP_PREEMPTED 0xB2000005
#define TC_CALL_GLOBAL 0x01
#define TC_CALL_SYNC 0x02
#define TC_CALL_LOGIN 0x04
#define TSP_REE_SIQ 0xB200000A
#define TSP_CRASH 0xB200000B
#define TSP_REBOOT 0xB200000E
#define TSP_CPU_ON 0xB200000F
#define TSP_REBOOT_DONE 0xB2000010
#define TSP_PREEMPTED 0xB2000005
#define TC_CALL_GLOBAL 0x01
#define TC_CALL_SYNC 0x02
#define TC_CALL_LOGIN 0x04
#define TEE_REQ_FROM_USER_MODE 0U
#define TEE_REQ_FROM_KERNEL_MODE 1U
#define TEE_PARAM_NUM 4
#define VMALLOC_TYPE 0
#define RESERVED_TYPE 1
#define TEE_PARAM_NUM 4
#define VMALLOC_TYPE 0
#define RESERVED_TYPE 1
/* Max sizes for login info buffer comming from teecd */
#define MAX_PACKAGE_NAME_LEN 255
#define MAX_PACKAGE_NAME_LEN 255
/*
* The apk certificate format is as follows:
* modulus_size(4 bytes) + modulus buffer(512 bytes)
@@ -142,7 +142,7 @@ struct tc_ns_login {
struct tc_ns_operation {
unsigned int paramtypes;
union tc_ns_parameter params[TEE_PARAM_NUM];
unsigned int buffer_h_addr[TEE_PARAM_NUM];
unsigned int buffer_h_addr[TEE_PARAM_NUM];
struct tc_ns_shared_mem *sharemem[TEE_PARAM_NUM];
void *mb_buffer[TEE_PARAM_NUM];
};
@@ -161,7 +161,7 @@ enum smc_cmd_type {
};
struct tc_ns_smc_cmd {
uint8_t uuid[sizeof(struct tc_uuid)];
uint8_t uuid[sizeof(struct tc_uuid)];
unsigned int cmd_type;
unsigned int cmd_id;
unsigned int dev_file_id;
@@ -174,7 +174,7 @@ struct tc_ns_smc_cmd {
unsigned int login_data_h_addr;
unsigned int login_data_len;
unsigned int err_origin;
int ret_val;
int ret_val;
unsigned int event_nr;
unsigned int uid;
unsigned int ca_pid; /* pid */
+12 -12
View File
@@ -39,25 +39,25 @@
#endif
/* for log item ----------------------------------- */
#define LOG_ITEM_MAGIC 0x5A5A
#define LOG_ITEM_LEN_ALIGN 64
#define LOG_ITEM_MAX_LEN 1024
#define LOG_ITEM_MAGIC 0x5A5A
#define LOG_ITEM_LEN_ALIGN 64
#define LOG_ITEM_MAX_LEN 1024
#define LOG_READ_STATUS_ERROR 0x000FFFF
/* =================================================== */
#define LOGGER_LOG_TEEOS "teelog" /* tee os log */
#define LOGGERIOCTL 0xBE /* for ioctl */
#define LOGGER_LOG_TEEOS "teelog" /* tee os log */
#define LOGGERIOCTL 0xBE /* for ioctl */
#define DUMP_START_MAGIC "Dump SPI notification"
#define DUMP_END_MAGIC "Dump task states END"
#define GET_VERSION_BASE 5
#define GET_VERSION_BASE 5
#define SET_READERPOS_CUR_BASE 6
#define SET_TLOGCAT_STAT_BASE 7
#define GET_TLOGCAT_STAT_BASE 8
/* get tee verison */
#define MAX_TEE_VERSION_LEN 256
#define MAX_TEE_VERSION_LEN 256
#define TEELOGGER_GET_VERSION \
_IOR(LOGGERIOCTL, GET_VERSION_BASE, char[MAX_TEE_VERSION_LEN])
/* set the log reader pos to current pos */
@@ -112,17 +112,17 @@ struct log_item {
};
/* --- for log mem --------------------------------- */
#define TEMP_LOG_MEM_SIZE (10 * SZ_1K)
#define TEMP_LOG_MEM_SIZE (10 * SZ_1K)
#define LOG_BUFFER_RESERVED_LEN 11U
#define VERSION_INFO_LEN 156U
#define LOG_BUFFER_RESERVED_LEN 11U
#define VERSION_INFO_LEN 156U
/*
* Log's buffer flag info, size: 64 bytes head + 156 bytes's version info.
* For filed description:
* last_pos : current log's end position, last log's start position.
* write_loops: Write cyclically. Init value is 0, when memory is used
* up, the value add 1.
* up, the value add 1.
*/
struct log_buffer_flag {
uint32_t reserved0;
@@ -304,7 +304,7 @@ static ssize_t get_buffer_info(struct tlogger_reader *reader,
return 0;
}
#define LOG_BUFFER_MAX_LEN 0x100000
#define LOG_BUFFER_MAX_LEN 0x100000
static ssize_t get_last_read_pos(struct log_buffer_flag *log_flag,
const struct tlogger_reader *reader, uint32_t *log_last_pos, uint32_t *is_read)
+6 -6
View File
@@ -16,15 +16,15 @@
#include <linux/types.h>
#define OPEN_FILE_MODE 0640U
#define ROOT_UID 0
#define ROOT_GID 0
#define SYSTEM_GID 1000
#define OPEN_FILE_MODE 0640U
#define ROOT_UID 0
#define ROOT_GID 0
#define SYSTEM_GID 1000
#ifdef LAST_TEE_MSG_ROOT_GID
#define FILE_CHOWN_GID 0
#define FILE_CHOWN_GID 0
#else
/* system gid for last_teemsg file sys chown */
#define FILE_CHOWN_GID 1000
#define FILE_CHOWN_GID 1000
#endif
#define UINT64_MAX (uint64_t)(~((uint64_t)0)) /* 0xFFFFFFFFFFFFFFFF */
+6 -6
View File
@@ -1,20 +1,20 @@
config TEE_TUI
bool "Trusted User Interface Driver"
default n
depends on TZDRIVER
depends on TZDRIVER
help
Trusted user interface driver
Trusted user interface driver
config TEE_TUI_FP
bool "Trusted User Interface Driver for FP"
default n
depends on TZDRIVER
depends on TZDRIVER
help
Trusted user interface driver
Trusted user interface driver
config TEE_TUI_DISPLAY_3_0
bool "Trusted User Interface Driver for DSS3.0"
default n
depends on TEE_TUI
depends on TEE_TUI
help
Trusted user interface driver
Trusted user interface driver
+1291 -1291
View File
File diff suppressed because it is too large Load Diff
+140 -140
View File
@@ -20,168 +20,168 @@
#define TEE_TUI_AGENT_ID 0x54554944 /* TUID */
/* tui states */
#define TUI_STATE_UNUSED 0
#define TUI_STATE_CONFIG 1
#define TUI_STATE_UNUSED 0
#define TUI_STATE_CONFIG 1
#define TUI_STATE_RUNNING 2
#define TUI_STATE_ERROR 3
#define TUI_STATE_ERROR 3
#define TUI_PID_CLEAR 0
#define TUI_PID 1
#define TUI_PID_CLEAR 0
#define TUI_PID 1
/* command from secure os */
#define TUI_CMD_ENABLE 1
#define TUI_CMD_DISABLE 2
#define TUI_CMD_POLL 3
#define TUI_CMD_ENABLE 1
#define TUI_CMD_DISABLE 2
#define TUI_CMD_POLL 3
#define TUI_CMD_SET_STATE 4
#define TUI_CMD_PAUSE 5
#define TUI_CMD_DO_SYNC 6
#define TUI_CMD_START_DELAY_WORK 7
#define TUI_CMD_PAUSE 5
#define TUI_CMD_DO_SYNC 6
#define TUI_CMD_START_DELAY_WORK 7
#define TUI_CMD_CANCEL_DELAY_WORK 8
#define TUI_CMD_LOAD_TTF 9
#define TUI_CMD_FREE_TTF_MEM 11
#define TUI_CMD_EXIT 12
#define TUI_CMD_LOAD_TTF 9
#define TUI_CMD_FREE_TTF_MEM 11
#define TUI_CMD_EXIT 12
#define TUI_DRV_NAME_MAX 32
#define TUI_DRV_NAME_MAX 32
/* poll event type from normal to secure */
enum tui_poll_type {
TUI_POLL_CFG_OK,
TUI_POLL_CFG_FAIL,
TUI_POLL_TP,
TUI_POLL_TICK,
TUI_POLL_DELAYED_WORK,
TUI_POLL_TIMEOUT,
TUI_POLL_RESUME_TUI,
TUI_POLL_CFG_OK,
TUI_POLL_CFG_FAIL,
TUI_POLL_TP,
TUI_POLL_TICK,
TUI_POLL_DELAYED_WORK,
TUI_POLL_TIMEOUT,
TUI_POLL_RESUME_TUI,
/* For some reasons, we need a method to terminate TUI from no secure
* OS, for example the TUI CA maybe killed.
*/
TUI_POLL_CANCEL,
TUI_POLL_HANDLE_TUI, /* for tui to handle event */
TUI_POLL_NAVI_H_TO_S, /* for navigator hide and show */
TUI_POLL_NAVI_S_TO_H,
TUI_POLL_SHS_0_TO_1, /* for single hand mode switch */
TUI_POLL_SHS_0_TO_2,
TUI_POLL_SHS_1_TO_0,
TUI_POLL_SHS_2_TO_0,
TUI_POLL_ROTATION_0, /* for retation switch */
TUI_POLL_ROTATION_90,
TUI_POLL_ROTATION_180,
TUI_POLL_ROTATION_270,
TUI_POLL_KEYBOARDTYPE_0,
TUI_POLL_KEYBOARDTYPE_3,
TUI_POLL_SEMITRANS,
TUI_POLL_CURSOR,
TUI_POLL_GETFP,
TUI_POLL_NOTCH, /* for tui to get notch height */
TUI_POLL_DIALOGTIMEOUT,
TUI_POLL_FOLD, /* for tui to get fold_screen */
TUI_POLL_MAX /* Do Not add type behind this one */
TUI_POLL_CANCEL,
TUI_POLL_HANDLE_TUI, /* for tui to handle event */
TUI_POLL_NAVI_H_TO_S, /* for navigator hide and show */
TUI_POLL_NAVI_S_TO_H,
TUI_POLL_SHS_0_TO_1, /* for single hand mode switch */
TUI_POLL_SHS_0_TO_2,
TUI_POLL_SHS_1_TO_0,
TUI_POLL_SHS_2_TO_0,
TUI_POLL_ROTATION_0, /* for retation switch */
TUI_POLL_ROTATION_90,
TUI_POLL_ROTATION_180,
TUI_POLL_ROTATION_270,
TUI_POLL_KEYBOARDTYPE_0,
TUI_POLL_KEYBOARDTYPE_3,
TUI_POLL_SEMITRANS,
TUI_POLL_CURSOR,
TUI_POLL_GETFP,
TUI_POLL_NOTCH, /* for tui to get notch height */
TUI_POLL_DIALOGTIMEOUT,
TUI_POLL_FOLD, /* for tui to get fold_screen */
TUI_POLL_MAX /* Do Not add type behind this one */
}
/* tui max should be bigger than TUI_POLL_MAX in tui.h */
static const char *const poll_event_type_name[] = {
"config-ok",
"config-fail",
"tp",
"tui-tick",
"tui-delaywork",
"tui-pause",
"tui-resume",
"tui-terminate",
"tui-handle",
"tui-hs",
"tui-sh",
"tui-01",
"tui-02",
"tui-10",
"tui-20",
"tui-0",
"tui-90",
"tui-180",
"tui-270",
"tui_key_board_type0",
"tui_key_board_type3",
"tui-SEMI",
"tui-cursor",
"tui-gettp",
"tui-notch",
"tui-dialogtimeout",
"tui-fold",
"tui-max"
"config-ok",
"config-fail",
"tp",
"tui-tick",
"tui-delaywork",
"tui-pause",
"tui-resume",
"tui-terminate",
"tui-handle",
"tui-hs",
"tui-sh",
"tui-01",
"tui-02",
"tui-10",
"tui-20",
"tui-0",
"tui-90",
"tui-180",
"tui-270",
"tui_key_board_type0",
"tui_key_board_type3",
"tui-SEMI",
"tui-cursor",
"tui-gettp",
"tui-notch",
"tui-dialogtimeout",
"tui-fold",
"tui-max"
};
static const char *const state_name[] = {
"unused",
"config",
"running",
"error"
"unused",
"config",
"running",
"error"
};
struct tui_ctl_shm {
struct {
int command;
int value;
int ret;
} s2n;
struct {
int event_type;
int value;
unsigned int addr;
unsigned int addr_h;
int tp_info;
int tp_info_h_addr;
int status;
int x;
int y;
uint32_t npages;
uint64_t info_length;
uint32_t phy_size;
} n2s;
struct {
int command;
int value;
int ret;
} s2n;
struct {
int event_type;
int value;
unsigned int addr;
unsigned int addr_h;
int tp_info;
int tp_info_h_addr;
int status;
int x;
int y;
uint32_t npages;
uint64_t info_length;
uint32_t phy_size;
} n2s;
};
struct tui_msg_node {
int type;
int val;
void *data;
struct list_head list;
int type;
int val;
void *data;
struct list_head list;
};
typedef int (*tui_drv_init) (void *pdate, int secure);
struct tui_drv_node {
tui_drv_init init_func;
void *pdata;
char name[TUI_DRV_NAME_MAX];
int state;
int priority;
struct list_head list;
tui_drv_init init_func;
void *pdata;
char name[TUI_DRV_NAME_MAX];
int state;
int priority;
struct list_head list;
};
/* tui need memory is calculated dynamically according to the screen resolution */
struct tui_mem {
unsigned int tui_addr_size;
unsigned int tui_addr;
unsigned int tui_addr_h;
struct device *tui_dev;
char *tui_virt;
unsigned int tui_addr_size;
unsigned int tui_addr;
unsigned int tui_addr_h;
struct device *tui_dev;
char *tui_virt;
};
struct ttf_mem {
unsigned int ttf_addr_h;
unsigned int ttf_addr_l;
char *ttf_buff_virt;
unsigned int ttf_file_size;
unsigned int ttf_addr_h;
unsigned int ttf_addr_l;
char *ttf_buff_virt;
unsigned int ttf_file_size;
};
typedef struct tui_memory {
phys_addr_t tui_ion_phys_addr;
void *tui_ion_virt_addr;
size_t len;
uint32_t size;
uint32_t configid;
struct sg_table *tui_sg_table;
phys_addr_t fb_phys_addr;
uint32_t npages;
uint64_t info_length;
phys_addr_t tui_ion_phys_addr;
void *tui_ion_virt_addr;
size_t len;
uint32_t size;
uint32_t configid;
struct sg_table *tui_sg_table;
phys_addr_t fb_phys_addr;
uint32_t npages;
uint64_t info_length;
} tui_ion_mem;
#ifdef CONFIG_TEE_TUI
@@ -191,7 +191,7 @@ int __init init_tui(const struct device *dev);
void free_tui(void);
int tui_send_event(int event, struct teec_tui_parameter *tui_param);
int register_tui_driver(tui_drv_init fun, const char *name,
void *pdata);
void *pdata);
void unregister_tui_driver(const char *name);
/*
* TUI has different state that can recieve given types of message,
@@ -212,14 +212,14 @@ bool is_tui_agent(unsigned int agent_id);
#else
static inline bool is_tui_agent(unsigned int agent_id)
{
(void)agent_id;
return false;
(void)agent_id;
return false;
}
static inline int init_tui(const struct device *dev)
{
(void)dev;
return 0;
(void)dev;
return 0;
}
static inline void free_tui(void)
@@ -228,21 +228,21 @@ static inline void free_tui(void)
static inline void unregister_tui_driver(const char *name)
{
(void)name;
(void)name;
}
static inline int send_tui_msg_config(int type, int val, const void *data)
{
(void)type;
(void)val;
(void)data;
return 0;
(void)type;
(void)val;
(void)data;
return 0;
}
static inline void set_tui_caller_info(unsigned int devid, int pid)
{
(void)devid;
(void)pid;
(void)devid;
(void)pid;
}
static inline void free_tui_caller_info(void)
@@ -251,13 +251,13 @@ static inline void free_tui_caller_info(void)
static inline unsigned int tui_attach_device(void)
{
return 0;
return 0;
}
static inline int is_tui_in_use(int pid_value)
{
(void)pid_value;
return 0;
(void)pid_value;
return 0;
}
static inline void do_ns_tui_release(void)
@@ -266,9 +266,9 @@ static inline void do_ns_tui_release(void)
static inline int tc_ns_tui_event(struct tc_ns_dev_file *dev_file, const void *argp)
{
(void)dev_file;
(void)argp;
return 0;
(void)dev_file;
(void)argp;
return 0;
}
#endif
+6 -6
View File
@@ -21,16 +21,16 @@
#if ((defined CONFIG_CLIENT_AUTH) || (defined CONFIG_TEECD_AUTH))
#define CHECK_ACCESS_SUCC 0
#define CHECK_ACCESS_FAIL 0xffff
#define CHECK_ACCESS_SUCC 0
#define CHECK_ACCESS_FAIL 0xffff
#define CHECK_PATH_HASH_FAIL 0xff01
#define CHECK_SECLABEL_FAIL 0xff02
#define CHECK_SECLABEL_FAIL 0xff02
#define CHECK_CODE_HASH_FAIL 0xff03
#define ENTER_BYPASS_CHANNEL 0xff04
#define BUF_MAX_SIZE 1024
#define MAX_PATH_SIZE 512
#define SHA256_DIGEST_LENGTH 32
#define BUF_MAX_SIZE 1024
#define MAX_PATH_SIZE 512
#define SHA256_DIGEST_LENGTH 32
int calc_task_hash(unsigned char *digest, uint32_t dig_len, LosTaskCB *cur_struct);
+4 -4
View File
@@ -26,10 +26,10 @@
#include "los_adapt.h"
#include "cmdmonitor.h"
#define HASH_FILE_MAX_SIZE (16 * 1024)
#define AGENT_BUFF_SIZE (4 * 1024)
#define AGENT_MAX 32
#define PAGE_ORDER_RATIO 2
#define HASH_FILE_MAX_SIZE (16 * 1024)
#define AGENT_BUFF_SIZE (4 * 1024)
#define AGENT_MAX 32
#define PAGE_ORDER_RATIO 2
static struct list_head g_tee_agent_list;
+5 -5
View File
@@ -18,17 +18,17 @@
#define AGENT_H
#include "teek_ns_client.h"
#define MAX_PATH_SIZE 512
#define AGENT_FS_ID 0x46536673 /* FSfs */
#define AGENT_MISC_ID 0x4d495343 /* MISC */
#define MAX_PATH_SIZE 512
#define AGENT_FS_ID 0x46536673 /* FSfs */
#define AGENT_MISC_ID 0x4d495343 /* MISC */
#define AGENT_SOCKET_ID 0x69e85664 /* socket */
#define AGENT_SOCKET_ID 0x69e85664 /* socket */
#define SECFILE_LOAD_AGENT_ID 0x4c4f4144 /* SECFILE-LOAD-AGENT */
#define TEE_SECE_AGENT_ID 0x53656345 /* npu agent id */
#define TEE_FACE_AGENT1_ID 0x46616365 /* face agent id */
#define TEE_FACE_AGENT2_ID 0x46616345 /* face agent id */
#define TEE_VLTMM_AGENT_ID 0x564c544d /* vltmm agent id */
#define SYSTEM_UID 1000
#define SYSTEM_UID 1000
enum agent_state_type {
AGENT_CRASHED = 0,
+2 -2
View File
@@ -27,7 +27,7 @@
#include "tlogger.h"
#include "los_adapt.h"
#define MAX_SHARED_SIZE 0x100000 /* 1 MiB */
#define MAX_SHARED_SIZE 0x100000 /* 1 MiB */
static void free_operation(const struct tc_call_params *call_params,
struct tc_op_params *op_params);
@@ -281,7 +281,7 @@ int write_to_client(void __user *dest, size_t dest_size,
ret = memcpy_s(dest, dest_size, src, size);
if (ret != EOK) {
tloge("write to client fail. line=%d, ret=%d\n",
__LINE__, ret);
__LINE__, ret);
return ret;
}
return ret;
+1 -1
View File
@@ -356,7 +356,7 @@ static int set_login_information(struct tc_ns_dev_file *dev_file,
if (memcpy_s(dev_file->pub_key, MAX_PUBKEY_LEN, &ca_uid,
dev_file->pub_key_len)) {
tloge("failed to copy pubkey, pub key len=%u\n",
dev_file->pub_key_len);
dev_file->pub_key_len);
goto error;
}
context->params[2].memref.buffer =
+24 -24
View File
@@ -27,25 +27,25 @@
#include "cmdmonitor.h"
#include "tlogger.h"
#define SECS_SUSPEND_STATUS 0xA5A5
#define PREEMPT_COUNT 10000
#define HZ_COUNT 10
#define IDLED_COUNT 100
#define SECS_SUSPEND_STATUS 0xA5A5
#define PREEMPT_COUNT 10000
#define HZ_COUNT 10
#define IDLED_COUNT 100
/*
* when cannot find smc entry, will sleep 1ms
* because the task will be killed in 25s if it not return,
* so the retry count is 25s/1ms
*/
#define MAX_EMPTY_RUNS 100
#define TZ_CPU_ZERO 0
#define TZ_CPU_ONE 1
#define TZ_CPU_FOUR 4
#define TZ_CPU_FIVE 5
#define TZ_CPU_SIX 6
#define MAX_EMPTY_RUNS 100
#define TZ_CPU_ZERO 0
#define TZ_CPU_ONE 1
#define TZ_CPU_FOUR 4
#define TZ_CPU_FIVE 5
#define TZ_CPU_SIX 6
#define TZ_CPU_SEVEN 7
#define LOW_BYTE 0xF
#define LOW_BYTE 0xF
#define PENDING2_RETRY (-1)
#define PENDING2_RETRY (-1)
#define MAX_CHAR 0xff
@@ -100,15 +100,15 @@ enum {
enum smc_ops_exit {
SMC_OPS_NORMAL = 0x0,
SMC_OPS_SCHEDTO = 0x1,
SMC_OPS_START_SHADOW = 0x2,
SMC_OPS_START_FIQSHD = 0x3,
SMC_OPS_PROBE_ALIVE = 0x4,
SMC_OPS_ABORT_TASK = 0x5,
SMC_EXIT_NORMAL = 0x0,
SMC_EXIT_PREEMPTED = 0x1,
SMC_EXIT_SHADOW = 0x2,
SMC_EXIT_ABORT = 0x3,
SMC_EXIT_MAX = 0x4,
SMC_OPS_START_SHADOW = 0x2,
SMC_OPS_START_FIQSHD = 0x3,
SMC_OPS_PROBE_ALIVE = 0x4,
SMC_OPS_ABORT_TASK = 0x5,
SMC_EXIT_NORMAL = 0x0,
SMC_EXIT_PREEMPTED = 0x1,
SMC_EXIT_SHADOW = 0x2,
SMC_EXIT_ABORT = 0x3,
SMC_EXIT_MAX = 0x4,
};
#define SYM_NAME_LEN_MAX 16
@@ -614,7 +614,7 @@ static int do_smp_smc_send(struct smc_param *param)
"mov r2, %[a2]\n"
"mov r3, %[a3]\n"
".arch_extension sec\n"
"smc #0\n"
"smc #0\n"
"str r0, [%[re0]]\n"
"str r1, [%[re1]]\n"
"str r2, [%[re2]]\n"
@@ -1147,9 +1147,9 @@ static void print_crash_msg(union crash_inf *crash_info)
crash_info->crash_msg.sym_name_append, SYM_NAME_LEN_2))
tloge("memcpy sym_name_append failed!\n");
tloge("====crash app:%s user_sym:%s + <0x%x/0x%x>\n",
crash_app_name, syms, off, crash_info->crash_msg.size);
crash_app_name, syms, off, crash_info->crash_msg.size);
tloge("====crash far:0x%x fault:%x\n",
crash_info->crash_msg.far, crash_info->crash_msg.fault);
crash_info->crash_msg.far, crash_info->crash_msg.fault);
}
}
+6 -6
View File
@@ -43,29 +43,29 @@ struct pending_entry {
#ifdef DIV_ROUND_UP
#undef DIV_ROUND_UP
#endif
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
#define BITS_PER_BYTE 8
#define BITS_PER_BYTE 8
#ifdef BITS_TO_LONGS
#undef BITS_TO_LONGS
#endif
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(uint64_t))
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(uint64_t))
#ifdef BIT_MASK
#undef BIT_MASK
#endif
#define BIT_MASK(nr) (1UL << (((uint64_t)nr) % sizeof(uint64_t)))
#define BIT_MASK(nr) (1UL << (((uint64_t)nr) % sizeof(uint64_t)))
#ifdef BIT_WORD
#undef BIT_WORD
#endif
#define BIT_WORD(nr) ((nr) / sizeof(uint64_t))
#define BIT_WORD(nr) ((nr) / sizeof(uint64_t))
#ifdef DECLARE_BITMAP
#undef DECLARE_BITMAP
#endif
#define DECLARE_BITMAP(name, bits) uint64_t name[BITS_TO_LONGS(bits)]
#define DECLARE_BITMAP(name, bits) uint64_t name[BITS_TO_LONGS(bits)]
static inline void set_bit(int nr, volatile unsigned long *addr)
{
+1 -1
View File
@@ -102,7 +102,7 @@ static int get_pack_name_len(struct tc_ns_dev_file *dev_file,
return -EFAULT;
if (!dev_file->pkg_name_len ||
dev_file->pkg_name_len >= MAX_PACKAGE_NAME_LEN) {
dev_file->pkg_name_len >= MAX_PACKAGE_NAME_LEN) {
tloge("invalid pack name len: %u\n", dev_file->pkg_name_len);
return -EINVAL;
}
+2 -2
View File
@@ -19,8 +19,8 @@
#define TZ_PM_H
#include <linux/platform_device.h>
#define TSP_S4_SUSPEND 0xB200000C
#define TSP_S4_RESUME 0xB200000D
#define TSP_S4_SUSPEND 0xB200000C
#define TSP_S4_RESUME 0xB200000D
#define TSP_S4_ENCRYPT_AND_COPY 0xB2000010
#define TSP_S4_DECRYPT_AND_COPY 0xB2000011
+5 -5
View File
@@ -164,8 +164,8 @@ static int find_notify_sess(
mutex_lock(&dev_list->dev_lock);
list_for_each_entry(temp_dev_file, &dev_list->dev_file_list, head) {
tlogd("dev file id1 = %u, id2 = %u\n",
temp_dev_file->dev_file_id,
tc_notify_data_timer->dev_file_id);
temp_dev_file->dev_file_id,
tc_notify_data_timer->dev_file_id);
if (temp_dev_file->dev_file_id ==
tc_notify_data_timer->dev_file_id) {
mutex_lock(&temp_dev_file->service_lock);
@@ -209,8 +209,8 @@ static void tc_notify_timer_fn(struct notify_data_entry *notify_data_entry)
tc_notify_data_timer = &(notify_data_entry->context.timer);
notify_data_entry->filled = 0;
tlogd("notify data timer type is 0x%x, timer ID is 0x%x\n",
tc_notify_data_timer->property.type,
tc_notify_data_timer->property.timer_id);
tc_notify_data_timer->property.type,
tc_notify_data_timer->property.timer_id);
walk_callback_list(tc_notify_data_timer);
if (find_notify_sess(tc_notify_data_timer, &temp_ses, &enc_found))
@@ -550,7 +550,7 @@ int tz_spi_init()
g_notify_data_entry_shadow =
&g_notify_data->entry[NOTIFY_DATA_ENTRY_SHADOW - 1];
tlogi("target is: %llx\n",
g_notify_data_entry_shadow->context.shadow.target_tcb);
g_notify_data_entry_shadow->context.shadow.target_tcb);
}
g_spi_inited = 1;
return 0;
+1 -1
View File
@@ -292,7 +292,7 @@ static int tz_memstat_open(struct inode *inode, struct file *file)
}
static const struct file_operations g_tz_dbg_memstat_fops = {
.open = tz_memstat_open,
.open = tz_memstat_open,
};
#endif
+7 -7
View File
@@ -32,15 +32,15 @@
#include "los_vm_phys.h"
#include "mbedtls/sha256.h"
#define TEECD_UID 97
#define TEECD_UID 97
#define VERIFY_READ 0
#define VERIFY_WRITE 1
#define MAX_DEV_NAME_SIZE 32
#define SHA256_DIGEST_LENGTH 32
#define VERIFY_READ 0
#define VERIFY_WRITE 1
#define MAX_DEV_NAME_SIZE 32
#define SHA256_DIGEST_LENGTH 32
#define ALIGN_TZ(x, boundary) (((x) + ((boundary) - 1)) & ~((boundary) - 1))
#define MISC_DYNAMIC_MINOR 255
#define MISC_DYNAMIC_MINOR 255
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
@@ -58,7 +58,7 @@ int misc_register_adapt(struct miscdevice_adapt *misc_device);
typedef pthread_mutex_t mutex_t;
#define MAX_PATH_SIZE 512
#define MAX_PATH_SIZE 512
#ifndef IS_ERR_OR_NULL
#ifndef IS_ERR_VALUE
+3 -3
View File
@@ -20,9 +20,9 @@
#include "teek_client_type.h"
#include "los_adapt.h"
#define UUID_LEN 16
#define PARAM_NUM 4
#define ADDR_TRANS_NUM 32
#define UUID_LEN 16
#define PARAM_NUM 4
#define ADDR_TRANS_NUM 32
#define teec_param_types(param0_type, param1_type, param2_type, param3_type) \
((param3_type) << 12 | (param2_type) << 8 | \
+6 -6
View File
@@ -91,10 +91,10 @@ struct teec_tui_parameter {
uint32_t notch; /* notch size of device */
uint32_t width; /* width of foldable screen */
uint32_t height; /* height of foldable screen */
uint32_t fold_state; /* state of foldable screen */
uint32_t fold_state; /* state of foldable screen */
uint32_t display_state; /* one state of folded state */
uint32_t phy_width; /* real width of the mobile */
uint32_t phy_height; /* real height of the mobile */
uint32_t phy_width; /* real width of the mobile */
uint32_t phy_height; /* real height of the mobile */
};
struct teec_operation {
@@ -175,10 +175,10 @@ typedef struct {
uint32_t notch; /* notch size of device */
uint32_t width; /* width of foldable screen */
uint32_t height; /* height of foldable screen */
uint32_t fold_state; /* state of foldable screen */
uint32_t fold_state; /* state of foldable screen */
uint32_t display_state; /* one state of folded state */
uint32_t phy_width; /* real width of the mobile */
uint32_t phy_height; /* real height of the mobile */
uint32_t phy_width; /* real width of the mobile */
uint32_t phy_height; /* real height of the mobile */
} TEEC_TUI_Parameter;
typedef struct {
+18 -18
View File
@@ -25,29 +25,29 @@
#include "los_adapt.h"
#define TC_NS_CLIENT_IOC_MAGIC 't'
#define TC_NS_CLIENT_DEV "tc_ns_client"
#define TC_NS_CLIENT_DEV "tc_ns_client"
#define TC_NS_CLIENT_DEV_NAME "/dev/tc_ns_client"
#define TC_PRIVATE_DEV_NAME "/dev/tc_private"
#define TC_PRIVATE_DEV_NAME "/dev/tc_private"
#define EXCEPTION_MEM_SIZE (8*1024) /* mem for exception handling */
#define TSP_REQUEST 0xB2000008
#define TSP_RESPONSE 0xB2000009
#define TSP_REE_SIQ 0xB200000A
#define TSP_CRASH 0xB200000B
#define TSP_PREEMPTED 0xB2000005
#define TC_CALL_GLOBAL 0x01
#define TC_CALL_SYNC 0x02
#define TC_CALL_LOGIN 0x04
#define TSP_REQUEST 0xB2000008
#define TSP_RESPONSE 0xB2000009
#define TSP_REE_SIQ 0xB200000A
#define TSP_CRASH 0xB200000B
#define TSP_PREEMPTED 0xB2000005
#define TC_CALL_GLOBAL 0x01
#define TC_CALL_SYNC 0x02
#define TC_CALL_LOGIN 0x04
#define TEE_REQ_FROM_USER_MODE 0U
#define TEE_REQ_FROM_KERNEL_MODE 1U
#define TEE_PARAM_NUM 4
#define TEE_PARAM_NUM 4
/* Max sizes for login info buffer comming from teecd */
#define MAX_PACKAGE_NAME_LEN 255
#define MAX_PACKAGE_NAME_LEN 255
/* The apk certificate format is as follows:
* modulus_size(4 bytes) + modulus buffer(512 bytes)
* + exponent size(4 bytes) + exponent buffer(1 bytes)
*/
* modulus_size(4 bytes) + modulus buffer(512 bytes)
* + exponent size(4 bytes) + exponent buffer(1 bytes)
*/
#define MAX_PUBKEY_LEN 1024
struct tc_ns_dev_list {
@@ -124,7 +124,7 @@ struct tc_ns_login {
struct tc_ns_operation {
unsigned int paramtypes;
union tc_ns_parameter params[TEE_PARAM_NUM];
unsigned int buffer_h_addr[TEE_PARAM_NUM];
unsigned int buffer_h_addr[TEE_PARAM_NUM];
struct tc_ns_shared_mem *sharemem[TEE_PARAM_NUM];
void *mb_buffer[TEE_PARAM_NUM];
};
@@ -143,7 +143,7 @@ enum smc_cmd_type {
};
struct tc_ns_smc_cmd {
uint8_t uuid[sizeof(struct tc_uuid)];
uint8_t uuid[sizeof(struct tc_uuid)];
unsigned int cmd_type;
unsigned int cmd_id;
unsigned int dev_file_id;
@@ -156,7 +156,7 @@ struct tc_ns_smc_cmd {
unsigned int login_data_h_addr;
unsigned int login_data_len;
unsigned int err_origin;
int ret_val;
int ret_val;
unsigned int event_nr;
unsigned int uid;
unsigned int ca_pid; /* pid */
+2 -2
View File
@@ -34,11 +34,11 @@ LosTaskCB *kthread_run(int (*threadfn)(uintptr_t data, int data_len), void *data
task_init_param.pfnTaskEntry = (TSK_ENTRY_FUNC)threadfn;
task_init_param.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
task_init_param.pcName = name;
task_init_param.pcName = name;
task_init_param.usTaskPrio = 1;
task_init_param.auwArgs[0] = (uintptr_t)data;
task_init_param.auwArgs[1] = data_len;
task_init_param.uwResved = LOS_TASK_STATUS_DETACHED;
task_init_param.uwResved = LOS_TASK_STATUS_DETACHED;
ret = LOS_TaskCreate(&task_id, &task_init_param);
if (ret != LOS_OK)
+3 -3
View File
@@ -120,13 +120,13 @@ void unmap_log_mem(int *log_buffer)
get_order(PAGES_LOG_MEM_LEN));
}
#define ROOT_UID 0
#define ROOT_UID 0
#ifdef LAST_TEE_MSG_ROOT_GID
#define FILE_CHOWN_GID 0
#define FILE_CHOWN_GID 0
#else
/* system gid for last_teemsg file sys chown */
#define FILE_CHOWN_GID 1000
#define FILE_CHOWN_GID 1000
#endif
void get_log_chown(uid_t *user, gid_t *group)
+14 -14
View File
@@ -29,26 +29,26 @@
#include "los_adapt.h"
/* for log item ----------------------------------- */
#define LOG_ITEM_MAGIC 0x5A5A
#define LOG_ITEM_LEN_ALIGN 64
#define LOG_ITEM_MAX_LEN 1024
#define LOG_ITEM_MAGIC 0x5A5A
#define LOG_ITEM_LEN_ALIGN 64
#define LOG_ITEM_MAX_LEN 1024
#define LOG_READ_STATUS_ERROR 0x000FFFF
/* =================================================== */
#define LOGGER_LOG_TEEOS "teelog" /* tee os log */
#define TLOGCAT_DEV_NAME "/dev/teelog"
#define __TEELOGGERIO 0xBE /* for ioctl */
#define LOGGER_LOG_TEEOS "teelog" /* tee os log */
#define TLOGCAT_DEV_NAME "/dev/teelog"
#define __TEELOGGERIO 0xBE /* for ioctl */
#define DUMP_START_MAGIC "Dump SPI notification"
#define DUMP_END_MAGIC "Dump task states END"
#define GET_VERSION_BASE 5
#define GET_VERSION_BASE 5
#define SET_READERPOS_CUR_BASE 6
#define SET_TLOGCAT_STAT_BASE 7
#define GET_TLOGCAT_STAT_BASE 8
/* get tee verison */
#define MAX_TEE_VERSION_LEN 256
#define MAX_TEE_VERSION_LEN 256
#define TEELOGGER_GET_VERSION \
_IOR(__TEELOGGERIO, GET_VERSION_BASE, char[MAX_TEE_VERSION_LEN])
/* set the log reader pos to current pos */
@@ -88,17 +88,17 @@ struct log_item {
};
/* --- for log mem --------------------------------- */
#define TEMP_LOG_MEM_SIZE (10 * SZ_1K)
#define TEMP_LOG_MEM_SIZE (10 * SZ_1K)
#define LOG_BUFFER_RESERVED_LEN 11U
#define VERSION_INFO_LEN 156U
#define LOG_BUFFER_RESERVED_LEN 11U
#define VERSION_INFO_LEN 156U
/*
* Log's buffer flag info, size: 64 bytes head + 156 bytes's version info.
* For filed description:
* last_pos : current log's end position, last log's start position.
* write_loops: Write cyclically. Init value is 0, when memory is used
* up, the value add 1.
* up, the value add 1.
*/
struct log_buffer_flag {
uint32_t reserved0;
@@ -280,7 +280,7 @@ static ssize_t get_buffer_info(struct tlogger_reader *reader,
return 0;
}
#define LOG_BUFFER_MAX_LEN 0x100000
#define LOG_BUFFER_MAX_LEN 0x100000
static ssize_t get_last_read_pos(struct log_buffer_flag *log_flag,
struct tlogger_reader *reader, uint32_t *log_last_pos, uint32_t *is_read)
@@ -793,7 +793,7 @@ static struct log_item *msg_get_next(const unsigned char *buffer_start,
return NULL;
}
#define OPEN_FILE_MODE 0640U
#define OPEN_FILE_MODE 0640U
static int write_version_to_msg(int filep)
{