Baseline update from LYNQ_SDK_ASR_T108_V05.03.01.00(kernel build error.)
Change-Id: I56fc72cd096e82c589920026553170e5cb9692eb
diff --git a/mbtk/libql_lib_v2_rilv2/ql_dm.c b/mbtk/libql_lib_v2_rilv2/ql_dm.c
index ddf304c..ca0bd6e 100755
--- a/mbtk/libql_lib_v2_rilv2/ql_dm.c
+++ b/mbtk/libql_lib_v2_rilv2/ql_dm.c
@@ -42,6 +42,7 @@
#define LYNQ_AIR_PLANE_MODE_OFF 1 // at+cfun = 1
+
#define MBTK_RILD_ERR -1
#define IMEI_VALID 1
@@ -121,7 +122,7 @@
ql_info = QL_DM_AIR_PLANE_MODE_ON;
}
- if(mbtk_info != MBTK_RADIO_STATE_FULL_FUNC && mbtk_info !=MBTK_RADIO_STATE_DIS_RF)
+ if(mbtk_info != MBTK_RADIO_STATE_FULL_FUNC && mbtk_info !=MBTK_RADIO_STATE_DIS_RF)
{
ql_info = QL_DM_AIR_PLANE_MODE_UNKNOWN;
@@ -290,34 +291,34 @@
/*-----------------------------------------------------------------------------------------------*/
int ql_dm_get_modem_state(QL_DM_MODEM_STATE_TYPE_E *modem_state)
{
- int ret = -1;
- mbtk_radio_state_enum tmp_rf;
- if(ql_info_handle == NULL)
- {
- LOGE("DM no init");
- return QL_ERR_NOT_INIT;
- }
- ret = mbtk_radio_state_get(ql_info_handle, &tmp_rf);
- if (ret != 0)
- {
- LOGE("mbtk_radio_state_get fail.");
- return QL_ERR_FAILED;
- }
-
- if(tmp_rf == 0 )
- {
- *modem_state = QL_DM_MODEM_STATE_OFFLINE;
- }
- else if(tmp_rf == 1)
- {
- *modem_state = QL_DM_MODEM_STATE_ONLINE;
- }
- else
- {
- *modem_state = QL_DM_MODEM_STATE_UNKNOWN;
- }
-
- return QL_ERR_OK;
+ int ret = -1;
+ mbtk_radio_state_enum tmp_rf;
+ if(ql_info_handle == NULL)
+ {
+ LOGE("DM no init");
+ return QL_ERR_NOT_INIT;
+ }
+ ret = mbtk_radio_state_get(ql_info_handle, &tmp_rf);
+ if (ret != 0)
+ {
+ LOGE("mbtk_radio_state_get fail.");
+ return QL_ERR_FAILED;
+ }
+
+ if(tmp_rf == 0 )
+ {
+ *modem_state = QL_DM_MODEM_STATE_OFFLINE;
+ }
+ else if(tmp_rf == 1)
+ {
+ *modem_state = QL_DM_MODEM_STATE_ONLINE;
+ }
+ else
+ {
+ *modem_state = QL_DM_MODEM_STATE_UNKNOWN;
+ }
+
+ return QL_ERR_OK;
}
diff --git a/mbtk/libql_lib_v2_rilv2/ql_ecall.c b/mbtk/libql_lib_v2_rilv2/ql_ecall.c
index 0d77b7d..00b0bac 100755
--- a/mbtk/libql_lib_v2_rilv2/ql_ecall.c
+++ b/mbtk/libql_lib_v2_rilv2/ql_ecall.c
Binary files differ
diff --git a/mbtk/libql_lib_v2_rilv2/ql_tee_service.c b/mbtk/libql_lib_v2_rilv2/ql_tee_service.c
new file mode 100755
index 0000000..14d3b46
--- /dev/null
+++ b/mbtk/libql_lib_v2_rilv2/ql_tee_service.c
@@ -0,0 +1,195 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+
+#include "ql_tee_service.h"
+#include "mbtk_log.h"
+#include <tee_client_api.h>
+
+
+struct test_ctx {
+ TEEC_Context ctx;
+ TEEC_Session sess;
+};
+
+
+struct test_ctx ctx;
+
+const void *obj_id;
+uint32_t obj_size;
+
+#define lib_secure_path "/lib/libsecure_storage.so"
+static void *dlHandle_secure;
+
+
+
+
+int (*prepare_tee_session)(struct test_ctx *ctx);
+void (*terminate_tee_session)(struct test_ctx *ctx);
+TEEC_Result (*read_secure_object)(struct test_ctx *ctx, const void *id, uint32_t id_size, char *data, size_t data_len);
+TEEC_Result (*write_secure_object)(struct test_ctx *ctx, const void *id, uint32_t id_size, char *data, size_t data_len);
+TEEC_Result (*delete_secure_object)(struct test_ctx *ctx, const void *id, uint32_t id_size);
+
+
+static int tee_api_import(void)
+{
+ dlHandle_secure = dlopen(lib_secure_path, RTLD_NOW);
+ if (dlHandle_secure == NULL)
+ {
+ return -1;
+ }
+
+ prepare_tee_session = (int (*)(struct test_ctx *ctx))dlsym(dlHandle_secure, "prepare_tee_session");
+ if (prepare_tee_session == NULL)
+ {
+ LOGE("prepare_tee_session dlsym fail\n");
+ return -1;
+ }
+
+ terminate_tee_session = (void (*)(struct test_ctx *ctx))dlsym(dlHandle_secure, "terminate_tee_session");
+ if (terminate_tee_session == NULL)
+ {
+ LOGE("terminate_tee_session dlsym fail\n");
+ return -1;
+ }
+
+ read_secure_object = (TEEC_Result (*)(struct test_ctx *ctx, const void *id, uint32_t id_size,char *data, size_t data_len))dlsym(dlHandle_secure, "read_secure_object");
+ if (read_secure_object == NULL)
+ {
+ LOGE("read_secure_object dlsym fail\n");
+ return -1;
+ }
+
+ write_secure_object = (TEEC_Result (*)(struct test_ctx *ctx, const void *id, uint32_t id_size, char *data, size_t data_len))dlsym(dlHandle_secure, "write_secure_object");
+ if (write_secure_object == NULL)
+ {
+ LOGE("write_secure_object dlsym fail\n");
+ return -1;
+ }
+
+ delete_secure_object = (TEEC_Result (*)(struct test_ctx *ctx, const void *id, uint32_t id_size))dlsym(dlHandle_secure, "delete_secure_object");
+ if (delete_secure_object == NULL)
+ {
+ LOGE("delete_secure_object dlsym fail\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+/**
+* @brief init tee sdk
+* @param [in] None
+* @param [out] None
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+ql_tee_error_t ql_ss_initialize(void)
+{
+ int32_t ret = 0;
+ ret = tee_api_import();
+ if(ret)
+ {
+ LOGE("tee_api_import fail\n");
+ return ret;
+ }
+ ret = prepare_tee_session(&ctx);
+
+ return ret;
+}
+
+void ql_ss_deinitialize(void)
+{
+
+ terminate_tee_session(&ctx);
+
+}
+ql_tee_error_t ql_ss_open(const void *id, uint32_t id_size, uint32_t *object)
+{
+
+ obj_id = id;
+ obj_size = id_size;
+ return 0;
+}
+
+ql_tee_error_t ql_ss_close(uint32_t object)
+{
+
+ obj_id = NULL;
+ obj_size = 0;
+ return 0;
+
+}
+
+/**
+* @brief read sensitive data from tee
+* @param [in] char* in_obj_name :Sensitive data name
+* @param [in] unsigned int* p_out_buf_len:The size of sensitive data output cache
+* @param [out] char* out_buf:Cache of sensitive data output
+* @param [out] unsigned int* p_out_buf_len:Sensitive data length
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+
+ql_tee_error_t ql_ss_read(uint32_t object, void *data, uint32_t data_size, uint32_t *count)
+{
+ int32_t ret = 0;
+ TEEC_Result res;
+
+ res = read_secure_object(&ctx, obj_id, obj_size, data, data_size);
+ if (res != TEEC_SUCCESS)
+ {
+ LOGE("Failed to read an object from the secure storage");
+ ret = -1;
+ }
+
+ *count = strlen(data);
+ return ret;
+}
+
+
+/**
+* @brief write sensitive data to tee
+* @param [in] char* in_obj_name :Sensitive data name
+* @param [in] char* in_buf:A cache for writing sensitive data
+* @param [out] unsigned int in_buf_len:Sensitive data length
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+ql_tee_error_t ql_ss_write(uint32_t object, void *data, uint32_t data_size)
+{
+ int32_t ret = 0;
+ TEEC_Result res;
+ res = write_secure_object(&ctx, obj_id, obj_size, data, data_size);
+ if (res != TEEC_SUCCESS)
+ {
+ LOGE("Failed to write an object from the secure storage");
+ ret = -1;
+ }
+
+ return ret;
+}
+
+
+/**
+* @brief delete sensitive data from tee
+* @param [in] char* in_obj_name :Sensitive data name
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+ql_tee_error_t ql_ss_unlink(uint32_t object)
+{
+ int32_t ret = 0;
+ TEEC_Result res;
+ res = delete_secure_object(&ctx, obj_id, obj_size);
+ if (res != TEEC_SUCCESS)
+ {
+ LOGE("Failed to delete the object: 0x%x", res);
+ ret = -1;
+ }
+
+
+ return ret;
+
+}
+
+
+
+