| /** |
| * @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__ */ |