[Feature][T108][system][task-view-1692]Merged gsw hal code
Only Configure: No
Affected branch: GSW_V1453
Affected module: libgsw
Is it affected on IC: only ASR
Self-test: yes
Doc Update: no
Change-Id: I7fb669b6afc6e2f92a1e86ec8543498eb73120b4
diff --git a/mbtk/include/gsw/gsw_at_interface.h b/mbtk/include/gsw/gsw_at_interface.h
index 2e604f9..c1a79f4 100755
--- a/mbtk/include/gsw/gsw_at_interface.h
+++ b/mbtk/include/gsw/gsw_at_interface.h
@@ -72,6 +72,7 @@
/**
* @brief get modem temperture, E02 and E06 unused
+ * @details support thread safe
* @param [in] num ZONE_NUM
* @param [out] temp ZONE_NUM_TEMP
* @retval 0: LYNQ_THM_OK
diff --git a/mbtk/include/gsw/gsw_gpio.h b/mbtk/include/gsw/gsw_gpio.h
deleted file mode 100755
index d49cacc..0000000
--- a/mbtk/include/gsw/gsw_gpio.h
+++ /dev/null
@@ -1,66 +0,0 @@
-typedef enum{
- GSW_HAL_PINDIR_IN,
- GSW_HAL_PINDIR_OUT,
-}gsw_hal_pinDirection;
-
-typedef enum{
- GSW_HAL_LEVEL_LOW,
- GSW_HAL_LEVEL_HIGH,
-}gsw_hal_pinLevel;
-
-typedef enum{
- GSW_HAL_PULL_NULL,
- GSW_HAL_PULL_DOWN,
- GSW_HAL_PULL_UP,
-}gsw_hal_pinPullSel;
-
-typedef enum{
- GSW_HAL_USB_DISCONNECTED,
- GSW_HAL_USB_CONNECTED,
-}gsw_hal_usbStatus;
-
-
-/**
-* @brief Gpio init
-* @param [in]uint32_t gpioNum
-* @param [in]gsw_hal_pinDirection dir
-* @param [in]gsw_hal_pinLevel level
-* @param [in]gsw_hal_pinPullSel pullsel
-* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
-*/
-int32_t gsw_gpio_Init(uint32_t gpioNum, gsw_hal_pinDirection dir, gsw_hal_pinLevel level, gsw_hal_pinPullSel pullsel);
-
-
-/**
-* @brief Gpio set direction
-* @param [in]uint32_t gpioNum
-* @param [in]gsw_hal_pinDirection dir
-* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
-*/
-int32_t gsw_gpio_SetDirection(uint32_t gpioNum, gsw_hal_pinDirection dir);
-/**
-* @brief Gpio set level
-* @param [in]uint32_t gpioNum
-* @param [in]gsw_hal_pinLevel level
-* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
-*/
-int32_t gsw_gpio_SetLevel(uint32_t gpioNum, gsw_hal_pinLevel level);
-
-/**
-* @brief Gpio get level
-* @param [in]uint32_t gpioNum
-* @retval gsw_hal_pinLevel
-*/
-gsw_hal_pinLevel gsw_gpio_GetLevel(uint32_t gpioNum);
-
-/**
-* @brief check whether the usb is connected
-* @retval gsw_hal_usbStatus
-*/
-gsw_hal_usbStatus gsw_hwpin_is_usb_connected(void);
-
-/**
-* @brief Wakeup_out set level
-* @retval int32_t
-*/
-int32_t gsw_setWakeupLevel(gsw_hal_pinLevel level);
\ No newline at end of file
diff --git a/mbtk/include/gsw/gsw_hal_errcode.h b/mbtk/include/gsw/gsw_hal_errcode.h
index 7eafd24..4f2175f 100755
--- a/mbtk/include/gsw/gsw_hal_errcode.h
+++ b/mbtk/include/gsw/gsw_hal_errcode.h
@@ -18,6 +18,7 @@
#define GSW_HAL_ARG_INVALID (-0x0011)
#define GSW_HAL_NO_MEMORY (-0x0012)
+#define GSW_HAL_NO_SUPPROT (-0x0013)
//GPIO
diff --git a/mbtk/include/gsw/gsw_hwpin_interface.h b/mbtk/include/gsw/gsw_hwpin_interface.h
old mode 100644
new mode 100755
index cfceb4b..4ecaff6
--- a/mbtk/include/gsw/gsw_hwpin_interface.h
+++ b/mbtk/include/gsw/gsw_hwpin_interface.h
@@ -174,11 +174,10 @@
/**
* @brief fstrim emmc.
* @param [in] emmc_path: example "/media"
- * @retval 0: success
+ * @retval 0: no need fstrim, 1: need fstrim(Currently only AN758 is required)
* @retval other: fail
*/
int gsw_hwpin_fstrim_emmc(const char *emmc_path);
-
#endif
diff --git a/mbtk/include/gsw/gsw_nw_interface.h b/mbtk/include/gsw/gsw_nw_interface.h
index b3e0326..2e34df5 100755
--- a/mbtk/include/gsw/gsw_nw_interface.h
+++ b/mbtk/include/gsw/gsw_nw_interface.h
@@ -441,6 +441,10 @@
GSW_MODEM_STATE_UNKNOWN = 0, /**< modem unknow */
GSW_MODEM_STATE_ONLINE, /**< modem work online */
GSW_MODEM_STATE_OFFLINE, /**< modem offline */
+ GSW_SDK_STATE_SERVICE_DOWN,
+ GSW_SDK_STATE_SERVICE_UP,
+ GSW_SDK_STATE_GPS_DOWN,
+ GSW_SDK_STATE_GPS_UP,
}gsw_mode_state_e;
@@ -607,6 +611,7 @@
/**
* @brief get current network reg info
+ * @details support thread safe
* @param [out] GSW_NW_SERVING_INFO struct for network info
* include regstate ps_state opreator name mcc mcn etc
* @retval 0: success
@@ -617,6 +622,7 @@
/**
* @brief get current network type
+ * @details support thread safe
* @param [out] netype as GSW_NW_RADIO_ACCESS_TECH_E type
* @retval 0: success
* @retval other: fail
@@ -670,6 +676,7 @@
/**
* @brief get signal csq value
+ * @details support thread safe
* @param [out] csq_value csq of signalstrengh 0 - 31
* @retval 0: success
* @retval other: fail
@@ -678,6 +685,7 @@
/**
* @brief get current serving cell info
+ * @details support thread safe
* @param [out] GSW_NW_CELL_INFO: struct for current cell info
* include earfcn mcc mnc pci psc tac lac etc.
* @return int: 0 is success, other failed
@@ -686,6 +694,7 @@
/**
* @brief get mobile operator name
+ * @details support thread safe
* @param [out] gsw_mobile_operator_name: get the long and short operator name info
* @retval 0: success
* @retval 0: other: fail
@@ -736,6 +745,7 @@
/**
* @brief get sim state
+ * @details support thread safe
* @param [out] sim_state sim status as sim_status_e_type
* @retval 0: success
* @retval other: fail
@@ -745,6 +755,7 @@
/**
* @brief get iccid function
+ * @details support thread safe
* @param [in] len iccid length,max is 20
* @param [out] iccid return iccid from this func
* @retval 0: success
@@ -755,6 +766,7 @@
/**
* @brief get imsi function
+ * @details support thread safe
* @param [in] len imsi length,max is 20
* @param [out] iccid return imsi from this func
* @retval 0: success
@@ -765,6 +777,7 @@
/**
* @brief get sim msisdn function
+ * @details support thread safe
* @param [in] len msisdn length,max is 20
* @param [out] msisdn msisdn length,max is 20
* @retval 0: success
@@ -775,6 +788,7 @@
/**
* @brief get imei function
+ * @details support thread safe
* @param [in] len imei length,max is 20
* @param [out] imei return imei from this func
* @retval 0: success
@@ -1005,6 +1019,7 @@
/**
* @brief get tcamid function
+ * @details support thread safe
* @param [in] len tcamid length
* @param [out] iccid return tcamid from this func
* @retval 0 : success
diff --git a/mbtk/include/gsw/gsw_secrypt_ss_interface.h b/mbtk/include/gsw/gsw_secrypt_ss_interface.h
new file mode 100755
index 0000000..d4a4bca
--- /dev/null
+++ b/mbtk/include/gsw/gsw_secrypt_ss_interface.h
@@ -0,0 +1,80 @@
+/**
+* @file : gsw_secrypt_ss_interface.h
+* @brief : tee storage
+* @date : 2022-07-05
+* @author : Wind
+* @version : v1.0
+* @copyright Copyright(C) 2022,Geely
+*/
+#ifndef __GSW_SECRYPT_SS_INTERFACE_H__
+#define __GSW_SECRYPT_SS_INTERFACE_H__
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#include "gsw_hal_errcode.h"
+
+#undef SS_DATA_MAXSIZE
+#define SS_DATA_MAXSIZE (4000U) /*double check at sfs_common.h*/
+
+#undef SECRYPT_RET_SUCCESS
+#define SECRYPT_RET_SUCCESS GSW_HAL_SUCCESS
+#undef SECRYPT_RET_NORMAL_FAIL
+#define SECRYPT_RET_NORMAL_FAIL GSW_HAL_NORMAL_FAIL
+#undef SECRYPT_RET_ARG_INVALID
+#define SECRYPT_RET_ARG_INVALID GSW_HAL_ARG_INVALID
+#undef SECRYPT_RET_NO_MEMORY
+#define SECRYPT_RET_NO_MEMORY GSW_HAL_NO_MEMORY
+
+/**
+ * @brief check data in secure storage region
+ *
+ * @param[in] objname object name you want to check
+ * @param[out] exist_state exist state of the object, 1:exist, 0:not exist
+ *
+ * @return 0 on success, negative on failure
+ *
+ */
+int32_t gsw_secure_storage_query(const char *objname, int32_t *exist_state);
+
+/**
+ * @brief read plaintext in secure storage region
+ *
+ * @param[in] objname object name you want to read
+ * @param[out] outbuf pointer of out data buffer
+ * @param[in] buflen length of out data buffer
+ * @param[out] outlen length of out data
+ *
+ * @return 0 on success, negative on failure
+ */
+int32_t gsw_secure_storage_read(const char *objname, uint8_t *outbuf,
+ uint32_t buflen, uint32_t *outlen);
+
+/**
+* @brief store data to secure storage region
+*
+* @param[in] objname input data identifier
+* @param[in] inbuf pointer to input data
+* @param[in] inlen length of the input data
+*
+* @return 0 on success, negative on failure
+*/
+int32_t gsw_secure_storage_write(const char *objname, const uint8_t *inbuf,
+ uint32_t inlen);
+
+ /**
+ * @brief delete data from secure storage region
+ *
+ * @param[in] objname delete data identifier
+ *
+ * @return 0 on success, negative on failure
+ */
+int32_t gsw_secure_storage_delete(const char *objname);
+
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __GSW_SECRYPT_SS_INTERFACE_H__ */
diff --git a/mbtk/include/gsw/gsw_sys_interface.h b/mbtk/include/gsw/gsw_sys_interface.h
index a7f22cf..e986ebc 100755
--- a/mbtk/include/gsw/gsw_sys_interface.h
+++ b/mbtk/include/gsw/gsw_sys_interface.h
@@ -1,53 +1,53 @@
/**
* @file : gsw_sys_interface.h
-* @date : 2025-6-11
-* @copyright Copyright(C) 2022,Gosuncnwelink
+* @brief : system service ctrl
+* @date : 2022-07-05
+* @author : Wind
+* @version : v1.0
+* @copyright Copyright(C) 2022,Geely
*/
-#ifndef __GSW_SYS_INTERFACE__H__
-#define __GSW_SYS_INTERFACE__H__
+#ifndef __GSW_SYS_INTERFACE_H__
+#define __GSW_SYS_INTERFACE_H__
-/*********************************************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <stddef.h>
+#include <stdint.h>
#include "gsw_hal_errcode.h"
-
/**
-* @brief start or restart ftp server
-* @param [in] cfg the ftp server config file
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
+ * @brief start or restart ftp server
+ * @param [in] cfg the ftp server config file
+ * @retval 0: success
+ * @retval other: fail
+ */
int gsw_sys_svr_ftp_start(const char *cfg);
/**
-* @brief stop ftp server
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
+ * @brief stop ftp server
+ * @retval 0: success
+ * @retval other: fail
+ */
int gsw_sys_svr_ftp_stop(void);
/**
-* @brief start or restart sshserver
-* @param [in] cfg the sshserver config file
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
+ * @brief start or restart ssh server
+ * @param [in] cfg the ssh server config file
+ * @retval 0: success
+ * @retval other: fail
+ */
int gsw_sys_svr_ssh_start(const char *cfg);
/**
-* @brief stop sshserver
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
+ * @brief stop ssh server
+ * @retval 0: success
+ * @retval other: fail
+ */
int gsw_sys_svr_ssh_stop(void);
/**
-* @brief restart syslog server
-* @param [in] log_lvl, range [emerg alert crit err warning notice info debug]
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
+ * @brief restart syslog server
+ * @param [in] log_lvl, range [emerg alert crit err warning notice info debug]
+ * @retval 0: success
+ * @retval other: fail
+ */
int gsw_sys_svr_syslog_restart(const char *log_lvl);
-
-#endif //__GSW_SYS_INTERFACE__H_
+#endif // __GSW_SYS_INTERFACE_H__
diff --git a/mbtk/include/gsw/gsw_tz_interface.h b/mbtk/include/gsw/gsw_tz_interface.h
deleted file mode 100755
index 325fd8c..0000000
--- a/mbtk/include/gsw/gsw_tz_interface.h
+++ /dev/null
@@ -1,600 +0,0 @@
-/**
-* @copyright Copyright @ Fibocom Technologies Co., Ltd. 2019-2030. All rights reserved
-* @file : gsw_tee_interface.h
-* @brief : sdk interface
-* @date :
-* @author : hanmd
-* @version : v1.0
-*/
-
-#ifndef __GSW_TZ_INTERFACE_H__
-#define __GSW_TZ_INTERFACE_H__
-
-#include <stdint.h>
-#include <stddef.h>
-#include <string.h>
-#include <stdbool.h>
-#include "gsw_hal_errcode.h"
-
-#define UNUSE(param) (void)(param)
-
-/** The maximum data size of a invoke */
-#define GSW_TWO_PAGESIZE (8192)
-
-/** The maxmum filename size of sfs/key */
-#define GSW_FILENAME_MAXSIZE (32)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
- GSW_TEE_PARAM_DATA = 1,
- GSW_TEE_PARAM_FILE
-}GSW_TEE_PARAM_TYPE;
-
-typedef enum {
- GSW_TEE_DIGEST_MD5 = 1,
- GSW_TEE_DIGEST_SHA1,
- GSW_TEE_DIGEST_SHA256,
-}GSW_TEE_DIGEST_TYPE;
-
-typedef enum {
- GSW_TEE_AES_ECB = 1,
- GSW_TEE_AES_CBC,
- GSW_TEE_AES_CMAC,
- GSW_TEE_AES_GCM,
-}GSW_TEE_AES_ALGO_TYPE;
-
-typedef enum {
- GSW_TEE_AES_128 = 1,
- GSW_TEE_AES_192,
- GSW_TEE_AES_256
-}GSW_TEE_AES_ALGO_BITS;
-
-typedef enum {
- GSW_TEE_AES_PADDING_NONE = 1,
- GSW_TEE_AES_PADDING_PKCS7
-}GSW_TEE_AES_PADDING_TYPE;
-
-typedef enum {
- GSW_TEE_CRYPTO_ENCRYPT = 1,
- GSW_TEE_CRYPTO_DECRYPT,
- GSW_TEE_CRYPTO_SIGN,
- GSW_TEE_CRYPTO_VERIFY
-}GSW_TEE_CRYPTO_TYPE;
-
-typedef enum {
- GSW_TEE_RSA_BITS_2048 = 1,
- GSW_TEE_RSA_BITS_3072,
- GSW_TEE_RSA_BITS_4096
-}GSW_TEE_RSA_BITS_TYPE;
-
-typedef enum {
- GSW_TEE_RSA_ED_PADDING_NONE = 1,
- GSW_TEE_RSA_ED_PADDING_PKCS1,
- GSW_TEE_RSA_ED_PADDING_OAEP
-}GSW_TEE_RSA_ED_PADDING_TYPE;
-
-typedef enum {
- GSW_TEE_SV_SRC_DATA = 1,
- GSW_TEE_SV_SRC_SHA256,
- GSW_TEE_SV_SRC_SHA384,
- GSW_TEE_SV_SRC_SHA512
-}GSW_TEE_SV_SRC_TYPE;
-
-typedef enum {
- GSW_TEE_RSA_SV_PADDING_NONE = 1,
- GSW_TEE_RSA_SV_PADDING_PKCS1_V1_5,
- GSW_TEE_RSA_SV_PADDING_PSS
-}GSW_TEE_RSA_SV_PADDING_TYPE;
-
-typedef enum {
- GSW_TEE_ECC_ED_CURVE_ALGO_NISTP192=1,
- GSW_TEE_ECC_ED_CURVE_ALGO_NISTP224,
- GSW_TEE_ECC_ED_CURVE_ALGO_NISTP256,
- GSW_TEE_ECC_ED_CURVE_ALGO_NISTP384,
- GSW_TEE_ECC_ED_CURVE_ALGO_NISTP521
-}GSW_TEE_ECC_ED_CURVE_ALGO_MODE;
-
-typedef enum {
- GSW_TEE_ECC_BITS_192=1,
- GSW_TEE_ECC_BITS_224,
- GSW_TEE_ECC_BITS_256,
- GSW_TEE_ECC_BITS_384,
- GSW_TEE_ECC_BITS_521
-}GSW_TEE_ECC_BITS_TYPE;
-
-typedef enum {
- GSW_TEE_ECC_SV_CURVE_ALGO_ECDSA = 1,
- GSW_TEE_ECC_SV_CURVE_ALGO_EDDSA,
-}GSW_TEE_ECC_SV_CURVE_ALGO_MODE;
-
-typedef enum {
- GSW_TEE_SM4_ECB = 1,
- GSW_TEE_SM4_CBC,
- GSW_TEE_SM4_CFB,
- GSW_TEE_SM4_CTR,
- GSW_TEE_SM4_OFB,
- GSW_TEE_SM4_CMAC,
- GSW_TEE_SM4_GCM,
-}GSW_TEE_SM4_ALGO_TYPE;
-
-typedef enum {
- GSW_TEE_SM4_PADDING_PKCS5 = 1,
- GSW_TEE_SM4_PADDING_PKCS7
-}GSW_TEE_SM4_PADDING_TYPE;
-
-typedef struct
-{
- unsigned short len; /**< data len*/
- unsigned char data[512]; /**< key data*/
-} GSW_TEE_KEY_UNIT_INFO;
-
-typedef struct
-{
- unsigned int bits; /**< Public key bits*/
- GSW_TEE_KEY_UNIT_INFO x; /**< Public key x component*/
- GSW_TEE_KEY_UNIT_INFO y; /**< Public key y component*/
-} GSW_TEE_SM2_PUB_KEY;
-
-typedef struct
-{
- unsigned int bits; /**< Public key bits*/
- GSW_TEE_KEY_UNIT_INFO x; /**< Public key x component*/
- GSW_TEE_KEY_UNIT_INFO y; /**< Public key y component*/
-} GSW_TEE_ECC_PUB_KEY;
-
-typedef struct
-{
- unsigned int bits; /**< Public key bits*/
- GSW_TEE_KEY_UNIT_INFO n; /**< Mode of public key*/
- unsigned int e; /**< Power of public key*/
-} GSW_TEE_RSA_PUB_KEY;
-
-typedef struct
-{
- unsigned int bits; /**< Public key bits*/
- GSW_TEE_KEY_UNIT_INFO d; /**< Private key*/
-} GSW_TEE_SM2_PRI_KEY;
-
-typedef struct
-{
- unsigned int bits; /**< Public key bits*/
- GSW_TEE_KEY_UNIT_INFO d; /**< Private key*/
- GSW_TEE_ECC_ED_CURVE_ALGO_MODE curve_type; /**< Curve algorithm*/
-} GSW_TEE_ECC_PRI_KEY;
-
-typedef struct
-{
- GSW_TEE_KEY_UNIT_INFO n; /**< Mode of public key*/
- GSW_TEE_KEY_UNIT_INFO d;
-} GSW_TEE_RSA_PRI_KEY_ND;
-
-typedef struct
-{
- GSW_TEE_KEY_UNIT_INFO p; /**< Prime factor 1*/
- GSW_TEE_KEY_UNIT_INFO q; /**< Prime factor 2*/
- GSW_TEE_KEY_UNIT_INFO dp; /**< crt powers of p*/
- GSW_TEE_KEY_UNIT_INFO dq; /**< crt powers of q*/
- GSW_TEE_KEY_UNIT_INFO ce; /**< The inverse modulo p of q*/
-} GSW_TEE_RSA_PRI_KEY_PQDC;
-
-typedef struct
-{
- unsigned int bits; /**< Public key bits*/
- union RSA_KEY_INFO{
- GSW_TEE_RSA_PRI_KEY_ND ne;
- GSW_TEE_RSA_PRI_KEY_PQDC pqdc;
- }key_info;
-} GSW_TEE_RSA_PRI_KEY;
-
-typedef struct
-{
- GSW_TEE_CRYPTO_TYPE crypto_type; /**< Type of operation*/
- GSW_TEE_AES_ALGO_TYPE algo_type; /**< Algorithm type*/
- unsigned int in_iv_len; /**< Vector quantity length*/
- unsigned char iv[32]; /**< Vector quantity*/
- GSW_TEE_SM4_PADDING_TYPE padding; /**< Filling mode*/
- GSW_TEE_PARAM_TYPE data_type; /**< data type*/
- unsigned int in_data_len; /**< Source data length*/
- char data[1]; /**< Source data/file name*/
-} GSW_TEE_SM4_IN_PARAM;
-
-typedef struct
-{
- GSW_TEE_PARAM_TYPE data_type; /**< data type*/
- unsigned int* p_out_buf_len; /**< File length or buf size*/
- char data[1]; /**< buf Cache or file path*/
-} GSW_TEE_SM4_OUT_PARAM;
-
-typedef struct
-{
- GSW_TEE_CRYPTO_TYPE crypto_type; /**< Type of operation*/
- GSW_TEE_PARAM_TYPE data_type; /**< data type*/
- GSW_TEE_SV_SRC_TYPE src_type; /**< Type of data source*/
- GSW_TEE_DIGEST_TYPE digt_type;
- unsigned int in_data_len; /**< Source data length*/
- char data[1]; /**< Source data/file name*/
-} GSW_TEE_SM2_SV_IN_PARAM;
-
-typedef struct
-{
- GSW_TEE_PARAM_TYPE data_type; /**< data type*/
- unsigned int* p_out_buf_len; /**< File length or buf size*/
- char data[1]; /**< buf Cache or file path*/
-} GSW_TEE_SM2_SV_OUT_PARAM;
-
-typedef struct
-{
- GSW_TEE_CRYPTO_TYPE crypto_type; /**< Type of operation*/
- GSW_TEE_PARAM_TYPE data_type; /**< data type*/
- unsigned int in_data_len; /**< Source data length*/
- char data[1]; /**< Source data/file name*/
-} GSW_TEE_SM2_ED_IN_PARAM;
-
-typedef struct
-{
- GSW_TEE_PARAM_TYPE data_type; /**< data type*/
- unsigned int* p_out_buf_len; /**< File length or buf size*/
- char data[1]; /**< buf Cache or file path*/
-} GSW_TEE_SM2_ED_OUT_PARAM;
-
-typedef struct
-{
- GSW_TEE_CRYPTO_TYPE crypto_type; /**< Type of operation*/
- GSW_TEE_ECC_BITS_TYPE bits_type; /**< Algorithm bit*/
- GSW_TEE_ECC_SV_CURVE_ALGO_MODE curve_type; /**< Curve algorithm*/
- GSW_TEE_DIGEST_TYPE digt_type;
- GSW_TEE_SV_SRC_TYPE src_type; /**< Type of data source*/
- GSW_TEE_PARAM_TYPE data_type; /**< data type*/
- unsigned int in_data_len; /**< Source data length*/
- char data[1]; /**< Source data/file name*/
-} GSW_TEE_ECC_SV_IN_PARAM;
-
-typedef struct
-{
- GSW_TEE_PARAM_TYPE data_type; /**< data type*/
- unsigned int* p_out_buf_len; /**< File length or buf size*/
- char data[1]; /**< buf Cache or file path*/
-} GSW_TEE_ECC_SV_OUT_PARAM;
-
-typedef struct
-{
- GSW_TEE_CRYPTO_TYPE crypto_type; /**< Type of operation*/
- GSW_TEE_ECC_BITS_TYPE bits_type; /**< Algorithm bit*/
- GSW_TEE_ECC_ED_CURVE_ALGO_MODE curve_type; /**< Curve algorithm*/
- GSW_TEE_PARAM_TYPE data_type; /**< data type*/
- unsigned int in_data_len; /**< Source data length*/
- char data[1]; /**< Source data/file name*/
-} GSW_TEE_ECC_ED_IN_PARAM;
-
-typedef struct
-{
- GSW_TEE_PARAM_TYPE data_type; /**< data type*/
- unsigned int* p_out_buf_len; /**< File length or buf size*/
- char data[1]; /**< buf Cache or file path*/
-} GSW_TEE_ECC_ED_OUT_PARAM;
-
-typedef struct
-{
- GSW_TEE_CRYPTO_TYPE crypto_type; /**< Type of operation*/
- GSW_TEE_RSA_SV_PADDING_TYPE padding; /**< Filling mode*/
- GSW_TEE_RSA_BITS_TYPE bits_type; /**< Algorithm bit*/
- GSW_TEE_SV_SRC_TYPE src_type; /**< Type of data source*/
- GSW_TEE_DIGEST_TYPE digt_type;
- GSW_TEE_PARAM_TYPE data_type; /**< data type*/
- unsigned int in_data_len; /**< Source data length*/
- char data[1]; /**< Source data/file name*/
-} GSW_TEE_RSA_SV_IN_PARAM;
-
-typedef struct
-{
- GSW_TEE_PARAM_TYPE data_type; /**< data type*/
- unsigned int* p_out_buf_len; /**< File length or buf size*/
- char data[1]; /**< buf Cache or file path*/
-} GSW_TEE_RSA_SV_OUT_PARAM;
-
-typedef struct
-{
- GSW_TEE_CRYPTO_TYPE crypto_type; /**< Type of operation*/
- GSW_TEE_RSA_ED_PADDING_TYPE padding; /**< Filling mode*/
- GSW_TEE_RSA_BITS_TYPE bits_type; /**< Algorithm bit*/
- GSW_TEE_PARAM_TYPE data_type; /**< data type*/
- unsigned int in_data_len; /**< Source data length*/
- char data[1]; /**< Source data/file name*/
-} GSW_TEE_RSA_ED_IN_PARAM;
-
-typedef struct
-{
- GSW_TEE_PARAM_TYPE data_type; /**< data type*/
- unsigned int* p_out_buf_len; /**< File length or buf size*/
- char data[1]; /**< buf Cache or file path*/
-} GSW_TEE_RSA_ED_OUT_PARAM;
-
-typedef struct
-{
- GSW_TEE_CRYPTO_TYPE crypto_type; /**< Type of operation*/
- GSW_TEE_AES_ALGO_TYPE algo_type; /**< Algorithm type*/
- unsigned int in_iv_len; /**< Vector quantity length*/
- unsigned char iv[32]; /**< Vector quantity*/
- GSW_TEE_AES_PADDING_TYPE padding; /**< Filling mode*/
- GSW_TEE_PARAM_TYPE data_type; /**< data type*/
- unsigned int in_data_len; /**< Source data length*/
- char data[1]; /**< Source data/file name*/
-} GSW_TEE_AES_IN_PARAM;
-
-typedef struct
-{
- GSW_TEE_PARAM_TYPE data_type; /**< data type*/
- unsigned int* p_out_buf_len; /**< File length or buf size*/
- char data[1]; /**< buf Cache or file path*/
-} GSW_TEE_AES_OUT_PARAM;
-
-
-
-/**
-* @brief init tee sdk
-* @param [in] None
-* @param [out] None
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_sdk_init(void);
-
-/**
-* @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
-*/
-int32_t gsw_tee_read_secure_data(const char* in_obj_name, char* out_buf, unsigned int* p_out_buf_len);
-
-/**
-* @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
-*/
-int32_t gsw_tee_write_secure_data(const char* in_obj_name, char* in_buf, unsigned int in_buf_len);
-
-/**
-* @brief delete sensitive data from tee
-* @param [in] char* in_obj_name :Sensitive data name
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_delete_secure_data(const char* in_obj_name);
-
-/**
-* @brief check sensitive data from tee
-* @param [in] char* in_obj_name :Sensitive data name
-* @retval GSW_HAL_SUCCESS is exist\ other is not exist or fail
-*/
-int32_t gsw_tee_check_secure_data(const char* in_obj_name);
-
-/**
-* @brief digest algorithm
-* @param [in] char* in_data :Source data/file name
-* @param [in] unsigned int in_data_len :Source data length
-* @param [in] unsigned int* p_out_buf_len:The size of Destination cache
-* @param [in] GSW_TEE_PARAM_TYPE in_param: in_data param type
-* @param [in] GSW_TEE_DIGEST_TYPE in_digest: digest algo type
-* @param [out] char *out_buf:Destination cache
-* @param [out] unsigned int* p_out_buf_len:Destination data length
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_digest_algo(char* in_data, unsigned int in_data_len, char *out_buf, unsigned int* p_out_buf_len,GSW_TEE_PARAM_TYPE in_param,GSW_TEE_DIGEST_TYPE in_digest);
-
-/**
-* @brief aes algorithm
-* @param [in] char* in_obj_name :Key name or key information structure
-* @param [in] GSW_TEE_AES_IN_PARAM* in_param :Entry information
-* @param [in/out] GSW_TEE_AES_OUT_PARAM out_param :Exit message
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_aes_algo(char* in_obj_name, GSW_TEE_AES_IN_PARAM* in_param, GSW_TEE_AES_OUT_PARAM* out_param);
-
-/**
-* @brief generate random
-* @param [in] unsigned int in_len :generate random bits
-* @param [in] GSW_TEE_PARAM_TYPE out_param:out_buf param type
-* @param [out/in] char *out_buf:Destination cache/file name
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_gen_random(char *out_buf, unsigned int in_len,GSW_TEE_PARAM_TYPE out_param);
-
-/**
-* @brief rsa Encryption and decryption algorithm
-* @param [in] char* in_obj_name :Key name or key information structure
-* @param [in] GSW_TEE_RSA_ED_IN_PARAM * in_param:Entry information
-* @param [in/out] GSW_TEE_RSA_ED_OUT_PARAM * out_param:Exit message
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_rsa_ed_algo(char* in_obj_name, GSW_TEE_RSA_ED_IN_PARAM * in_param, GSW_TEE_RSA_ED_OUT_PARAM * out_param);
-
-/**
-* @brief rsa Signature verification algorithm
-* @param [in] char* in_obj_name :Key name or key information structure
-* @param [in] GSW_TEE_RSA_SV_IN_PARAM* in_param :Source data/file name
-* @param [in/out] GSW_TEE_RSA_SV_OUT_PARAM* out_param :Source data length
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_rsa_sv_algo(char* in_obj_name, GSW_TEE_RSA_SV_IN_PARAM* in_param, GSW_TEE_RSA_SV_OUT_PARAM* out_param);
-
-/**
-* @brief ecc Encryption and decryption algorithm
-* @param [in] char* in_obj_name :Key name or key information structure
-* @param [in] GSW_TEE_ECC_ED_IN_PARAM * in_param:Entry information
-* @param [in/out] GSW_TEE_ECC_ED_OUT_PARAM * out_param:Exit message
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_ecc_ed_algo(char* in_obj_name,GSW_TEE_ECC_ED_IN_PARAM * in_param, GSW_TEE_ECC_ED_OUT_PARAM * out_param);
-
-/**
-* @brief ecc Signature verification algorithm
-* @param [in] char* in_obj_name :Key name or key information structure
-* @param [in] GSW_TEE_ECC_SV_IN_PARAM* in_param :Source data/file name
-* @param [in/out] GSW_TEE_ECC_SV_OUT_PARAM* out_param :Source data length
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_ecc_sv_algo(char* in_obj_name,GSW_TEE_ECC_SV_IN_PARAM * in_param, GSW_TEE_ECC_SV_OUT_PARAM * out_param);
-
-/**
-* @brief sm2 Encryption and decryption algorithm
-* @param [in] char* in_obj_name :Key name or key information structure
-* @param [in] GSW_TEE_SM2_ED_IN_PARAM * in_param:Entry information
-* @param [in/out] GSW_TEE_SM2_ED_OUT_PARAM * out_param:Exit message
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_sm2_ed_algo(char* in_obj_name, GSW_TEE_SM2_ED_IN_PARAM* in_param, GSW_TEE_SM2_ED_OUT_PARAM *out_param);
-
-/**
-* @brief sm2 Signature verification algorithm
-* @param [in] char* in_obj_name :Key name or key information structure
-* @param [in] GSW_TEE_SM2_SV_IN_PARAM * in_param:Entry information
-* @param [in/out] GSW_TEE_SM2_SV_OUT_PARAM * out_param:Exit message
-* @retval GSW_HAL_SUCCESS is success\other is failL
-*/
-int32_t gsw_tee_sm2_sv_algo(char* in_obj_name, GSW_TEE_PARAM_TYPE* in_param, GSW_TEE_PARAM_TYPE* out_param);
-
-/**
-* @brief sm3 algorithm
-* @param [in] char* in_data :Source data/file name
-* @param [in] unsigned int in_data_len :Source data length
-* @param [in] unsigned int* p_out_buf_len:The size of Destination cache
-* @param [in] GSW_TEE_PARAM_TYPE in_param: in_data param type
-* @param [out] char *out_buf:Destination cache
-* @param [out] unsigned int* p_out_buf_len:Destination data length
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_sm3_algo(char* in_data, unsigned int in_data_len, char *out_buf, unsigned int* p_out_buf_len,GSW_TEE_PARAM_TYPE in_param);
-
-/**
-* @brief sm4 algorithm
-* @param [in] char* in_obj_name :Key name or key information structure
-* @param [in] GSW_TEE_AM4_IN_PARAM* in_param :Entry information
-* @param [in/out] GSW_TEE_AM4_OUT_PARAM out_param :Exit message
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_sm4_algo(char* in_obj_name, GSW_TEE_SM4_IN_PARAM* in_param, GSW_TEE_SM4_OUT_PARAM *out_param);
-
-/**
-* @brief key import
-* @param [in] char* in_obj_name :Key name or key information structure
-* @param [in] char* in_data :Source data/file name
-* @param [in] unsigned int in_data_len :Source data length
-* @param [in] bool permanent :Key import type
-* @param [out] void *out_buf :Returns key information
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_aes_key_import(char* in_obj_name, char* in_data, unsigned int in_data_len,void *out_buf,bool permanent);
-
-/**
-* @brief rsa key import
-* @param [in] char* in_obj_name :Key name or key information structure
-* @param [in] GSW_TEE_RSA_PUB_KEY* in_pub_data :Public key information
-* @param [in] GSW_TEE_RSA_PRI_KEY* in_pri_data :Private key information
-* @param [in] bool permanent :Key import type
-* @param [out] void *out_buf :Returns key information
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_rsa_key_import(char* in_obj_name, GSW_TEE_RSA_PUB_KEY* in_pub_data,GSW_TEE_RSA_PRI_KEY* in_pri_data,void *out_buf,bool permanent);
-
-/**
-* @brief ecc key import
-* @param [in] char* in_obj_name :Key name or key information structure
-* @param [in] GSW_TEE_ECC_PUB_KEY* in_data :Public key information
-* @param [in] GSW_TEE_ECC_PRI_KEY* in_data :Private key information
-* @param [in] bool permanent :Key import type
-* @param [out] void *out_buf :Returns key information
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_ecc_key_import(char* in_obj_name, GSW_TEE_ECC_PUB_KEY* in_pub_data, GSW_TEE_ECC_PRI_KEY* in_pri_data,void *out_buf,bool permanent);
-
-/**
-* @brief ecc key import
-* @param [in] char* in_obj_name :Key name or key information structure
-* @param [in] GSW_TEE_SM2_PUB_KEY* in_data :Public key information
-* @param [in] GSW_TEE_SM2_PRI_KEY* in_data :Private key information
-* @param [in] bool permanent :Key import type
-* @param [out] void *out_buf :Returns key information
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_sm2_key_import(char* in_obj_name, GSW_TEE_SM2_PUB_KEY* in_pub_data, GSW_TEE_SM2_PRI_KEY* in_pri_data,void *out_buf,bool permanent);
-
-/**
-* @brief sm4 key import
-* @param [in] char* in_obj_name :Key name or key information structure
-* @param [in] char* in_data :Source data/file name
-* @param [in] unsigned int in_data_len :Source data length
-* @param [in] bool permanent :Key import type
-* @param [out] void *out_buf :Returns key information
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_sm4_key_import(char* in_obj_name, char* in_data, unsigned int in_data_len,void *out_buf,bool permanent);
-
-/**
-* @brief key export
-* @param [in] char* in_obj_name :Key name or key information structure
-* @param [in] unsigned int* p_out_buf_len:The size of Destination cache
-* @param [out] char *out_buf:Destination cache/file name
-* @param [out] unsigned int* p_out_buf_len:Destination data length
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_aes_key_export(char* in_obj_name, char *out_buf, unsigned int* p_out_buf_len);
-
-/**
-* @brief key export
-* @param [in] char* in_obj_name :Key name or key information structure
-* @param [out] GSW_TEE_RSA_PUB_KEY*out_buf:Destination cache
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_rsa_pub_key_export(char* in_obj_name, GSW_TEE_RSA_PUB_KEY*out_buf);
-
-/**
-* @brief ecc key export
-* @param [in] char* in_obj_name :Key name or key information structure
-* @param [out] GSW_TEE_ECC_PUB_KEY *out_buf:Destination cache
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_ecc_pub_key_export(char* in_obj_name, GSW_TEE_ECC_PUB_KEY*out_buf);
-
-/**
-* @brief sm2 key export
-* @param [in] char* in_obj_name :Key name or key information structure
-* @param [out] GSW_TEE_SM2_PUB_KEY *out_buf:Destination cache
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_sm2_pub_key_export(char* in_obj_name, GSW_TEE_SM2_PUB_KEY*out_buf);
-
-/**
-* @brief sm4 key export
-* @param [in] char* in_obj_name :Key name or key information structure
-* @param [in] unsigned int* p_out_buf_len:The size of Destination cache
-* @param [out] char *out_buf:Destination cache/file name
-* @param [out] unsigned int* p_out_buf_len:Destination data length
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_sm4_key_export(char* in_obj_name, char *out_buf, unsigned int* p_out_buf_len);
-
-/**
-* @brief delete key
-* @param [in] char* in_obj_name :Key name or key information structure
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_key_delete(char* in_obj_name);
-
-/**
-* @brief deinit tee sdk
-* @param [in] None
-* @param [out] None
-* @retval GSW_HAL_SUCCESS is success\other is fail
-*/
-int32_t gsw_tee_sdk_deinit(void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif //__GSW_TZ_INTERFACE_H__