mirror of
https://github.com/openharmony/tee_tee_dev_kit.git
synced 2026-08-25 09:09:44 -04:00
@@ -13,9 +13,9 @@
|
||||
/**
|
||||
* @file oemkey.h
|
||||
*
|
||||
* @brief Interfaces related to the provision key function.
|
||||
* @brief Provides the method for obtaining the hardware provision key.
|
||||
*
|
||||
* Provides the function of reading the hardware provision key.
|
||||
*
|
||||
*
|
||||
* @since 1
|
||||
*/
|
||||
@@ -26,13 +26,13 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
* @brief Get provision Key
|
||||
* @brief Obtains the provision key.
|
||||
*
|
||||
* @param oem_key [IN]Buffer for storing provision keys.
|
||||
* @param key_size [IN]The length of the buffer used to store the provision key is 16.
|
||||
* @param oem_key Indicates the pointer to the buffer for storing the provision key.
|
||||
* @param key_size Indicates the length of the buffer used to store the provision key, which is 16.
|
||||
*
|
||||
* @return 0 Indicates that the function executed successfully.
|
||||
* @return others Failed to obtain the provision key
|
||||
* @return Returns <b>0</b> if the operation is successful.
|
||||
* @return Returns other values otherwise.
|
||||
*
|
||||
*/
|
||||
uint32_t tee_hal_get_provision_key(uint8_t *oem_key, size_t key_size);
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
/**
|
||||
* @file tee_crypto_hal.h
|
||||
*
|
||||
* @brief 加解密接口
|
||||
* @brief Provides APIs for cryptographic operations.
|
||||
*
|
||||
* 开发者可以使用这些接口实现加解密的相关功能。
|
||||
* You can use these APIs to implement encryption and decryption.
|
||||
*
|
||||
* @since 1
|
||||
*/
|
||||
@@ -28,25 +28,25 @@ enum CRYPTO_ENGINE {
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 将加密和解密引擎设置为运行
|
||||
* @brief Sets the encryption and decryption engines to an operation.
|
||||
*
|
||||
* @param operation [IN/OUT]操作的句柄
|
||||
* @param crypto [IN]要设置的engine
|
||||
* @param operation Indicates the handle of the operation to set.
|
||||
* @param crypto Indicates the engines to set.
|
||||
*
|
||||
* @return TEE_SUCCESS 设置加密引擎成功
|
||||
* @return TEE_ERROR_BAD_PARAMETERS 操作为NULLi或加密无效
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_BAD_PARAMETERS</b> if <b>operation</b> is null or <b>crypto</b> is invalid.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_SetCryptoFlag(TEE_OperationHandle operation, uint32_t crypto);
|
||||
|
||||
/**
|
||||
* @brief 设置加解密引擎为object
|
||||
* @brief Sets the encryption and decryption engines to an object.
|
||||
*
|
||||
* @param operation [IN/OUT]对象的句柄
|
||||
* @param crypto [IN]要设置的engine
|
||||
* @param object Indicates the handle of the object to set.
|
||||
* @param crypto Indicates the engines to set.
|
||||
*
|
||||
* @return TEE_SUCCESS 设置加密引擎成功
|
||||
* @return TEE_ERROR_BAD_PARAMETERS 操作为NULLi或加密无效
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_BAD_PARAMETERS</b> if <b>object</b> is null or <b>crypto</b> is invalid.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_SetObjectFlag(TEE_ObjectHandle object, uint32_t crypto);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
/**
|
||||
* @file tee_ext_api.h
|
||||
*
|
||||
* @brief 扩展接口
|
||||
* @brief Provides extended interfaces.
|
||||
*
|
||||
* @since 1
|
||||
*/
|
||||
@@ -31,21 +31,22 @@ extern "C" {
|
||||
|
||||
|
||||
/**
|
||||
* @brief TA可以调用此API添加调用者信息,允许调用此TA。此API用于CA,以二进制可执行文件的形式
|
||||
* @brief Adds information about a caller that can invoke this TA.
|
||||
* This API applies to the client applications (CAs) in the binary executable file format.
|
||||
*
|
||||
* @param ca_name[IN]CA调用方的进程名称
|
||||
* @param ca_uid[IN]CA调用方的uid
|
||||
* @param ca_name Indicates the process name of the caller of the CA.
|
||||
* @param ca_uid Indicates the UID of the caller.
|
||||
*
|
||||
* @return TEE_SUCCESS 操作成功
|
||||
* @return others 无法为目标CA添加主叫方信息
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns other information otherwise.
|
||||
*
|
||||
*/
|
||||
TEE_Result AddCaller_CA_exec(const char *ca_name, uint32_t ca_uid);
|
||||
|
||||
/**
|
||||
* @brief 获取当前会话类型
|
||||
* @brief Obtains the session type.
|
||||
*
|
||||
* @return 当前会话的会话类型
|
||||
* @return Returns the session type obtained.
|
||||
*
|
||||
*/
|
||||
uint32_t TEE_GetSessionType(void);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
/**
|
||||
* @file tee_hw_ext_api.h
|
||||
*
|
||||
* @brief 扩展接口
|
||||
* @brief Provides extended interfaces.
|
||||
*
|
||||
* @since 1
|
||||
*/
|
||||
@@ -23,13 +23,13 @@
|
||||
#include "tee_defines.h"
|
||||
|
||||
/**
|
||||
* @brief 在TEE中获取设备唯一ID
|
||||
* @brief Obtains the unique device ID from the TEE.
|
||||
*
|
||||
* @param device_unique_id [IN]用于存储结果的缓冲区
|
||||
* @param length [IN/OUT]设备ID缓冲区长度
|
||||
* @param device_unique_id Indicates the pointer to the buffer for storing the device ID.
|
||||
* @param length Indicates the pointer to the buffer length.
|
||||
*
|
||||
* @return TEE_SUCCESS 操作成功
|
||||
* @return others 操作失败
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns other information otherwise.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_EXT_GetDeviceUniqueId(uint8_t *device_unique_id, uint32_t *length);
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
/**
|
||||
* @file tee_log.h
|
||||
*
|
||||
* @brief tee log api
|
||||
* @brief Provides TEE log APIs.
|
||||
*
|
||||
* Reference of TEE log api and internal definitions.
|
||||
* Reference of TEE log APIs and internal definitions.
|
||||
*
|
||||
* @since 1
|
||||
*/
|
||||
@@ -115,7 +115,7 @@ extern const char *g_debug_prefix;
|
||||
#endif /* TA_LOG_LEVEL >= TA_LOG_LEVEL_WARNING */
|
||||
|
||||
/* tloge */
|
||||
#if (TA_LOG_LEVEL >= TA_LOG_LEVEL_ERROR) /* Always meet this condition */
|
||||
#if (TA_LOG_LEVEL >= TA_LOG_LEVEL_ERROR) /* Always meet this condition. */
|
||||
#ifndef TLOGE_NO_TIMESTAMP
|
||||
#ifdef DRIVER_LOG_TAG
|
||||
#define tloge(fmt, args...) \
|
||||
@@ -132,4 +132,4 @@ extern const char *g_debug_prefix;
|
||||
} while (0)
|
||||
#endif /* TA_LOG_LEVEL >= TA_LOG_LEVEL_ERROR */
|
||||
|
||||
#endif /* __TEE_LOG_H */
|
||||
#endif /* __TEE_LOG_H */
|
||||
|
||||
+198
-182
@@ -13,7 +13,7 @@
|
||||
/**
|
||||
* @file tee_arith_api.h
|
||||
*
|
||||
* @brief 大数操作接口
|
||||
* @brief Provides APIs for operating big integers.
|
||||
*
|
||||
* @since 1
|
||||
*/
|
||||
@@ -24,440 +24,456 @@
|
||||
#include <tee_defines.h>
|
||||
|
||||
/**
|
||||
* below definitions are defined by Global Platform
|
||||
* for compatibility:
|
||||
* don't make any change to the content below
|
||||
* The definitions below are defined by Global Platform
|
||||
* for compatibility.
|
||||
* Do not make any change to the content below.
|
||||
*/
|
||||
typedef uint32_t TEE_BigInt;
|
||||
typedef uint32_t TEE_BigIntFMM;
|
||||
typedef uint32_t TEE_BigIntFMMContext;
|
||||
|
||||
/**
|
||||
* @brief 返回u32中的BigInt的大小
|
||||
* @brief Obtains the size of the array of uint32_t values required to represent a <b>BigInt</b>.
|
||||
*
|
||||
* @param n [IN]TEE_BigInt类型
|
||||
* @param n Indicates the <b>TEE_BigInt</b> type.
|
||||
*
|
||||
* @return 32中的BigInt的大小
|
||||
* @return Returns the <b>BigInt</b> size obtained.
|
||||
*
|
||||
*/
|
||||
#define TEE_BigIntSizeInU32(n) ((((n) + 31) / 32) + 2)
|
||||
|
||||
/**
|
||||
* @brief 返回uint32_t值数组的大小
|
||||
* @brief Obtains the size of the array of uint32_t values.
|
||||
*
|
||||
* @param modulusSizeInBits [IN]模数的大小(以bits为单位)
|
||||
* @param modulusSizeInBits Indicates the modulus size, in bits.
|
||||
*
|
||||
* @return 给定长度模数modSizeInBits,存储TEE_BigIntFMM所需的字节数
|
||||
* @return Returns the number of bytes required to store a <b>TEE_BigIntFMM</b>,
|
||||
* given a modulus of length <b>modSizeInBits</b>.
|
||||
*
|
||||
*/
|
||||
size_t TEE_BigIntFMMSizeInU32(size_t modulusSizeInBits);
|
||||
|
||||
/**
|
||||
* @brief 返回表示快速模块化上下文所需的uint32_t值数组的大小
|
||||
* @brief Obtains the size of an array of uint32_t values required to represent a fast modular context.
|
||||
*
|
||||
* @param modulusSizeInBits [IN]模数的大小(以bits为单位)
|
||||
* @param modulusSizeInBits Indicates the modulus size, in bits.
|
||||
*
|
||||
* @return 存储TEE_BigIntFMMContext所需的字节数,给定长度模数modSizeInBits
|
||||
* @return Returns the number of bytes required to store a <b>TEE_BigIntFMMContext</b>,
|
||||
* given a modulus of length <b>modSizeInBits</b>.
|
||||
*
|
||||
*/
|
||||
size_t TEE_BigIntFMMContextSizeInU32(size_t modulusSizeInBits);
|
||||
|
||||
/**
|
||||
* @brief 初始化bigInt
|
||||
* @brief Initializes a <b>TEE_BigInt</b>.
|
||||
*
|
||||
* @param bigInt [OUT]指向要初始化的TEE_BigInt的指针
|
||||
* @param len [IN]bigInt指向的内存的大小,单位为uint32_t
|
||||
* @param bigInt Indicates the pointer to the <b>TEE_BigInt</b> to initialize.
|
||||
* @param len Indicates the size of the memory pointed to by <b>TEE_BigInt</b>, in uint32_t.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntInit(TEE_BigInt *bigInt, size_t len);
|
||||
|
||||
/**
|
||||
* @brief 计算快速模乘法的必要先决条件,并将它们存储在上下文中
|
||||
* @brief Calculates the necessary prerequisites for fast modular multiplication and stores them in a context.
|
||||
*
|
||||
* @param context [OUT]要初始化的TEE_BigIntFMMContext指针
|
||||
* @param len [IN]上下文指向的内存的大小(以uint32_t为单位)
|
||||
* @param modulus [IN]模数
|
||||
* @param context Indicates the pointer to the <b>TEE_BigIntFMMContext</b> to initialize.
|
||||
* @param len Indicates the size of the memory pointed to by <b>context</b>, in uint32_t.
|
||||
* @param modulus Indicates the pointer to the modulus.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntInitFMMContext(TEE_BigIntFMMContext *context, size_t len, const TEE_BigInt *modulus);
|
||||
|
||||
|
||||
/**
|
||||
* @brief 计算快速模乘法的必要先决条件,并将它们存储在上下文中
|
||||
* @brief Calculates the necessary prerequisites for fast modular multiplication and stores them in a context.
|
||||
*
|
||||
* @param context [OUT]要初始化的TEE_BigIntFMMContext指针
|
||||
* @param len [IN]上下文指向的内存的大小(以uint32_t为单位)
|
||||
* @param modulus [IN]模数
|
||||
* @param context Indicates the pointer to the <b>TEE_BigIntFMMContext</b> to initialize.
|
||||
* @param len Indicates the size of the memory pointed to by <b>context</b>, in uint32_t.
|
||||
* @param modulus Indicates the pointer to the modulus.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return 其它返回值 失败
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns other values if the operation fails.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_BigIntInitFMMContext1(TEE_BigIntFMMContext *context, size_t len, const TEE_BigInt *modulus);
|
||||
|
||||
/**
|
||||
* @brief 初始化bigIntFMM并将其表示的值设置为零
|
||||
* @brief Initializes a <b>TEE_BigIntFMM</b> and sets its represented value to zero.
|
||||
*
|
||||
* @param bigIntFMM [IN]要初始化的TEE_BigIntFMM指针
|
||||
* @param len [IN]bigIntFMM指向的内存大小,单位为uint32_t
|
||||
* @param bigIntFMM Indicates the pointer to the <b>TEE_BigIntFMM</b> to initialize.
|
||||
* @param len Indicates the size of the memory pointed to by <b>bigIntFMM</b>, in uint32_t.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntInitFMM(TEE_BigIntFMM *bigIntFMM, size_t len);
|
||||
|
||||
/**
|
||||
* @brief 将bufferLen字节八位字节字符串缓冲区转换为TEE_BigInt格式
|
||||
* @brief Converts an octet string buffer into the <b>TEE_BigInt</b> format.
|
||||
*
|
||||
* @param dest [OUT]指向用于保存结果的TEE_BigInt的指针
|
||||
* @param buffer [IN]指向包含整数的八位字节字符串表示形式的缓冲区的指针
|
||||
* @param bufferLen [IN]buffer的长度(以字节为单位)
|
||||
* @param sign [IN]dest的标志被设置为标志的标志
|
||||
* @param dest Indicates the pointer to the <b>TEE_BigInt</b> that holds the result.
|
||||
* @param buffer Indicates the pointer to the buffer that holds the octet string representation of the integer.
|
||||
* @param bufferLen Indicates the buffer length, in bytes.
|
||||
* @param sign Indicates the sign of <b>dest</b>, which is set to the sign of <b>sign</b>.
|
||||
*
|
||||
* @return TEE_SUCCESS 支持
|
||||
* @return TEE_ERROR_OVERFLOW 为dest分配的内存太小
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_OVERFLOW</b> if the memory allocated for <b>dest</b> is too small.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_BigIntConvertFromOctetString(TEE_BigInt *dest, const uint8_t *buffer, size_t bufferLen, int32_t sign);
|
||||
|
||||
/**
|
||||
* @brief 将TEE_BigInt格式的整数的绝对值转换为八位字节字符串
|
||||
* @brief Converts the absolute value of an integer in <b>TEE_BigInt</b> format into an octet string.
|
||||
*
|
||||
* @param buffer [OUT]写入整数的转换八位字节字符串表示的输出缓冲区
|
||||
* @param bufferLen [IN]buffer的长度(以字节为单位)
|
||||
* @param bigInt [IN]指向将转换为八位字节字符串的整数的指针
|
||||
* @param buffer Indicates the pointer to the output buffer that holds the converted octet string representation
|
||||
* of the integer.
|
||||
* @param bufferLen Indicates the pointer to the buffer length, in bytes.
|
||||
* @param bigInt Indicates the pointer to the integer to convert.
|
||||
*
|
||||
* @return TEE_SUCCESS 支持
|
||||
* @return TEE_ERROR_SHORT_BUFFER 输出缓冲区太小,无法包含八位字节字符串
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_SHORT_BUFFER</b> if the output buffer is too small to hold the octet string.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_BigIntConvertToOctetString(void *buffer, size_t *bufferLen, const TEE_BigInt *bigInt);
|
||||
|
||||
/**
|
||||
* @brief 将*dest设置为值shortVal
|
||||
* @brief Sets <b>dest</b> to the value <b>shortVal</b>.
|
||||
*
|
||||
* @param dest [OUT]指向用于存储结果的TEE_BigInt的指针
|
||||
* @param shortVal [IN]输入值
|
||||
* @param dest Indicates the pointer to the <b>TEE_BigInt</b> that holds the result.
|
||||
* @param shortVal Indicates the value to set.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntConvertFromS32(TEE_BigInt *dest, int32_t shortVal);
|
||||
|
||||
/**
|
||||
* @brief 将*dest设置为src的值,包括src的符号
|
||||
* @brief Sets <b>dest</b> to the value of <b>src</b>, including the sign of <b>src</b>.
|
||||
*
|
||||
* @param dest [OUT]指向用于存储结果的int32_t的指针
|
||||
* @param src [IN]输入值指针
|
||||
* @param dest Indicates the pointer to the <b> int32_t</b> that holds the result.
|
||||
* @param src Indicates the pointer to the value to set.
|
||||
*
|
||||
* @return TEE_SUCCESS 支持
|
||||
* @return TEE_ERROR_OVERFLOW src不适合int32_t
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_OVERFLOW</b> if <b>src</b> does not fit within an <b> int32_t</b>.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_BigIntConvertToS32(int32_t *dest, const TEE_BigInt *src);
|
||||
|
||||
/**
|
||||
* @brief 检查op1>op2、op1==op2或op1<op2
|
||||
* @brief Checks whether op1 > op2, op1 == op2, or op1 < op2.
|
||||
*
|
||||
* @param op1 [IN]指向第一个操作数的指针
|
||||
* @param op2 [IN]指向第二个操作数的指针
|
||||
* @param op1 Indicates the pointer to the first operand.
|
||||
* @param op2 Indicates the pointer to the second operand.
|
||||
*
|
||||
* @return 0 op1==op2
|
||||
* @return 正数 op1>op2
|
||||
* @return Returns <b>0</b> if op1 == op2.
|
||||
* @return Returns a positive number if op1 > op2.
|
||||
*
|
||||
*/
|
||||
int32_t TEE_BigIntCmp(const TEE_BigInt *op1, const TEE_BigInt *op2);
|
||||
|
||||
/**
|
||||
* @brief 检查是op>shortVal、op==shortVal或op<shortVal
|
||||
* @brief Checks whether op > shortVal, op == shortVal, or op < shortVal.
|
||||
*
|
||||
* @param op [IN]指向第一个操作数的指针
|
||||
* @param shortVal [IN]指向第二个操作数的指针
|
||||
* @param op Indicates the pointer to the first operand.
|
||||
* @param shortVal Indicates the pointer to the second operand.
|
||||
*
|
||||
* @return 0 op1==shortVal
|
||||
* @return 正数 op1>shortVal
|
||||
* @return Returns <b>0</b> if op1 == shortVal.
|
||||
* @return Returns a positive number if op1 > shortVal.
|
||||
*
|
||||
*/
|
||||
int32_t TEE_BigIntCmpS32(const TEE_BigInt *op, int32_t shortVal);
|
||||
|
||||
/**
|
||||
* @brief 计算 |dest| = |op| >> bits
|
||||
* @brief Computes |dest| = |op| >> bits.
|
||||
*
|
||||
* @param dest [OUT]指向TEE_BigInt的指针,用于保存移位的结果
|
||||
* @param op [IN]指向要移位的操作数的指针
|
||||
* @param bits [IN]要移位的位数
|
||||
* @param dest Indicates the pointer to the <b>TEE_BigInt</b> that holds the shifted result.
|
||||
* @param op Indicates the pointer to the operand to be shifted.
|
||||
* @param bits Indicates the number of bits to shift.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntShiftRight(TEE_BigInt *dest, const TEE_BigInt *op, size_t bits);
|
||||
|
||||
/**
|
||||
* @brief 返回|src|的自然二进制表示的bitIndex位
|
||||
* @brief Obtains the <b>bitIndex</b> bit of the natural binary representation of |src|.
|
||||
*
|
||||
* @param src [IN]整数指针
|
||||
* @param bitIndex [IN]要读取的位的偏移量,从最低有效位的偏移量0开始
|
||||
* @param src Indicates the pointer to the integer.
|
||||
* @param bitIndex Indicates the offset of the bit to read, starting from offset <b>0</b> of the least significant bit.
|
||||
*
|
||||
* @return true |src|中bitIndexth位的布尔值为“1”
|
||||
* @return false |src|中bitIndexth位的布尔值为“0”
|
||||
* @return Returns the Boolean value of <b>bitIndexth</b> in |src|. The value <b>true</b> represents a <b>1</b>,
|
||||
* @return and <b>false</b> represents a <b>0</b>.
|
||||
*
|
||||
*/
|
||||
bool TEE_BigIntGetBit(const TEE_BigInt *src, uint32_t bitIndex);
|
||||
|
||||
/**
|
||||
* @brief 返回|src|的自然二进制表示中的位数;即src的大小
|
||||
* @brief Obtains the number of bits in the natural binary representation of |src|,
|
||||
* that is, the magnitude of <b>src</b>.
|
||||
*
|
||||
* @param src [IN]整数指针
|
||||
* @param src Indicates the pointer to the integer.
|
||||
*
|
||||
* @return 0 src=0
|
||||
* @return src的自然二进制表示中的位数。
|
||||
* @return Returns <b>0</b> if <b>src</b> is <b>0</b>.
|
||||
* @return Returns the number of bits in the natural binary representation of <b>src</b>.
|
||||
*
|
||||
*/
|
||||
uint32_t TEE_BigIntGetBitCount(const TEE_BigInt *src);
|
||||
|
||||
#if defined(API_LEVEL) && (API_LEVEL >= API_LEVEL1_2)
|
||||
/**
|
||||
* @brief 将op的自然二进制表示的bitIndex第1位设置为1或0
|
||||
* @brief Sets the first bit of <b>bitIndex</b> in the natural binary representation of <b>op</b> to
|
||||
* <b>1</b> or <b>0</b>.
|
||||
*
|
||||
* @param op [IN/OUT]整数指针
|
||||
* @param bitIndex [IN]要设置的位的偏移量,从最低有效位的偏移量0开始
|
||||
* @param value [IN]要设置的位值,其中true表示“1”,false表示“0”
|
||||
* @param op Indicates the pointer to the integer.
|
||||
* @param bitIndex Indicates the offset of the bit to set, starting from offset <b>0</b> of the least significant bit.
|
||||
* @param value Indicates the bit value to set. The value <b>true</b> represents a <b>1</b>, and the value <b>false</b>
|
||||
* represents a <b>0</b>.
|
||||
*
|
||||
* @return TEE_SUCCESS 支持
|
||||
* @return TEE_ERROR_OVERFLOW bitIndexth位大于op的分配位长度
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_OVERFLOW bitIndexth</b> if the <b>bitIndexth</b> bit is larger than the allocated bit
|
||||
* length of <b>op</b>.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_BigIntSetBit(TEE_BigInt *op, uint32_t bitIndex, bool value);
|
||||
|
||||
/**
|
||||
* @brief 将src的值赋值给dest
|
||||
* @brief Assigns the value of <b>src</b> to <b>dest</b>.
|
||||
*
|
||||
* @param dest [OUT]要分配的TEE_BigInt指针
|
||||
* @param src [IN]指向源操作数的指针
|
||||
* @param dest Indicates the pointer to the <b>TEE_BigInt</b> to be assigned.
|
||||
* @param src Indicates the pointer to the source operand.
|
||||
*
|
||||
* @return TEE_SUCCESS 支持
|
||||
* @return TEE_ERROR_OVERFLOW 如果dest操作数不能容纳src的值
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_OVERFLOW</b> if the <b>dest</b> operand cannot hold the value of <b>src</b>.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_BigIntAssign(TEE_BigInt *dest, const TEE_BigInt *src);
|
||||
|
||||
/**
|
||||
* @brief 将src的值赋给dest
|
||||
* @brief Assigns the value of <b>src</b> to <b>dest</b>.
|
||||
*
|
||||
* @param dest [OUT]要分配的TEE_BigInt指针
|
||||
* @param src [IN]指向源操作数的指针
|
||||
* @param dest Indicates the pointer to the <b>TEE_BigInt</b> to be assigned.
|
||||
* @param src Indicates the pointer to the source operand.
|
||||
*
|
||||
* @return TEE_SUCCESS 支持
|
||||
* @return TEE_ERROR_OVERFLOW 如果dest操作数不能容纳src的值
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_OVERFLOW</b> if the <b>dest</b> operand cannot hold the value of <b>src</b>.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_BigIntAbs(TEE_BigInt *dest, const TEE_BigInt *src);
|
||||
#endif /* API_LEVEL */
|
||||
|
||||
/**
|
||||
* @brief 计算 dest= op1 + op2
|
||||
* @brief Computes dest = op1 + op2.
|
||||
*
|
||||
* @param dest [OUT]指向TEE_BigInt的指针,用于存储结果op1 + op2
|
||||
* @param op1 [IN]指向第一个操作数的指针
|
||||
* @param op2 [IN]指向第二个操作数的指针
|
||||
* @param dest Indicates the pointer to the <b>TEE_BigInt</b> that holds the sum of <b>op1</b> and <b>op2</b>.
|
||||
* @param op1 Indicates the pointer to the first operand.
|
||||
* @param op2 Indicates the pointer to the second operand.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntAdd(TEE_BigInt *dest, const TEE_BigInt *op1, const TEE_BigInt *op2);
|
||||
|
||||
/**
|
||||
* @brief 计算 dest= op1 - op2
|
||||
* @brief Computes dest = op1 – op2.
|
||||
*
|
||||
* @param dest [OUT]指向TEE_BigInt的指针,用于存储结果op1 - op2
|
||||
* @param op1 [IN]指向第一个操作数的指针
|
||||
* @param op2 [IN]指向第二个操作数的指针
|
||||
* @param dest Indicates the pointer to the <b>TEE_BigInt</b> that holds the difference between <b>op1</b>
|
||||
* and <b>op2</b>.
|
||||
* @param op1 Indicates the pointer to the first operand.
|
||||
* @param op2 Indicates the pointer to the second operand.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntSub(TEE_BigInt *dest, const TEE_BigInt *op1, const TEE_BigInt *op2);
|
||||
|
||||
/**
|
||||
* @brief 取反操作数:dest = -op
|
||||
* @brief Negates an operand: dest = –op.
|
||||
*
|
||||
* @param dest [OUT]P指向TEE_BigInt的指针,用于存储结果-op
|
||||
* @param op [IN]指向要取反的操作数的指针
|
||||
* @param dest Indicates the pointer to the <b>TEE_BigInt</b> that holds the result –op.
|
||||
* @param op Indicates the pointer to the operand to be negated.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntNeg(TEE_BigInt *dest, const TEE_BigInt *op);
|
||||
|
||||
/**
|
||||
* @brief 计算 dest = op1 * op2
|
||||
* @brief Computes dest = op1 * op2.
|
||||
*
|
||||
* @param dest [OUT]指向TEE_BigInt的指针,用于存储结果op1 * op2
|
||||
* @param op1 [IN]指向第一个操作数的指针
|
||||
* @param op2 [IN]指向第二个操作数的指针
|
||||
* @param dest Indicates the pointer to the <b>TEE_BigInt</b> that holds the product of <b>op1</b> and <b>op2</b>.
|
||||
* @param op1 Indicates the pointer to the first operand.
|
||||
* @param op2 Indicates the pointer to the second operand.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntMul(TEE_BigInt *dest, const TEE_BigInt *op1, const TEE_BigInt *op2);
|
||||
|
||||
/**
|
||||
* @brief 计算 dest = op * op
|
||||
* @brief Computes dest = op * op.
|
||||
*
|
||||
* @param dest [OUT]指向TEE_BigInt的指针,用于存储结果op * op
|
||||
* @param op [IN]指向要平方的操作数的指针
|
||||
* @param dest Indicates the pointer to the <b>TEE_BigInt</b> that holds the result op * op.
|
||||
* @param op Indicates the pointer to the operand to be squared.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntSquare(TEE_BigInt *dest, const TEE_BigInt *op);
|
||||
|
||||
/**
|
||||
* @brief 计算dest_r和dest_q,使得op1 = dest_q * op2 + dest_r
|
||||
* @brief Computes <b>dest_r</b> and <b>dest_q</b> to make op1 = dest_q* op2 + dest_r.
|
||||
*
|
||||
* @param dest_q [OUT]指向TEE_BigInt的指针,用于存储商
|
||||
* @param dest_r [IN]指向TEE_BigInt的指针,用于存储余数
|
||||
* @param op1 [OUT]指向第一个操作数的指针,被除数
|
||||
* @param op2 [IN]指向第二个操作数的指针,除数
|
||||
* @param dest_q Indicates the pointer to the <b>TEE_BigInt</b> that holds the quotient.
|
||||
* @param dest_r Indicates the pointer to the <b>TEE_BigInt</b> that holds the remainder.
|
||||
* @param op1 Indicates the pointer to the first operand, which is the dividend.
|
||||
* @param op2 Indicates the pointer to the second operand, which is the divisor.
|
||||
*
|
||||
* @return TEE_SUCCESS 操作成功
|
||||
* @return TEE_ERROR_BAD_PARAMETERS 其中存在至少一个参数为NULL
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_BAD_PARAMETERS</b> if at least one parameter is null.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntDiv(TEE_BigInt *dest_q, TEE_BigInt *dest_r, const TEE_BigInt *op1, const TEE_BigInt *op2);
|
||||
|
||||
/**
|
||||
* @brief 计算dest = op (mod n),使得0 <= dest < n
|
||||
* @brief Computes dest = op (mod n) to make 0 <= dest < n.
|
||||
*
|
||||
* @param dest [OUT]指向TEE_BigInt的指针,以保存结果op (mod n)
|
||||
* @param op [IN]指向要缩减mod n的操作数的指针
|
||||
* @param n [IN]指向模数的指针。模数应大于1
|
||||
* @param dest Indicates the pointer to the <b>TEE_BigInt</b> that holds the result op (mod n).
|
||||
* @param op Indicates the pointer to the operand to be reduced mod n.
|
||||
* @param n [IN] Indicates the pointer to the modulus, which must be greater than 1.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntMod(TEE_BigInt *dest, const TEE_BigInt *op, const TEE_BigInt *n);
|
||||
|
||||
/**
|
||||
* @brief 计算dest= (op1 + op2) (mod n)
|
||||
* @brief Computes dest = (op1 + op2) (mod n).
|
||||
*
|
||||
* @param dest [OUT]指向TEE_BigInt的指针,以保存结果(op1 + op2)(mod n)
|
||||
* @param op1 [IN]指向第一个操作数的指针
|
||||
* @param op2 [IN]指向第二个操作数的指针
|
||||
* @param n [IN]指向模数的指针,模数应大于1
|
||||
* @param dest Indicates the pointer to the <b>TEE_BigInt</b> that holds the result op (op1 + op2)(mod n).
|
||||
* @param op1 Indicates the pointer to the first operand.
|
||||
* @param op2 Indicates the pointer to the second operand.
|
||||
* @param n Indicates the pointer to the modulus, which must be greater than 1.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntAddMod(TEE_BigInt *dest, const TEE_BigInt *op1, const TEE_BigInt *op2, const TEE_BigInt *n);
|
||||
|
||||
/**
|
||||
* @brief 计算dest = (op1 - op2) (mod n)
|
||||
* @brief Computes dest = (op1 – op2) (mod n).
|
||||
*
|
||||
* @param dest [OUT]指向TEE_BigInt的指针,以保存结果(op1 - op2)(mod n)
|
||||
* @param op1 [IN]指向第一个操作数的指针
|
||||
* @param op2 [IN]指向第二个操作数的指针
|
||||
* @param n [IN]指向模数的指针,模数应大于1
|
||||
* @param dest Indicates the pointer to the <b>TEE_BigInt</b> that holds the result op (op1 – op2)(mod n).
|
||||
* @param op1 Indicates the pointer to the first operand.
|
||||
* @param op2 Indicates the pointer to the second operand.
|
||||
* @param n Indicates the pointer to the modulus, which must be greater than 1.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntSubMod(TEE_BigInt *dest, const TEE_BigInt *op1, const TEE_BigInt *op2, const TEE_BigInt *n);
|
||||
|
||||
/**
|
||||
* @brief 计算dest = (op1 * op2) (mod n)
|
||||
* @brief Computes dest = (op1* op2)(mod n).
|
||||
*
|
||||
* @param dest [OUT]指向TEE_BigInt的指针,以保存结果(op1 * op2)(mod n)
|
||||
* @param op1 [IN]指向第一个操作数的指针
|
||||
* @param op2 [IN]指向第二个操作数的指针
|
||||
* @param n [IN]指向模数的指针,模数应大于1
|
||||
* @param dest Indicates the pointer to the <b>TEE_BigInt</b> that holds the result op (op1 * op2)(mod n).
|
||||
* @param op1 Indicates the pointer to the first operand.
|
||||
* @param op2 Indicates the pointer to the second operand.
|
||||
* @param n Indicates the pointer to the modulus, which must be greater than 1.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntMulMod(TEE_BigInt *dest, const TEE_BigInt *op1, const TEE_BigInt *op2, const TEE_BigInt *n);
|
||||
|
||||
/**
|
||||
* @brief 计算dest = (op * op) (mod n)
|
||||
* @brief Computes dest = (op * op) (mod n).
|
||||
*
|
||||
* @param dest [OUT]指向TEE_BigInt的指针,以保存结果(op * op)(mod n)
|
||||
* @param op [IN]操作数指针
|
||||
* @param n [IN]指向模数的指针。模数应大于1
|
||||
* @param dest Indicates the pointer to the <b>TEE_BigInt</b> that holds the result op (op * op)(mod n).
|
||||
* @param op Indicates the pointer to the operand.
|
||||
* @param n [IN] Indicates the pointer to the modulus, which must be greater than 1.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntSquareMod(TEE_BigInt *dest, const TEE_BigInt *op, const TEE_BigInt *n);
|
||||
|
||||
/**
|
||||
* @brief 计算dest,使dest * op = 1 (mod n)
|
||||
* @brief Computes <b>dest</b> to make dest* op = 1 (mod n).
|
||||
*
|
||||
* @param dest [OUT]指向TEE_BigInt的指针,以保存结果(op^-1)(mod n)
|
||||
* @param op [IN]操作数指针
|
||||
* @param n [IN]指向模数的指针。模数应大于1
|
||||
* @param dest Indicates the pointer to the <b>TEE_BigInt</b> that holds the result (op^–1)(mod n).
|
||||
* @param op Indicates the pointer to the operand.
|
||||
* @param n [IN] Indicates the pointer to the modulus, which must be greater than 1.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntInvMod(TEE_BigInt *dest, const TEE_BigInt *op, const TEE_BigInt *n);
|
||||
|
||||
/**
|
||||
* @brief 确定是否gcd(op1, op2) == 1
|
||||
* @brief Checks whether gcd(op1, op2) == 1.
|
||||
*
|
||||
* @param op1 [IN]指向第一个操作数的指针
|
||||
* @param op2 [IN]指向第二个操作数的指针
|
||||
* @param op1 Indicates the pointer to the first operand.
|
||||
* @param op2 Indicates the pointer to the second operand.
|
||||
*
|
||||
* @return true gcd(op1, op2) == 1
|
||||
* @return false gcd(op1, op2) != 1
|
||||
* @return Returns <b>true</b> if gcd(op1, op2) == 1.
|
||||
* @return Returns <b>false</b> if gcd(op1, op2) != 1.
|
||||
*
|
||||
*/
|
||||
bool TEE_BigIntRelativePrime(const TEE_BigInt *op1, const TEE_BigInt *op2);
|
||||
|
||||
/**
|
||||
* @brief 计算输入参数op1和op2的最大公约数
|
||||
* @brief Computes the greatest common divisor of <b>op1</b> and <b>op2</b>.
|
||||
*
|
||||
* @param gcd [OUT]指向TEE_BigInt的指针,用于保存op1和op2的最大公约数
|
||||
* @param u [OUT]指向TEE_BigInt的指针,用于保存第一个系数
|
||||
* @param v [OUT]指向TEE_BigInt的指针,用于保存第二个系数
|
||||
* @param op1 [IN]指向第一个操作数的指针
|
||||
* @param op2 [IN]指向第二个操作数的指针
|
||||
* @param gcd Indicates the pointer to the <b>TEE_BigInt</b> that holds the greatest common divisor of <b>op1</b>
|
||||
* and <b>op2</b>.
|
||||
* @param u Indicates the pointer to the <b>TEE_BigInt</b> that holds the first coefficient.
|
||||
* @param v Indicates the pointer to the <b>TEE_BigInt</b> that holds the second coefficient.
|
||||
* @param op1 Indicates the pointer to the first operand.
|
||||
* @param op2 Indicates the pointer to the second operand.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntComputeExtendedGcd(TEE_BigInt *gcd, TEE_BigInt *u, TEE_BigInt *v, const TEE_BigInt *op1,
|
||||
const TEE_BigInt *op2);
|
||||
/**
|
||||
* @brief 对op执行概率原始性检验
|
||||
* @brief Performs a probabilistic primality test on <b>op</b>.
|
||||
*
|
||||
* @param op [IN]经过原始测试的候选号码
|
||||
* @param confidenceLevel [IN]非结论性测试的期望置信水平
|
||||
* @param op Indicates the pointer to the candidate number that is tested for primality.
|
||||
* @param confidenceLevel Indicates the expected confidence level for a non-conclusive test.
|
||||
*
|
||||
* @return 0 op是复合数
|
||||
* @return 1 op是素数
|
||||
* @return -1 测试是非结论性的,但op是复合的概率小于2^(-confidenceLevel)
|
||||
* @return Returns <b>0</b> if <b>op</b> is a composite number.
|
||||
* @return Returns <b>1</b> if <b>op</b> is a prime number.
|
||||
* @return Returns <b>–1</b> if the test is non-conclusive but the probability that <b>op</b> is composite is
|
||||
* less than 2^(-confidenceLevel).
|
||||
*
|
||||
*/
|
||||
int32_t TEE_BigIntIsProbablePrime(const TEE_BigInt *op, uint32_t confidenceLevel);
|
||||
|
||||
/**
|
||||
* @brief 将src转换为适合进行快速模乘的表示
|
||||
* @brief Converts <b>src</b> into a representation suitable for doing fast modular multiplication.
|
||||
*
|
||||
* @param dest [OUT]TEE_BigIntFMM初始化内存区域指针
|
||||
* @param src [IN]指向要转换的TEE_BigInt的指针
|
||||
* @param n [IN]模数指针
|
||||
* @param context [IN]指向先前使用TEE_BigIntInitFMMContext1初始化的上下文的指针
|
||||
* @param dest Indicates the pointer to an initialized <b>TEE_BigIntFMM</b> memory area.
|
||||
* @param src Indicates the pointer to the <b>TEE_BigInt</b> to convert.
|
||||
* @param n Indicates the pointer to the modulus.
|
||||
* @param context Indicates the pointer to the context that is previously initialized using
|
||||
* {@link TEE_BigIntInitFMMContext1}.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntConvertToFMM(TEE_BigIntFMM *dest, const TEE_BigInt *src, const TEE_BigInt *n,
|
||||
const TEE_BigIntFMMContext *context);
|
||||
|
||||
/**
|
||||
* @brief 将快速模乘表示中的src转换回TEE_BigInt表示
|
||||
* @brief Converts <b>src</b> in the fast modular multiplication representation back to a
|
||||
* <b>TEE_BigInt</b> representation.
|
||||
*
|
||||
* @param dest [OUT]指向用于保存转换结果的初始化TEE_BigIntFMM内存区域的指针
|
||||
* @param src [IN]指向保存快速模乘表示中值的TEE_BigIntFMM的指针
|
||||
* @param n [IN]模数指针
|
||||
* @param context [IN]指向先前使用TEE_BigIntInitFMMContext1初始化的上下文的指针
|
||||
* @param dest Indicates the pointer to an initialized <b>TEE_BigIntFMM</b> memory area to store the converted result.
|
||||
* @param src Indicates the pointer to a <b>TEE_BigIntFMM</b> holding the value in the fast modular multiplication
|
||||
* representation.
|
||||
* @param n Indicates the pointer to the modulus.
|
||||
* @param context Indicates the pointer to the context that is previously initialized using
|
||||
* {@link TEE_BigIntInitFMMContext1}.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntConvertFromFMM(TEE_BigInt *dest, const TEE_BigIntFMM *src, const TEE_BigInt *n,
|
||||
const TEE_BigIntFMMContext *context);
|
||||
|
||||
/**
|
||||
* @brief 计算快速模乘法表示中的dest = op1 * op2
|
||||
* @brief Computes dest = op1* op2 in the fast modular multiplication representation.
|
||||
*
|
||||
* @param dest [OUT]指向TEE_BigIntFMM的指针,用于保存结果op1 * op2
|
||||
* @param op1 [IN]指向第一个操作数的指针
|
||||
* @param op2 [IN]指向第二个操作数的指针
|
||||
* @param n [IN]模数指针
|
||||
* @param context[IN]指向先前使用TEE_BigIntInitFMMContext1初始化的上下文的指针
|
||||
* @param dest Indicates the pointer to the <b>TEE_BigIntFMM</b> that holds the result op1* op2.
|
||||
* @param op1 Indicates the pointer to the first operand.
|
||||
* @param op2 Indicates the pointer to the second operand.
|
||||
* @param n Indicates the pointer to the modulus.
|
||||
* @param context Indicates the pointer to the context that is previously initialized using
|
||||
* {@link TEE_BigIntInitFMMContext1}.
|
||||
*
|
||||
*/
|
||||
void TEE_BigIntComputeFMM(TEE_BigIntFMM *dest, const TEE_BigIntFMM *op1, const TEE_BigIntFMM *op2, const TEE_BigInt *n,
|
||||
const TEE_BigIntFMMContext *context);
|
||||
|
||||
/**
|
||||
* @brief 计算dest = (op1 ^ op2) (mod n)
|
||||
* @brief Computes dest = (op1 ^ op2)(mod n).
|
||||
*
|
||||
* @param des [OUT]指向TEE_BigInt的指针,以保存结果(op1 ^ op2)(mod n)
|
||||
* @param op1 [IN]指向第一个操作数的指针
|
||||
* @param op2 [IN]指向第二个操作数的指针
|
||||
* @param n [IN]模数指针
|
||||
* @param context [IN]指向以前使用TEE_BigIntInitFMMContext1或NULL初始化的上下文的指针
|
||||
* @param des Indicates the pointer to the <b>TEE_BigInt</b> that holds the result (op1 ^ op2)(mod n).
|
||||
* @param op1 Indicates the pointer to the first operand.
|
||||
* @param op2 Indicates the pointer to the second operand.
|
||||
* @param n Indicates the pointer to the modulus.
|
||||
* @param context Indicates the pointer to the context that is previously initialized using
|
||||
* {@link TEE_BigIntInitFMMContext1} or initialized to null.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_NOT_SUPPORTED 不支持n的值
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_NOT_SUPPORTED</b> if the value of <b>n</b> is not supported.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_BigIntExpMod(TEE_BigInt *des, TEE_BigInt *op1, const TEE_BigInt *op2, const TEE_BigInt *n,
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
/**
|
||||
* @file tee_core_api.h
|
||||
*
|
||||
* @brief TA会话操作接口
|
||||
* @brief Provides APIs for managing trusted application (TA) sessions.
|
||||
*
|
||||
* @since 1
|
||||
*/
|
||||
@@ -26,51 +26,54 @@ typedef uint32_t TEE_TASessionHandle;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief 在受信任的应用程序实例中引发死机\
|
||||
* @brief Raises a panic in the TA instance.
|
||||
*
|
||||
* @param panicCode [IN]TA定义的信息性恐慌代码
|
||||
* @param panicCode Indicates an informative panic code defined by the TA.
|
||||
*
|
||||
*/
|
||||
void TEE_Panic(TEE_Result panicCode);
|
||||
|
||||
/**
|
||||
* @brief 使用受信任应用程序打开新会话
|
||||
* @brief Opens a new session with a TA.
|
||||
*
|
||||
* @param destination [IN]指向包含目标受信任应用程序的UUID的TEE_UUID结构的指针
|
||||
* @param cancellationRequestTimeout [IN]以毫秒为单位的超时或特殊值
|
||||
* @param paramTypes [IN]操作中传递的所有参数的类型
|
||||
* @param params [IN]操作中传递的参数
|
||||
* @param session [OUT]指向将接收客户端会话句柄的变量的指针
|
||||
* @param returnOrigin [OUT]指向将包含返回原点的变量的指针
|
||||
* @param destination Indicates the pointer to the <b>TEE_UUID</b> structure that contains
|
||||
* the Universal Unique Identifier (UUID) of the target TA.
|
||||
* @param cancellationRequestTimeout Indicates the timeout period in milliseconds or a special value
|
||||
* if there is no timeout.
|
||||
* @param paramTypes Indicates the types of all parameters passed in the operation.
|
||||
* @param params Indicates the parameters passed in the operation.
|
||||
* @param session Indicates the pointer to the variable that will receive the client session handle.
|
||||
* @param returnOrigin Indicates the pointer to the variable that holds the return origin.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功打开会话
|
||||
* @return TEE_ERROR_ITEM_NOT_FOUND 在TEE中找不到目标TA
|
||||
* @return TEE_ERROR_ACCESS_DENIED 对目标受信任应用程序的访问被拒绝
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the session is opened.
|
||||
* @return Returns <b>TEE_ERROR_ITEM_NOT_FOUND</b> if the TA cannot be found in the Trusted Execution Environment (TEE).
|
||||
* @return Returns <b>TEE_ERROR_ACCESS_DENIED</b> if the access request to the TA is denied.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_OpenTASession(const TEE_UUID *destination, uint32_t cancellationRequestTimeout, uint32_t paramTypes,
|
||||
TEE_Param params[TEE_PARAMS_NUM], TEE_TASessionHandle *session, uint32_t *returnOrigin);
|
||||
|
||||
/**
|
||||
* @brief 关闭由TEE_OpenTASession打开的客户端会话
|
||||
* @brief Closes a client session.
|
||||
*
|
||||
* @param session [IN]TEE_OpenTASession打开的会话句柄
|
||||
* @param session Indicates the handle of the session to close.
|
||||
*
|
||||
*/
|
||||
void TEE_CloseTASession(TEE_TASessionHandle session);
|
||||
|
||||
/**
|
||||
* @brief 在客户端受信任应用程序实例和目标受信任应用程序实例之间打开的会话中调用命令
|
||||
* @brief Invokes a command in a session opened between this client TA instance and a target TA instance.
|
||||
*
|
||||
* @param session [IN]打开的会话句柄
|
||||
* @param cancellationRequestTimeout [IN]以毫秒为单位的超时或特殊值
|
||||
* @param commandID [IN]要调用的命令的标识符
|
||||
* @param paramTypes [IN]操作中传递的所有参数的类型
|
||||
* @param params [IN]操作中传递的参数
|
||||
* @param returnOrigin [IN]指向将包含返回原点的变量的指针
|
||||
* @param session Indicates the handle of the opened session.
|
||||
* @param cancellationRequestTimeout Indicates the timeout period in milliseconds or a special value
|
||||
* if there is no timeout.
|
||||
* @param commandID Indicates the identifier of the command to invoke.
|
||||
* @param paramTypes Indicates the types of all parameters passed in the operation.
|
||||
* @param params Indicates the parameters passed in the operation.
|
||||
* @param returnOrigin Indicates the pointer to the variable that holds the return origin.
|
||||
*
|
||||
* @return TEE_SUCCESS 调用操作成功
|
||||
* @return TEE_ERROR_ACCESS_DENIED 向目标TA调用命令被拒绝
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_ACCESS_DENIED</b> if the command fails to be invoked.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_InvokeTACommand(TEE_TASessionHandle session, uint32_t cancellationRequestTimeout, uint32_t commandID,
|
||||
|
||||
+281
-278
@@ -13,9 +13,9 @@
|
||||
/**
|
||||
* @file tee_crypto_api.h
|
||||
*
|
||||
* @brief 加解密接口
|
||||
* @brief Provides APIs for cryptographic operations.
|
||||
*
|
||||
* 开发者可以使用这些接口实现加解密的相关功能。
|
||||
* You can use these APIs to implement encryption and decryption.
|
||||
*
|
||||
* @since 1
|
||||
*/
|
||||
@@ -29,30 +29,30 @@
|
||||
|
||||
#ifndef NULL
|
||||
/**
|
||||
* NULL定义
|
||||
* Definition of <b>NULL</b>.
|
||||
*/
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
/**
|
||||
* @brief 密钥最大长度(以bits为单位)
|
||||
* @brief Defines the maximum key length, in bits.
|
||||
*/
|
||||
#define TEE_MAX_KEY_SIZE_IN_BITS (1024 * 8)
|
||||
/**
|
||||
* @brief SW_RSA密钥长度
|
||||
* @brief Defines the length of the SW_RSA key, in bytes.
|
||||
*/
|
||||
#define SW_RSA_KEYLEN 1024
|
||||
/**
|
||||
* @brief DH其它信息的最大长度
|
||||
* @brief Defines the maximum length of other Diffie-Hellman (DH) information, in bytes.
|
||||
*/
|
||||
#define TEE_DH_MAX_SIZE_OF_OTHER_INFO 64 /* bytes */
|
||||
|
||||
/**
|
||||
* @brief 加解密Operation操作句柄
|
||||
* @brief Enumerates the cryptographic operation handles.
|
||||
*/
|
||||
enum __TEE_Operation_Constants {
|
||||
/** Cipher */
|
||||
TEE_OPERATION_CIPHER = 0x1,
|
||||
/** Mac */
|
||||
/** MAC */
|
||||
TEE_OPERATION_MAC = 3,
|
||||
/** AE */
|
||||
TEE_OPERATION_AE = 4,
|
||||
@@ -62,15 +62,15 @@ enum __TEE_Operation_Constants {
|
||||
TEE_OPERATION_ASYMMETRIC_CIPHER = 6,
|
||||
/** Asymmetric Signature */
|
||||
TEE_OPERATION_ASYMMETRIC_SIGNATURE = 7,
|
||||
/** Key Derication */
|
||||
/** Key Derivation */
|
||||
TEE_OPERATION_KEY_DERIVATION = 8,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 加解密算法标识
|
||||
* @brief Enumerates the cryptographic algorithms.
|
||||
*/
|
||||
enum __tee_crypto_algorithm_id {
|
||||
/** 无效算法 */
|
||||
/** Invalid algorithm */
|
||||
TEE_ALG_INVALID = 0x0,
|
||||
/** AES_ECB_NOPAD */
|
||||
TEE_ALG_AES_ECB_NOPAD = 0x10000010,
|
||||
@@ -259,12 +259,12 @@ enum __tee_crypto_algorithm_id {
|
||||
*/
|
||||
typedef enum __tee_crypto_algorithm_id tee_crypto_algorithm_id;
|
||||
/**
|
||||
* @brief 无可选元素
|
||||
* @brief No element is available.
|
||||
*/
|
||||
#define TEE_OPTIONAL_ELEMENT_NONE 0x00000000
|
||||
|
||||
/**
|
||||
* @brief 支持的ECC曲线
|
||||
* @brief Enumerates the Elliptic-Curve Cryptography (ECC) curves supported.
|
||||
*/
|
||||
typedef enum {
|
||||
/** CURVE_NIST_P192 */
|
||||
@@ -284,7 +284,7 @@ typedef enum {
|
||||
} TEE_ECC_CURVE;
|
||||
|
||||
/**
|
||||
* @brief MGF1掩码函数类型
|
||||
* @brief Enumerates the Mask Generation Function (MGF1) modes.
|
||||
*/
|
||||
typedef enum {
|
||||
TEE_DH_HASH_SHA1_mode = 0,
|
||||
@@ -296,32 +296,32 @@ typedef enum {
|
||||
} TEE_DH_HASH_Mode;
|
||||
|
||||
/**
|
||||
* @brief 加解密算法模式
|
||||
* @brief Enumerates the cryptographic operation modes.
|
||||
*/
|
||||
enum __TEE_OperationMode {
|
||||
/** 加密 */
|
||||
/** Encryption */
|
||||
TEE_MODE_ENCRYPT = 0x0,
|
||||
/** 解密 */
|
||||
/** Decryption */
|
||||
TEE_MODE_DECRYPT,
|
||||
/** 签名 */
|
||||
/** Signing */
|
||||
TEE_MODE_SIGN,
|
||||
/** 验签 */
|
||||
/** Signature verification */
|
||||
TEE_MODE_VERIFY,
|
||||
/** mac */
|
||||
/** MAC */
|
||||
TEE_MODE_MAC,
|
||||
/** 摘要 */
|
||||
/** Digest */
|
||||
TEE_MODE_DIGEST,
|
||||
/** 衍生 */
|
||||
/** Key derivation */
|
||||
TEE_MODE_DERIVE
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 加解密operation状态
|
||||
* @brief Enumerates the cryptographic operation states.
|
||||
*/
|
||||
enum tee_operation_state {
|
||||
/** 初始状态 */
|
||||
/** Initial */
|
||||
TEE_OPERATION_STATE_INITIAL = 0x00000000,
|
||||
/** 激活状态 */
|
||||
/** Active */
|
||||
TEE_OPERATION_STATE_ACTIVE = 0x00000001,
|
||||
};
|
||||
|
||||
@@ -331,95 +331,95 @@ enum tee_operation_state {
|
||||
typedef uint32_t TEE_OperationMode;
|
||||
|
||||
/**
|
||||
* @brief Operation信息
|
||||
* @brief Defines the operation information.
|
||||
*/
|
||||
struct __TEE_OperationInfo {
|
||||
/** 算法ID */
|
||||
/** Algorithm ID */
|
||||
uint32_t algorithm; /* #__TEE_CRYPTO_ALGORITHM_ID */
|
||||
/** operation类型 */
|
||||
/** Operation type */
|
||||
uint32_t operationClass; /* #__TEE_Operation_Constants */
|
||||
/** Operation模式 */
|
||||
/** Operation mode */
|
||||
uint32_t mode; /* #__TEE_OperationMode */
|
||||
/** 摘要长度 */
|
||||
/** Digest length */
|
||||
uint32_t digestLength;
|
||||
/** 最大密钥长度 */
|
||||
/** Maximum key length */
|
||||
uint32_t maxKeySize;
|
||||
/** 密钥长度 */
|
||||
/** Key length*/
|
||||
uint32_t keySize;
|
||||
/** 所需密钥用法 */
|
||||
/** Required key usage */
|
||||
uint32_t requiredKeyUsage;
|
||||
/** 句柄状态 */
|
||||
/** Handle state */
|
||||
uint32_t handleState;
|
||||
/** 密钥 */
|
||||
/** Key */
|
||||
void *keyValue;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 用于定义__TEE_OperationInfo结构体类型
|
||||
* @brief Defines the <b>__TEE_OperationInfo</b> struct.
|
||||
*
|
||||
* @see __TEE_OperationInfo
|
||||
*/
|
||||
typedef struct __TEE_OperationInfo TEE_OperationInfo;
|
||||
|
||||
/**
|
||||
* @brief Operation中存放的密钥信息
|
||||
* @brief Defines the key information stored in the <b>OperationInfo</b>.
|
||||
*/
|
||||
typedef struct {
|
||||
/** 密钥长度 */
|
||||
/** Key length */
|
||||
uint32_t keySize;
|
||||
/** 所需密钥用法 */
|
||||
/** Required key usage */
|
||||
uint32_t requiredKeyUsage;
|
||||
} TEE_OperationInfoKey;
|
||||
|
||||
/**
|
||||
* @brief 包含了Operation中的密钥信息
|
||||
* @brief Defines information about an operation.
|
||||
*/
|
||||
typedef struct {
|
||||
/** 算法ID */
|
||||
/** Algorithm ID */
|
||||
uint32_t algorithm;
|
||||
/** operation类型 */
|
||||
/** Operation type */
|
||||
uint32_t operationClass;
|
||||
/** Operation模式 */
|
||||
/** Operation mode */
|
||||
uint32_t mode;
|
||||
/** 摘要长度 */
|
||||
/** Digest length */
|
||||
uint32_t digestLength;
|
||||
/** 最大密钥长度 */
|
||||
/** Maximum key length */
|
||||
uint32_t maxKeySize;
|
||||
/** 句柄状态 */
|
||||
/** Handle state */
|
||||
uint32_t handleState;
|
||||
/** operation状态 */
|
||||
/** Operation state */
|
||||
uint32_t operationState;
|
||||
/** 密钥数量 */
|
||||
/** Number of keys */
|
||||
uint32_t numberOfKeys;
|
||||
/** 密钥信息 */
|
||||
/** Key information */
|
||||
TEE_OperationInfoKey keyInformation[];
|
||||
} TEE_OperationInfoMultiple;
|
||||
|
||||
/**
|
||||
* @brief 加解密操作需要的句柄
|
||||
* @brief Defines the cryptographic operation handle.
|
||||
*/
|
||||
struct __TEE_OperationHandle {
|
||||
/** 算法ID */
|
||||
/** Algorithm ID */
|
||||
uint32_t algorithm; /* #__TEE_CRYPTO_ALGORITHM_ID */
|
||||
/** operation类型 */
|
||||
/** Operation type */
|
||||
uint32_t operationClass; /* #__TEE_Operation_Constants */
|
||||
/** Operation模式 */
|
||||
/** Operation mode */
|
||||
uint32_t mode; /* #__TEE_OperationMode */
|
||||
/** 摘要长度 */
|
||||
/** Digest length */
|
||||
uint32_t digestLength;
|
||||
/** 最大密钥长度 */
|
||||
/** Maximum key length */
|
||||
uint32_t maxKeySize;
|
||||
/** 密钥长度 */
|
||||
/** Key length */
|
||||
uint32_t keySize;
|
||||
/** 密钥长度 */
|
||||
/** Key length */
|
||||
uint32_t keySize2;
|
||||
/** 所需密钥用法 */
|
||||
/** Required key usage */
|
||||
uint32_t requiredKeyUsage;
|
||||
/** 句柄状态 */
|
||||
/** Handle state */
|
||||
uint32_t handleState;
|
||||
/** 密钥 */
|
||||
/** Key */
|
||||
void *keyValue;
|
||||
/** 密钥 */
|
||||
/** Key */
|
||||
void *keyValue2;
|
||||
/** */
|
||||
void *crypto_ctxt;
|
||||
@@ -427,229 +427,230 @@ struct __TEE_OperationHandle {
|
||||
void *hmac_rest_ctext;
|
||||
/** iv */
|
||||
void *IV;
|
||||
/** 公钥 */
|
||||
/** Public key */
|
||||
void *publicKey;
|
||||
/** 公钥长度 */
|
||||
/** Length of the public key */
|
||||
uint32_t publicKeyLen;
|
||||
/** 私钥 */
|
||||
/** Private key */
|
||||
void *privateKey;
|
||||
/** 私钥长度 */
|
||||
/** Length of the private key */
|
||||
uint32_t privateKeyLen;
|
||||
/** iv长度 */
|
||||
/** Length of the IV */
|
||||
uint32_t IVLen;
|
||||
/** operation锁 */
|
||||
/** Operation lock */
|
||||
pthread_mutex_t operation_lock;
|
||||
/** hal信息 */
|
||||
/** HAL information */
|
||||
void *hal_info;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 整数类型转换
|
||||
* @brief Defines the data used for conversion of integers.
|
||||
*/
|
||||
typedef struct {
|
||||
/** 源 */
|
||||
/** Source */
|
||||
uint32_t src;
|
||||
/** 目标 */
|
||||
/** Destination */
|
||||
uint32_t dest;
|
||||
} crypto_uint2uint;
|
||||
|
||||
/**
|
||||
* @brief RSA公钥最大长度
|
||||
* @brief Defines the maximum length of an RSA public key.
|
||||
*/
|
||||
#define RSA_PUBKEY_MAXSIZE sizeof(CRYS_RSAUserPubKey_t)
|
||||
/**
|
||||
* @brief RES私钥最大长度
|
||||
* @brief Defines the maximum length of an RES private key.
|
||||
*/
|
||||
#define RSA_PRIVKEY_MAXSIZE sizeof(CRYS_RSAUserPrivKey_t)
|
||||
|
||||
/**
|
||||
* @brief 存放输入输出数据
|
||||
* @brief Defines a structure to hold the input and output data.
|
||||
*/
|
||||
typedef struct {
|
||||
/** 源数据 */
|
||||
/** Source data */
|
||||
void *src_data;
|
||||
/** 源数据长度 */
|
||||
/** Length of the source data */
|
||||
size_t src_len;
|
||||
/** 目标数据 */
|
||||
/** Destination data */
|
||||
void *dest_data;
|
||||
/** 目标数据长度 */
|
||||
/** Length of the destination data */
|
||||
size_t *dest_len;
|
||||
} operation_src_dest;
|
||||
|
||||
/**
|
||||
* @brief 存放ae算法初始化相关数据
|
||||
* @brief Defines the AE initialization data.
|
||||
*/
|
||||
typedef struct {
|
||||
/** nonce */
|
||||
void *nonce;
|
||||
/** nonce长度 */
|
||||
/** Leng of nonce */
|
||||
size_t nonce_len;
|
||||
/** tag长度 */
|
||||
/** Length of the tag */
|
||||
uint32_t tag_len;
|
||||
/** aad长度 */
|
||||
/** Length of the additional authenticated data (AAD) */
|
||||
size_t aad_len;
|
||||
/** payload长度 */
|
||||
/** Length of the payload */
|
||||
size_t payload_len;
|
||||
} operation_ae_init;
|
||||
|
||||
/**
|
||||
* @brief 用于定义__TEE_OperationHandle指针类型
|
||||
* @brief Defines the pointer to <b>__TEE_OperationHandle</b>.
|
||||
*
|
||||
* @see __TEE_OperationHandle
|
||||
*/
|
||||
typedef struct __TEE_OperationHandle *TEE_OperationHandle;
|
||||
|
||||
/**
|
||||
* @brief 用于定义__TEE_OperationHandle结构体类型
|
||||
* @brief Defines the <b>__TEE_OperationHandle</b> struct.
|
||||
*
|
||||
* @see __TEE_OperationHandle
|
||||
*/
|
||||
typedef struct __TEE_OperationHandle TEE_OperationHandleVar;
|
||||
|
||||
/**
|
||||
* @brief 用于定义__TEE_ObjectHandle结构体类型
|
||||
* @brief Defines the <b>__TEE_ObjectHandle</b> struct.
|
||||
*/
|
||||
typedef struct __TEE_ObjectHandle TEE_ObjectHandleVar;
|
||||
|
||||
/**
|
||||
* @brief 申请操作句柄
|
||||
* @brief Allocates an operation handle.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param algorithm [IN]加密算法ID
|
||||
* @param mode [IN]操作模式
|
||||
* @param maxKeySize [IN]最大密钥大小
|
||||
* @param operation Indicates the pointer to the operation handle.
|
||||
* @param algorithm Indicates the cipher algorithm.
|
||||
* @param mode Indicates the operation mode.
|
||||
* @param maxKeySize Indicates the maximum length of the key.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_OUT_OF_MEMORY 操作句柄申请失败
|
||||
* @return TEE_ERROR_NOT_SUPPORTE 加密算法ID不支持
|
||||
* @return TEE_ERROR_GENERIC 其它错误
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation handle is allocated.
|
||||
* @return Returns <b>TEE_ERROR_OUT_OF_MEMORY</b> if there is no enough memory for this operation.
|
||||
* @return Returns <b>TEE_ERROR_NOT_SUPPORTED</b> if the specified algorithm is not supported.
|
||||
* @return Returns <b>TEE_ERROR_GENERIC</b> if the operation fails due to other errors.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_AllocateOperation(TEE_OperationHandle *operation, uint32_t algorithm, uint32_t mode,
|
||||
uint32_t maxKeySize);
|
||||
|
||||
/**
|
||||
* @brief 释放操作句柄
|
||||
* @brief Releases an operation handle.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param operation Indicates the operation handle to release.
|
||||
*
|
||||
*/
|
||||
void TEE_FreeOperation(TEE_OperationHandle operation);
|
||||
|
||||
/**
|
||||
* @brief 获取操作信息
|
||||
* @brief Obtains operation information.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param operationInfo [IN/OUT]操作信息
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param operationInfo Indicates the pointer to the operation information.
|
||||
*
|
||||
*/
|
||||
void TEE_GetOperationInfo(const TEE_OperationHandle operation, TEE_OperationInfo *operationInfo);
|
||||
|
||||
/**
|
||||
* @brief 复位操作句柄
|
||||
* @brief Resets an operation handle.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param operation Indicates the operation handle to reset.
|
||||
*
|
||||
*/
|
||||
void TEE_ResetOperation(TEE_OperationHandle operation);
|
||||
|
||||
/**
|
||||
* @brief 设置操作密钥
|
||||
* @brief Sets the key for an operation.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param key [IN/OUT]密钥
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param key Indicates the key.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_BAD_PARAMETERS 非法参数
|
||||
* @return TEE_ERROR_OUT_OF_MEMORY 密钥缓冲区申请失败
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_BAD_PARAMETERS</b> if the operation fails due to invalid parameters.
|
||||
* @return Returns <b>TEE_ERROR_OUT_OF_MEMORY</b> if there is no enough memory for this operation.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_SetOperationKey(TEE_OperationHandle operation, const TEE_ObjectHandle key);
|
||||
|
||||
/**
|
||||
* @brief 设置操作密钥2
|
||||
* @brief Sets two keys for an operation.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param key1 [IN/OUT]密钥1
|
||||
* @param key2 [IN/OUT]密钥2
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param key1 Indicates key 1.
|
||||
* @param key2 Indicates key 2.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_BAD_PARAMETERS 非法参数
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_BAD_PARAMETERS</b> if the operation fails due to invalid parameters.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_SetOperationKey2(TEE_OperationHandle operation, const TEE_ObjectHandle key1,
|
||||
const TEE_ObjectHandle key2);
|
||||
|
||||
/**
|
||||
* @brief 复制操作句柄
|
||||
* @brief Copies an operation handle.
|
||||
*
|
||||
* @param dstOperation [IN/OUT]目标操作句柄
|
||||
* @param srcOperation [IN/OUT]源操作句柄
|
||||
* @param dstOperation Indicates the destination operation handle.
|
||||
* @param srcOperation Indicates the source operation handle.
|
||||
*
|
||||
*/
|
||||
void TEE_CopyOperation(TEE_OperationHandle dstOperation, const TEE_OperationHandle srcOperation);
|
||||
|
||||
/**
|
||||
* @brief 初始化密码上下文
|
||||
* @brief Initializes the context to start a cipher operation.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param IV [IN]iv缓冲区,如果不使用设置为NULL
|
||||
* @param IVLen [IN]iv缓冲区的长度
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param IV Indicates the pointer to the buffer storing the operation IV. If this parameter is not used,
|
||||
* set it to <b>NULL</b>.
|
||||
* @param IVLen Indicates the length of the IV buffer.
|
||||
*
|
||||
*/
|
||||
void TEE_CipherInit(TEE_OperationHandle operation, const void *IV, size_t IVLen);
|
||||
|
||||
/**
|
||||
* @brief 执行密码更新
|
||||
* @brief Updates the data for a cipher operation.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param srcData [IN]源数据
|
||||
* @param srcLen [IN]源数据长度
|
||||
* @param destData [OUT]目标数据
|
||||
* @param destLen [OUT]目标数据长度
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param srcData Indicates the pointer to the source data.
|
||||
* @param srcLen Indicates the length of the source data.
|
||||
* @param destData Indicates the pointer to the destination data.
|
||||
* @param destLen Indicates the pointer to the destination data length.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_BAD_PARAMETERS 非法参数
|
||||
* @return TEE_ERROR_GENERIC 其它错误
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_BAD_PARAMETERS</b> if the operation fails due to invalid parameters.
|
||||
* @return Returns <b>TEE_ERROR_GENERIC</b> if the operation fails due to other errors.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_CipherUpdate(TEE_OperationHandle operation, const void *srcData, size_t srcLen, void *destData,
|
||||
size_t *destLen);
|
||||
|
||||
/**
|
||||
* @brief 执行密码完成
|
||||
* @brief Finalizes a cipher operation.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param srcData [IN]源数据
|
||||
* @param srcLen [IN]源数据长度
|
||||
* @param destData [OUT]目标数据
|
||||
* @param destLen [OUT]目标数据长度
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param srcData Indicates the pointer to the source data.
|
||||
* @param srcLen Indicates the length of the source data.
|
||||
* @param destData Indicates the pointer to the destination data.
|
||||
* @param destLen Indicates the pointer to the destination data length.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_BAD_PARAMETERS 非法参数
|
||||
* @return TEE_ERROR_GENERIC 其它错误
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_BAD_PARAMETERS</b> if the operation fails due to invalid parameters.
|
||||
* @return Returns <b>TEE_ERROR_GENERIC</b> if the operation fails due to other errors.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_CipherDoFinal(TEE_OperationHandle operation, const void *srcData, size_t srcLen, void *destData,
|
||||
size_t *destLen);
|
||||
|
||||
/**
|
||||
* @brief 摘要更新
|
||||
* @brief Updates the digest.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param chunk [IN]块缓冲区
|
||||
* @param chunkSize [IN]块缓冲区长度
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param chunk Indicates the pointer to the chunk of data to be hashed.
|
||||
* @param chunkSize Indicates the length of the chunk.
|
||||
*
|
||||
*/
|
||||
void TEE_DigestUpdate(TEE_OperationHandle operation, const void *chunk, size_t chunkSize);
|
||||
|
||||
/**
|
||||
* @brief 执行摘要结束
|
||||
* @brief Finalizes the message digest operation.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param chunk [IN]块缓冲区
|
||||
* @param chunkLen [IN]块缓冲区大小
|
||||
* @param hash [out]哈希缓冲区
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param chunk Indicates the pointer to the chunk of data to be hashed.
|
||||
* @param chunkLen Indicates the length of the chunk.
|
||||
* @param hash Indicates the pointer to the buffer storing the message hash.
|
||||
* @param hashLen
|
||||
*
|
||||
*/
|
||||
@@ -657,228 +658,229 @@ TEE_Result TEE_DigestDoFinal(TEE_OperationHandle operation, const void *chunk, s
|
||||
size_t *hashLen);
|
||||
|
||||
/**
|
||||
* @brief 执行mac初始化
|
||||
* @brief Initializes a MAC operation.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param IV [IN]iv缓冲区,如果不使用设置为NULL
|
||||
* @param IVLen [IN]iv缓冲区长度
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param IV Indicates the pointer to the buffer storing the operation IV. If this parameter is not used,
|
||||
* set it to <b>NULL</b>.
|
||||
* @param IVLen Indicates the length of the IV buffer.
|
||||
*
|
||||
*/
|
||||
void TEE_MACInit(TEE_OperationHandle operation, void *IV, size_t IVLen);
|
||||
|
||||
/**
|
||||
* @brief 执行mac更新
|
||||
* @brief Updates the MAC.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param chunk [IN]块缓冲区
|
||||
* @param chunkSize [IN]块缓冲区大小
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param chunk Indicates the pointer to the chunk of MAC data.
|
||||
* @param chunkSize Indicates the size of the chunk.
|
||||
*
|
||||
*/
|
||||
void TEE_MACUpdate(TEE_OperationHandle operation, const void *chunk, size_t chunkSize);
|
||||
|
||||
/**
|
||||
* @brief mac计算完成
|
||||
* @brief MAC Finalizes the MAC operation with a last chunk of message and computes the MAC.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param message [IN]message缓冲区
|
||||
* @param messageLen [IN]message缓冲区的大小
|
||||
* @param mac [OUT]mac缓冲区
|
||||
* @param macLen [OUT]mac缓冲区大小
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param message Indicates the pointer to the buffer containing the last message chunk to MAC.
|
||||
* @param messageLen Indicates the length of the message buffer.
|
||||
* @param mac Indicates the pointer to the buffer storing the computed MAC.
|
||||
* @param macLen Indicates the pointer to the MAC buffer length.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_GENERIC 其它错误
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_GENERIC</b> if the operation fails due to other errors.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_MACComputeFinal(TEE_OperationHandle operation, const void *message, size_t messageLen, void *mac,
|
||||
size_t *macLen);
|
||||
|
||||
/**
|
||||
* @brief mac比较完成
|
||||
* @brief Finalizes the MAC operation and compares the MAC with the one passed in.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param message [IN]message缓冲区
|
||||
* @param messageLen [IN]message缓冲区大小
|
||||
* @param mac [OUT]mac缓冲区
|
||||
* @param macLen [OUT]mac缓冲区大小
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param message Indicates the pointer to the buffer containing the last message chunk to MAC.
|
||||
* @param messageLen Indicates the length of the buffer.
|
||||
* @param mac Indicates the pointer to the buffer storing the computed MAC.
|
||||
* @param macLen Indicates the MAC buffer length.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_GENERIC 其它错误
|
||||
* @return TEE_ERROR_MAC_INVALID 比较失败
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_GENERIC</b> if the operation fails due to other errors.
|
||||
* @return Returns <b>TEE_ERROR_MAC_INVALID</b> if the computed MAC is not the same as that passed in.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_MACCompareFinal(TEE_OperationHandle operation, const void *message, size_t messageLen, const void *mac,
|
||||
const size_t macLen);
|
||||
|
||||
/**
|
||||
* @brief 派生密钥
|
||||
* @brief Derives a key.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param params [IN]属性
|
||||
* @param paramCount [IN]属性的数量
|
||||
* @param derivedKey [OUT]派生密钥
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param params Indicates the pointer to the parameters for this operation.
|
||||
* @param paramCount Indicates the number of parameters.
|
||||
* @param derivedKey Indicates the derived key.
|
||||
*
|
||||
*/
|
||||
void TEE_DeriveKey(TEE_OperationHandle operation, const TEE_Attribute *params, uint32_t paramCount,
|
||||
TEE_ObjectHandle derivedKey);
|
||||
|
||||
/**
|
||||
* @brief 生成随机数据
|
||||
* @brief Generates random data.
|
||||
*
|
||||
* @param randomBuffer [IN/OUT]随机缓冲区
|
||||
* @param randomBufferLen [IN]随机缓冲区大小
|
||||
* @param randomBuffer Indicates the pointer to the buffer storing the random data generated.
|
||||
* @param randomBufferLen Indicates the length of the buffer storing the random data.
|
||||
*
|
||||
*/
|
||||
void TEE_GenerateRandom(void *randomBuffer, size_t randomBufferLen);
|
||||
|
||||
/**
|
||||
* @brief ae初始化
|
||||
* @brief Initializes an AE operation.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param nonce [IN]nonce缓冲区
|
||||
* @param nonceLen [IN]nonce缓冲区大小
|
||||
* @param tagLen [IN]tag的大小
|
||||
* @param AADLen [IN]aad的大小
|
||||
* @param payloadLen [IN]payload的大小
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param nonce Indicates the pointer to the buffer for storing the nonce.
|
||||
* @param nonceLen Indicates the length of the nonce.
|
||||
* @param tagLen Indicates the length of the tag.
|
||||
* @param AADLen Indicates the length of the AAD.
|
||||
* @param payloadLen Indicates the length of the payload.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_GENERIC 其它错误
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_GENERIC</b> if the operation fails due to other errors.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_AEInit(TEE_OperationHandle operation, void *nonce, size_t nonceLen, uint32_t tagLen, size_t AADLen,
|
||||
size_t payloadLen);
|
||||
|
||||
/**
|
||||
* @brief 更新ae aad
|
||||
* @brief Updates the AAD in an AE operation.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param AADdata [IN]aad缓冲区
|
||||
* @param AADdataLen [IN]aad缓冲区大小
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param AADdata Indicates the pointer to the new AAD.
|
||||
* @param AADdataLen Indicates the length of the new AAD.
|
||||
*
|
||||
*/
|
||||
void TEE_AEUpdateAAD(TEE_OperationHandle operation, const void *AADdata, size_t AADdataLen);
|
||||
|
||||
/**
|
||||
* @brief 更新ae
|
||||
* @brief Updates data for an AE operation.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param srcData [IN]源数据
|
||||
* @param srcLen [IN]源数据大小
|
||||
* @param destData [OUT]目标数据
|
||||
* @param destLen [OUT]目标数据大小
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param srcData Indicates the pointer to the source data.
|
||||
* @param srcLen Indicates the length of the source data.
|
||||
* @param destData Indicates the pointer to the destination data.
|
||||
* @param destLen Indicates the pointer to the destination data length.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_GENERIC 其它错误
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_GENERIC</b> if the operation fails due to other errors.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_AEUpdate(TEE_OperationHandle operation, void *srcData, size_t srcLen, void *destData, size_t *destLen);
|
||||
|
||||
/**
|
||||
* @brief ae加密
|
||||
* @brief Finalizes the AE encryption operation.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param srcData [IN]源数据
|
||||
* @param srcLen [IN]源数据长度
|
||||
* @param destData [OUT]目标数据
|
||||
* @param destLen [OUT]目标数据长度
|
||||
* @param tag [OUT]tag缓冲区
|
||||
* @param tagLen [OUT]tag缓冲区大小
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param srcData Indicates the pointer to the source data.
|
||||
* @param srcLen Indicates the length of the source data.
|
||||
* @param destData Indicates the pointer to the destination data.
|
||||
* @param destLen Indicates the pointer to the destination data length.
|
||||
* @param tag Indicates the pointer to the buffer storing the computed tag.
|
||||
* @param tagLen Indicates the pointer to the tag buffer length.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_GENERIC 其它错误
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_GENERIC</b> if the operation fails due to other errors.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_AEEncryptFinal(TEE_OperationHandle operation, void *srcData, size_t srcLen, void *destData,
|
||||
size_t *destLen, void *tag, size_t *tagLen);
|
||||
|
||||
/**
|
||||
* @brief ae解密
|
||||
* @brief Finalizes an AE decryption operation.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param srcData [IN]源数据
|
||||
* @param srcLen [IN]源数据长度
|
||||
* @param destData [OUT]目标数据
|
||||
* @param destLen [OUT]目标数据长度
|
||||
* @param tag [OUT]tag缓冲区
|
||||
* @param tagLen[OUT]tag缓冲区大小
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param srcData Indicates the pointer to the source data.
|
||||
* @param srcLen Indicates the length of the source data.
|
||||
* @param destData Indicates the pointer to the destination data.
|
||||
* @param destLen Indicates the pointer to the destination data length.
|
||||
* @param tag Indicates the pointer to the buffer storing the computed tag.
|
||||
* @param tagLen Indicates the tag buffer length.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_MAC_INVALID tag是非法的
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_MAC_INVALID</b> if the computed tag does not match the provided tag.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_AEDecryptFinal(TEE_OperationHandle operation, void *srcData, size_t srcLen, void *destData,
|
||||
size_t *destLen, void *tag, size_t tagLen);
|
||||
|
||||
/**
|
||||
* @brief 非对称加密
|
||||
* @brief Performs asymmetric encryption.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param params [IN]属性
|
||||
* @param paramCount [IN]属性数量
|
||||
* @param srcData [IN]源数据
|
||||
* @param srcLen [IN]源数据长度
|
||||
* @param destData [OUT]目标数据
|
||||
* @param destLen [OUT]目标数据长度
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param params Indicates the pointer to the parameters for this operation.
|
||||
* @param paramCount Indicates the number of parameters.
|
||||
* @param srcData Indicates the pointer to the source data.
|
||||
* @param srcLen Indicates the length of the source data.
|
||||
* @param destData Indicates the pointer to the destination data.
|
||||
* @param destLen Indicates the pointer to the destination data length.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_BAD_PARAMETERS 非法参数
|
||||
* @return TEE_ERROR_GENERIC 其它错误
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_BAD_PARAMETERS</b> if the operation fails due to invalid parameters.
|
||||
* @return Returns <b>TEE_ERROR_GENERIC</b> if the operation fails due to other errors.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_AsymmetricEncrypt(TEE_OperationHandle operation, const TEE_Attribute *params, uint32_t paramCount,
|
||||
void *srcData, size_t srcLen, void *destData, size_t *destLen);
|
||||
|
||||
/**
|
||||
* @brief 非对称解密
|
||||
* @brief Performs asymmetric decryption.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param params [IN]属性
|
||||
* @param paramCount [IN]属性数量
|
||||
* @param srcData [IN]源数据
|
||||
* @param srcLen [IN]源数据长度
|
||||
* @param destData [OUT]目标数据
|
||||
* @param destLen [OUT]目标数据长度
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param params Indicates the pointer to the parameters for this operation.
|
||||
* @param paramCount Indicates the number of parameters.
|
||||
* @param srcData Indicates the pointer to the source data.
|
||||
* @param srcLen Indicates the length of the source data.
|
||||
* @param destData Indicates the pointer to the destination data.
|
||||
* @param destLen Indicates the pointer to the destination data length.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_BAD_PARAMETERS 非法参数
|
||||
* @return TEE_ERROR_GENERIC 其它错误
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_BAD_PARAMETERS</b> if the operation fails due to invalid parameters.
|
||||
* @return Returns <b>TEE_ERROR_GENERIC</b> if the operation fails due to other errors.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_AsymmetricDecrypt(TEE_OperationHandle operation, const TEE_Attribute *params, uint32_t paramCount,
|
||||
void *srcData, size_t srcLen, void *destData, size_t *destLen);
|
||||
|
||||
/**
|
||||
* @brief 非对称签名
|
||||
* @brief Signs a message digest in an asymmetric operation.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param params [IN]属性
|
||||
* @param paramCount [IN]属性数量
|
||||
* @param digest [IN]摘要
|
||||
* @param digestLen [IN]摘要长度
|
||||
* @param signature [OUT]签名
|
||||
* @param signatureLen [OUT]签名长度
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param params Indicates the pointer to the parameters for this operation.
|
||||
* @param paramCount Indicates the number of parameters.
|
||||
* @param digest Indicates the pointer to the message digest.
|
||||
* @param digestLen Indicates the digest length.
|
||||
* @param signature Indicates the pointer to the signature.
|
||||
* @param signatureLen Indicates the pointer to the signature length.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_BAD_PARAMETERS 非法参数
|
||||
* @return TEE_ERROR_GENERIC 其它错误
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_BAD_PARAMETERS</b> if the operation fails due to invalid parameters.
|
||||
* @return Returns <b>TEE_ERROR_GENERIC</b> if the operation fails due to other errors.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_AsymmetricSignDigest(TEE_OperationHandle operation, const TEE_Attribute *params, uint32_t paramCount,
|
||||
void *digest, size_t digestLen, void *signature, size_t *signatureLen);
|
||||
|
||||
/**
|
||||
* @brief 非对称验证
|
||||
* @brief Verifies a message digest signature in an asymmetric operation.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param params [IN]属性
|
||||
* @param paramCount [IN]属性数量
|
||||
* @param digest [IN]摘要
|
||||
* @param digestLen [IN]摘要长度
|
||||
* @param signature [OUT]签名
|
||||
* @param signatureLen [OUT]签名长度
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param params Indicates the pointer to the parameters for this operation.
|
||||
* @param paramCount Indicates the number of parameters.
|
||||
* @param digest Indicates the pointer to the message digest.
|
||||
* @param digestLen Indicates the digest length.
|
||||
* @param signature Indicates the pointer to the signature.
|
||||
* @param signatureLen Indicates the signature length.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_BAD_PARAMETERS 非法参数
|
||||
* @return TEE_ERROR_GENERIC 其它错误
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_BAD_PARAMETERS</b> if the operation fails due to invalid parameters.
|
||||
* @return Returns <b>TEE_ERROR_GENERIC</b> if the operation fails due to other errors.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_AsymmetricVerifyDigest(TEE_OperationHandle operation, const TEE_Attribute *params, uint32_t paramCount,
|
||||
@@ -886,28 +888,29 @@ TEE_Result TEE_AsymmetricVerifyDigest(TEE_OperationHandle operation, const TEE_A
|
||||
|
||||
|
||||
/**
|
||||
* @brief 批量获取操作信息
|
||||
* @brief Obtains information about the operation involving multiple keys.
|
||||
*
|
||||
* @param operation [IN/OUT]操作句柄
|
||||
* @param operationInfoMultiple [IN/OUT]批量操作信息
|
||||
* @param operationSize [IN/OUT]操作信息数量
|
||||
* @param operation Indicates the operation handle.
|
||||
* @param operationInfoMultiple Indicates the pointer to the operation information obtained.
|
||||
* @param operationSize [IN/OUT] Indicates the pointer to the operation information size.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_BAD_PARAMETERS 非法参数
|
||||
* @return TEE_ERROR_SHORT_BUFFER 缓冲区不足
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_BAD_PARAMETERS</b> if the operation fails due to invalid parameters.
|
||||
* @return Returns <b>TEE_ERROR_SHORT_BUFFER</b> if the operationInfo buffer is not large enough to
|
||||
* hold the information obtained.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_GetOperationInfoMultiple(TEE_OperationHandle operation, TEE_OperationInfoMultiple *operationInfoMultiple,
|
||||
const size_t *operationSize);
|
||||
|
||||
/**
|
||||
* @brief 检查算法是否被支持
|
||||
* @brief Checks whether the algorithm is supported.
|
||||
*
|
||||
* @param algId [IN]算法ID
|
||||
* @param element [IN]元素
|
||||
* @param algId Indicates the algorithm to check.
|
||||
* @param element Indicates the cryptographic element.
|
||||
*
|
||||
* @return TEE_SUCCESS 支持
|
||||
* @return TEE_ERROR_NOT_SUPPORTED 不支持
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the algorithm is supported.
|
||||
* @return Returns <b>TEE_ERROR_NOT_SUPPORTED</b> otherwise.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_IsAlgorithmSupported(uint32_t algId, uint32_t element);
|
||||
|
||||
@@ -60,16 +60,16 @@ typedef union {
|
||||
#define TEE_PARAM_TYPE_GET(paramTypes, index) (((paramTypes) >> (4U * (index))) & 0x0F)
|
||||
|
||||
/*
|
||||
* check validation of parameter types
|
||||
* @brief Checks parameter types.
|
||||
*
|
||||
* @param param_to_check [IN] expected parameter values
|
||||
* @param valid0 [IN] first parameter type
|
||||
* @param valid1 [IN] second parameter type
|
||||
* @param valid2 [IN] third parameter type
|
||||
* @param valid3 [IN] fourth parameter type
|
||||
* @param param_to_check Indicates the expected parameter values.
|
||||
* @param valid0 Indicates the first parameter type to check.
|
||||
* @param valid1 Indicates the second parameter type to check.
|
||||
* @param valid2 Indicates the third parameter type to check.
|
||||
* @param valid3 Indicates the fourth parameter type to check.
|
||||
*
|
||||
* @retval true parameter types are correct
|
||||
* @retval false parameter types are incorrect
|
||||
* @retval Returns <b>true</b> if the parameter types are correct.
|
||||
* @retval Returns <b>false</b> otherwise.
|
||||
*/
|
||||
static inline bool check_param_type(uint32_t param_to_check, uint32_t valid0, uint32_t valid1, uint32_t valid2,
|
||||
uint32_t valid3)
|
||||
@@ -233,82 +233,82 @@ typedef struct spawn_uuid {
|
||||
} spawn_uuid_t;
|
||||
|
||||
enum TEE_Result_Value {
|
||||
TEE_SUCCESS = 0x00000000, /* success */
|
||||
TEE_ERROR_INVALID_CMD = 0x00000001, /* command is invalid */
|
||||
TEE_ERROR_SERVICE_NOT_EXIST = 0x00000002, /* service is not exist */
|
||||
TEE_ERROR_SESSION_NOT_EXIST = 0x00000003, /* session is not exist */
|
||||
TEE_ERROR_SESSION_MAXIMUM = 0x00000004, /* exceeds max session count */
|
||||
TEE_ERROR_REGISTER_EXIST_SERVICE = 0x00000005, /* service already registered */
|
||||
TEE_ERROR_TARGET_DEAD_FATAL = 0x00000006, /* internal error occurs */
|
||||
TEE_ERROR_READ_DATA = 0x00000007, /* read data failed */
|
||||
TEE_ERROR_WRITE_DATA = 0x00000008, /* write data failed */
|
||||
TEE_ERROR_TRUNCATE_OBJECT = 0x00000009, /* truncate data failed */
|
||||
TEE_ERROR_SEEK_DATA = 0x0000000A, /* seek data failed */
|
||||
TEE_ERROR_SYNC_DATA = 0x0000000B, /* sync data failed */
|
||||
TEE_ERROR_RENAME_OBJECT = 0x0000000C, /* rename file failed */
|
||||
TEE_ERROR_TRUSTED_APP_LOAD_ERROR = 0x0000000D, /* error occurs when loading TA */
|
||||
TEE_ERROR_STORAGE_EIO = 0x80001001, /* I/O error occurs in storage operation */
|
||||
TEE_ERROR_STORAGE_EAGAIN = 0x80001002, /* storage section is unavailable */
|
||||
TEE_ERROR_STORAGE_ENOTDIR = 0x80001003, /* operation target is not directory */
|
||||
TEE_ERROR_STORAGE_EISDIR = 0x80001004, /* cannot do this operation on directory */
|
||||
TEE_ERROR_STORAGE_ENFILE = 0x80001005, /* opened files exceed max count in system */
|
||||
TEE_ERROR_STORAGE_EMFILE = 0x80001006, /* opened files exceed max count for this process */
|
||||
TEE_ERROR_STORAGE_EROFS = 0x80001007, /* stroage section is read only */
|
||||
TEE_ERROR_STORAGE_PATH_WRONG = 0x8000100A, /* File path error */
|
||||
TEE_ERROR_MSG_QUEUE_OVERFLOW = 0x8000100B, /* sevice msg queue overflow */
|
||||
TEE_ERROR_CORRUPT_OBJECT = 0xF0100001, /* file object has been damaged */
|
||||
TEE_ERROR_STORAGE_NOT_AVAILABLE = 0xF0100003, /* storage section is unavailable */
|
||||
TEE_ERROR_CIPHERTEXT_INVALID = 0xF0100006, /* cipher text is incorrect */
|
||||
TEE_ISOCKET_ERROR_PROTOCOL = 0xF1007001, /* protocol error in socket connection */
|
||||
TEE_ISOCKET_ERROR_REMOTE_CLOSED = 0xF1007002, /* socket is closed by remote */
|
||||
TEE_ISOCKET_ERROR_TIMEOUT = 0xF1007003, /* socket connection is timeout */
|
||||
TEE_ISOCKET_ERROR_OUT_OF_RESOURCES = 0xF1007004, /* no resource avaliable for socket connection */
|
||||
TEE_ISOCKET_ERROR_LARGE_BUFFER = 0xF1007005, /* buffer is too large in socket connection */
|
||||
TEE_ISOCKET_WARNING_PROTOCOL = 0xF1007006, /* warnning occurs in socket connection */
|
||||
TEE_ERROR_GENERIC = 0xFFFF0000, /* generic error */
|
||||
TEE_ERROR_ACCESS_DENIED = 0xFFFF0001, /* access is denied */
|
||||
TEE_ERROR_CANCEL = 0xFFFF0002, /* operation has been canceled */
|
||||
TEE_ERROR_ACCESS_CONFLICT = 0xFFFF0003, /* conflict access error occurs */
|
||||
TEE_ERROR_EXCESS_DATA = 0xFFFF0004, /* exceeds max data size */
|
||||
TEE_ERROR_BAD_FORMAT = 0xFFFF0005, /* incorrect data format */
|
||||
TEE_ERROR_BAD_PARAMETERS = 0xFFFF0006, /* incorrect parameters */
|
||||
TEE_ERROR_BAD_STATE = 0xFFFF0007, /* operation is not allowed in current state */
|
||||
TEE_ERROR_ITEM_NOT_FOUND = 0xFFFF0008, /* cannot find target item */
|
||||
TEE_ERROR_NOT_IMPLEMENTED = 0xFFFF0009, /* api is not implemented */
|
||||
TEE_ERROR_NOT_SUPPORTED = 0xFFFF000A, /* api is not supported */
|
||||
TEE_ERROR_NO_DATA = 0xFFFF000B, /* no data avaliable for this operation */
|
||||
TEE_ERROR_OUT_OF_MEMORY = 0xFFFF000C, /* not memory avaliable for this operation */
|
||||
TEE_ERROR_BUSY = 0xFFFF000D, /* system busy to handle this operation */
|
||||
TEE_ERROR_COMMUNICATION = 0xFFFF000E, /* communication error with target */
|
||||
TEE_ERROR_SECURITY = 0xFFFF000F, /* security error occurs */
|
||||
TEE_ERROR_SHORT_BUFFER = 0xFFFF0010, /* buffer is too short for this operation */
|
||||
TEE_ERROR_EXTERNAL_CANCEL = 0xFFFF0011, /* operation is canceled */
|
||||
TEE_PENDING = 0xFFFF2000, /* service is in pending state(in asynchronous state) */
|
||||
TEE_PENDING2 = 0xFFFF2001, /* service is in pending state() */
|
||||
TEE_PENDING3 = 0xFFFF2002, /* reserved error definition */
|
||||
TEE_ERROR_TIMEOUT = 0xFFFF3001, /* operation is timeout */
|
||||
TEE_ERROR_OVERFLOW = 0xFFFF300f, /* operation overflow */
|
||||
TEE_ERROR_TARGET_DEAD = 0xFFFF3024, /* TA is crashed */
|
||||
TEE_ERROR_STORAGE_NO_SPACE = 0xFFFF3041, /* no enough space to store data */
|
||||
TEE_ERROR_MAC_INVALID = 0xFFFF3071, /* MAC operation failed */
|
||||
TEE_ERROR_SIGNATURE_INVALID = 0xFFFF3072, /* signature check failed */
|
||||
TEE_CLIENT_INTR = 0xFFFF4000, /* Interrupted by CFC. Broken control flow is detected. */
|
||||
TEE_ERROR_TIME_NOT_SET = 0xFFFF5000, /* time is not set */
|
||||
TEE_ERROR_TIME_NEEDS_RESET = 0xFFFF5001, /* time need to be reset */
|
||||
TEE_FAIL = 0xFFFF5002, /* system error */
|
||||
TEE_ERROR_TIMER = 0xFFFF6000, /* base value of timer error codes */
|
||||
TEE_ERROR_TIMER_CREATE_FAILED = 0xFFFF6001, /* failed to create timer */
|
||||
TEE_ERROR_TIMER_DESTORY_FAILED = 0xFFFF6002, /* failed to destory timer */
|
||||
TEE_ERROR_TIMER_NOT_FOUND = 0xFFFF6003, /* timer not found */
|
||||
TEE_ERROR_SEC_FLASH_NOT_AVAILABLE = 0xFFFF7118, /* sec flash is not available */
|
||||
TEE_ERROR_BIOSRV_NOT_AVAILABLE = 0xFFFF711A, /* BIO service is not available */
|
||||
TEE_ERROR_ROTSRV_NOT_AVAILABLE = 0xFFFF711B, /* ROT service is not available */
|
||||
TEE_ERROR_ARTSRV_NOT_AVAILABLE = 0xFFFF711C, /* ART service is not available */
|
||||
TEE_ERROR_HSMSRV_NOT_AVAILABLE = 0xFFFF711D, /* HSM service is not available */
|
||||
TEE_ERROR_ANTIROOT_RSP_FAIL = 0xFFFF9110, /* AntiRoot Response verify failed */
|
||||
TEE_ERROR_ANTIROOT_INVOKE_ERROR = 0xFFFF9111, /* AntiRoot ERROR during invokecmd */
|
||||
TEE_ERROR_AUDIT_FAIL = 0xFFFF9112, /* audit failed */
|
||||
TEE_FAIL2 = 0xFFFF9113 /* unused */
|
||||
TEE_SUCCESS = 0x00000000, /* The operation is successful. */
|
||||
TEE_ERROR_INVALID_CMD = 0x00000001, /* The command is invalid. */
|
||||
TEE_ERROR_SERVICE_NOT_EXIST = 0x00000002, /* The service does not exist. */
|
||||
TEE_ERROR_SESSION_NOT_EXIST = 0x00000003, /* The session does not exist. */
|
||||
TEE_ERROR_SESSION_MAXIMUM = 0x00000004, /* The number of sessions exceeds the limit. */
|
||||
TEE_ERROR_REGISTER_EXIST_SERVICE = 0x00000005, /* The service has been already registered. */
|
||||
TEE_ERROR_TARGET_DEAD_FATAL = 0x00000006, /* An internal error occurs. */
|
||||
TEE_ERROR_READ_DATA = 0x00000007, /* Failed to read data. */
|
||||
TEE_ERROR_WRITE_DATA = 0x00000008, /* Failed to write data. */
|
||||
TEE_ERROR_TRUNCATE_OBJECT = 0x00000009, /* Failed to truncate data. */
|
||||
TEE_ERROR_SEEK_DATA = 0x0000000A, /* Failed to seek data. */
|
||||
TEE_ERROR_SYNC_DATA = 0x0000000B, /* Failed to synchronize data. */
|
||||
TEE_ERROR_RENAME_OBJECT = 0x0000000C, /* Failed to rename the file. */
|
||||
TEE_ERROR_TRUSTED_APP_LOAD_ERROR = 0x0000000D, /* An error occurs when the TA is loaded. */
|
||||
TEE_ERROR_STORAGE_EIO = 0x80001001, /* An I/O error occurs when data is stored. */
|
||||
TEE_ERROR_STORAGE_EAGAIN = 0x80001002, /* The storage section is unavailable. */
|
||||
TEE_ERROR_STORAGE_ENOTDIR = 0x80001003, /* The operation target is not a directory. */
|
||||
TEE_ERROR_STORAGE_EISDIR = 0x80001004, /* This operation cannot be performed on a directory. */
|
||||
TEE_ERROR_STORAGE_ENFILE = 0x80001005, /* The number of opened files exceeds the limit in system. */
|
||||
TEE_ERROR_STORAGE_EMFILE = 0x80001006, /* The number of files opened for the process exceeds the limit.*/
|
||||
TEE_ERROR_STORAGE_EROFS = 0x80001007, /* The storage section is read only. */
|
||||
TEE_ERROR_STORAGE_PATH_WRONG = 0x8000100A, /* The file path is not correct. */
|
||||
TEE_ERROR_MSG_QUEUE_OVERFLOW = 0x8000100B, /* The service message queue overflows. */
|
||||
TEE_ERROR_CORRUPT_OBJECT = 0xF0100001, /* The file object is corrupted. */
|
||||
TEE_ERROR_STORAGE_NOT_AVAILABLE = 0xF0100003, /* The storage section is unavailable. */
|
||||
TEE_ERROR_CIPHERTEXT_INVALID = 0xF0100006, /* The cipher text is incorrect. */
|
||||
TEE_ISOCKET_ERROR_PROTOCOL = 0xF1007001, /* Protocol error in socket connection. */
|
||||
TEE_ISOCKET_ERROR_REMOTE_CLOSED = 0xF1007002, /* The socket is closed by the remote end. */
|
||||
TEE_ISOCKET_ERROR_TIMEOUT = 0xF1007003, /* The socket connection timed out. */
|
||||
TEE_ISOCKET_ERROR_OUT_OF_RESOURCES = 0xF1007004, /* There is no resource available for the socket connection. */
|
||||
TEE_ISOCKET_ERROR_LARGE_BUFFER = 0xF1007005, /* The buffer is too large for the socket connection. */
|
||||
TEE_ISOCKET_WARNING_PROTOCOL = 0xF1007006, /* A warning is given in the socket connection. */
|
||||
TEE_ERROR_GENERIC = 0xFFFF0000, /* Generic error. */
|
||||
TEE_ERROR_ACCESS_DENIED = 0xFFFF0001, /* The access is denied. */
|
||||
TEE_ERROR_CANCEL = 0xFFFF0002, /* The operation has been canceled. */
|
||||
TEE_ERROR_ACCESS_CONFLICT = 0xFFFF0003, /* An access conflict occurs. */
|
||||
TEE_ERROR_EXCESS_DATA = 0xFFFF0004, /* The data size exceeds the maximum. */
|
||||
TEE_ERROR_BAD_FORMAT = 0xFFFF0005, /* Incorrect data format. */
|
||||
TEE_ERROR_BAD_PARAMETERS = 0xFFFF0006, /* Incorrect parameters. */
|
||||
TEE_ERROR_BAD_STATE = 0xFFFF0007, /* The current state does not support the operation. */
|
||||
TEE_ERROR_ITEM_NOT_FOUND = 0xFFFF0008, /* Failed to find the target item. */
|
||||
TEE_ERROR_NOT_IMPLEMENTED = 0xFFFF0009, /* The API is not implemented. */
|
||||
TEE_ERROR_NOT_SUPPORTED = 0xFFFF000A, /* The API is not supported. */
|
||||
TEE_ERROR_NO_DATA = 0xFFFF000B, /* There is no data available for this operation. */
|
||||
TEE_ERROR_OUT_OF_MEMORY = 0xFFFF000C, /* There is no memory available for this operation. */
|
||||
TEE_ERROR_BUSY = 0xFFFF000D, /* The system does not respond to this operation. */
|
||||
TEE_ERROR_COMMUNICATION = 0xFFFF000E, /* Failed to communicate with the target. */
|
||||
TEE_ERROR_SECURITY = 0xFFFF000F, /* A security error occurs. */
|
||||
TEE_ERROR_SHORT_BUFFER = 0xFFFF0010, /* The buffer is insufficient for this operation. */
|
||||
TEE_ERROR_EXTERNAL_CANCEL = 0xFFFF0011, /* The operation has been canceled. */
|
||||
TEE_PENDING = 0xFFFF2000, /* The service is in the pending state (asynchronous state). */
|
||||
TEE_PENDING2 = 0xFFFF2001, /* The service is in the pending state(). */
|
||||
TEE_PENDING3 = 0xFFFF2002, /* Reserved. */
|
||||
TEE_ERROR_TIMEOUT = 0xFFFF3001, /* The operation timed out. */
|
||||
TEE_ERROR_OVERFLOW = 0xFFFF300f, /* Overflow occurs. */
|
||||
TEE_ERROR_TARGET_DEAD = 0xFFFF3024, /* The TA is crashed. */
|
||||
TEE_ERROR_STORAGE_NO_SPACE = 0xFFFF3041, /* There is no enough space to store data. */
|
||||
TEE_ERROR_MAC_INVALID = 0xFFFF3071, /* The MAC operation failed. */
|
||||
TEE_ERROR_SIGNATURE_INVALID = 0xFFFF3072, /* The signature verification failed. */
|
||||
TEE_CLIENT_INTR = 0xFFFF4000, /* Interrupted by CFC. Broken control flow is detected. */
|
||||
TEE_ERROR_TIME_NOT_SET = 0xFFFF5000, /* Time is not set. */
|
||||
TEE_ERROR_TIME_NEEDS_RESET = 0xFFFF5001, /* Time needs to be reset. */
|
||||
TEE_FAIL = 0xFFFF5002, /* System error. */
|
||||
TEE_ERROR_TIMER = 0xFFFF6000, /* Base value of the timer error code. */
|
||||
TEE_ERROR_TIMER_CREATE_FAILED = 0xFFFF6001, /* Failed to create the timer. */
|
||||
TEE_ERROR_TIMER_DESTORY_FAILED = 0xFFFF6002, /* Failed to destroy the timer. */
|
||||
TEE_ERROR_TIMER_NOT_FOUND = 0xFFFF6003, /* The timer is not found. */
|
||||
TEE_ERROR_SEC_FLASH_NOT_AVAILABLE = 0xFFFF7118, /* sec flash is not available. */
|
||||
TEE_ERROR_BIOSRV_NOT_AVAILABLE = 0xFFFF711A, /* The BIO service is not available. */
|
||||
TEE_ERROR_ROTSRV_NOT_AVAILABLE = 0xFFFF711B, /* The ROT service is not available. */
|
||||
TEE_ERROR_ARTSRV_NOT_AVAILABLE = 0xFFFF711C, /* The ART service is not available. */
|
||||
TEE_ERROR_HSMSRV_NOT_AVAILABLE = 0xFFFF711D, /* The HSM service is not available. */
|
||||
TEE_ERROR_ANTIROOT_RSP_FAIL = 0xFFFF9110, /* Failed to verify AntiRoot response. */
|
||||
TEE_ERROR_ANTIROOT_INVOKE_ERROR = 0xFFFF9111, /* AntiRoot error in invokeCmd(). */
|
||||
TEE_ERROR_AUDIT_FAIL = 0xFFFF9112, /* Audit failed. */
|
||||
TEE_FAIL2 = 0xFFFF9113 /* Unused. */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -321,7 +321,7 @@ enum TEE_LoginMethod {
|
||||
TEE_LOGIN_APPLICATION = 0x4,
|
||||
TEE_LOGIN_USER_APPLICATION = 0x5,
|
||||
TEE_LOGIN_GROUP_APPLICATION = 0x6,
|
||||
TEE_LOGIN_IDENTIFY = 0x7, /* defined Lognin type */
|
||||
TEE_LOGIN_IDENTIFY = 0x7, /* Customized login type */
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
/**
|
||||
* @file tee_mem_mgmt_api.h
|
||||
*
|
||||
* @brief 内存操作接口
|
||||
* @brief Provides APIs for memory management.
|
||||
*
|
||||
*
|
||||
* 开发者可以使用这些接口实现对内存操作相关的功能。
|
||||
*
|
||||
* @since 1
|
||||
*/
|
||||
@@ -26,9 +26,9 @@
|
||||
#include "tee_mem_monitoring_api.h"
|
||||
|
||||
/*
|
||||
* below definitions are defined by Global Platform or Platform SDK released previously
|
||||
* for compatibility:
|
||||
* don't make any change to the content below
|
||||
* The definitions below are defined by Global Platform or Platform SDK released previously
|
||||
* for compatibility.
|
||||
* Do not make any change to the content below.
|
||||
*/
|
||||
#ifndef ZERO_SIZE_PTR
|
||||
#define ZERO_SIZE_PTR ((void *)16)
|
||||
@@ -38,14 +38,14 @@
|
||||
enum MALLOC_HINT {
|
||||
ZERO = 0,
|
||||
NOT_ZERO = 1,
|
||||
ALIGN_004 = 0x80000002, /* buf align */
|
||||
ALIGN_004 = 0x80000002, /* Buffer alignment */
|
||||
ALIGN_008 = 0x80000003,
|
||||
ALIGN_016 = 0x80000004,
|
||||
ALIGN_032 = 0x80000005,
|
||||
ALIGN_064 = 0x80000006,
|
||||
ALIGN_128 = 0x80000007,
|
||||
ALIGN_256 = 0x80000008,
|
||||
ALIGN_004_ZERO = 0x80000012, /* buf align and set to zero */
|
||||
ALIGN_004_ZERO = 0x80000012, /* The buffer is 4-byte aligned and initialized to zeros. */
|
||||
ALIGN_008_ZERO = 0x80000013,
|
||||
ALIGN_016_ZERO = 0x80000014,
|
||||
ALIGN_032_ZERO = 0x80000015,
|
||||
@@ -63,11 +63,11 @@ enum MALLOC_HINT {
|
||||
#define TEE_MEMORY_ACCESS_ANY_OWNER 0x00000004
|
||||
|
||||
/**
|
||||
* @brief 用x填充缓冲区的第一个大小字节
|
||||
* @brief Fills <b>x</b> into the first <b>size</b> bytes of the buffer.
|
||||
*
|
||||
* @param buffer [OUT]缓冲区指针
|
||||
* @param x [IN]填充值
|
||||
* @param size [IN]字节数
|
||||
* @param buffer Indicates the pointer to the buffer.
|
||||
* @param x Indicates the value to fill.
|
||||
* @param size Indicates the number of bytes to fill.
|
||||
*
|
||||
*/
|
||||
#if defined(API_LEVEL) && (API_LEVEL >= API_LEVEL1_2)
|
||||
@@ -77,94 +77,99 @@ void TEE_MemFill(void *buffer, uint32_t x, size_t size);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief 将大小字节从src复制到dest
|
||||
* @brief Copies bytes.
|
||||
*
|
||||
* @param dest [OUT]dest缓冲区指针
|
||||
* @param src [IN]src缓冲区指针
|
||||
* @param size [IN]字节数
|
||||
* @param dest Indicates the pointer to the buffer that holds the bytes copied.
|
||||
* @param src Indicates the pointer to the buffer that holds the bytes to copy.
|
||||
* @param size Indicates the number of bytes to copy.
|
||||
*
|
||||
*/
|
||||
void TEE_MemMove(void *dest, const void *src, size_t size);
|
||||
|
||||
/**
|
||||
* @brief 使用提示值分配大小字节的内存返回的指针将兼容任何C基本数据类型
|
||||
* @brief Allocates space of the specified size for an object.
|
||||
*
|
||||
* @param size [IN]将分配的内存大小
|
||||
* @param hint [IN]标志,0表示返回的内存将填充“\0”
|
||||
* @param size Indicates the size of the memory to be allocated.
|
||||
* @param hint Indicates a hint to the allocator. The value <b>0</b> indicates that the memory block
|
||||
* returned is filled with "\0".
|
||||
*
|
||||
* @return 指向新分配内存的指针
|
||||
* @return NULL 表示分配时失败
|
||||
* @return Returns a pointer to the newly allocated space if the operation is successful.
|
||||
* @return Returns a <b>NULL</b> pointer if the allocation fails.
|
||||
*
|
||||
*/
|
||||
void *TEE_Malloc(size_t size, uint32_t hint);
|
||||
|
||||
/**
|
||||
* @brief 释放TEE_Malloc分配的内存
|
||||
* @brief Releases the memory allocated by <b>TEE_Malloc</b>.
|
||||
*
|
||||
* 如果缓冲区等于NULL,则TEE_Free将不执行任何操作\n
|
||||
* 调用者应确保缓冲区是由TEE_Malloc或TEE_Realloc创建的,并且不应两次释放一个内存,操作结果不可预测
|
||||
* If the buffer is a <b>NULL</b> pointer, <b>TEE_Free</b> does nothing.
|
||||
* The buffer to be released must have been allocated by <b>TEE_Malloc</b> or <b>TEE_Realloc</b> and cannot be
|
||||
* released repeatedly. Otherwise, unexpected result may be caused.
|
||||
*
|
||||
* @param buffer [IN]指向内存的指针
|
||||
* @param buffer Indicates the pointer to the memory to release.
|
||||
*
|
||||
*/
|
||||
void TEE_Free(void *buffer);
|
||||
|
||||
/**
|
||||
* @brief 重新分配内存
|
||||
* @brief Reallocates memory.
|
||||
*
|
||||
* 如果new_size大于旧size,则旧内存的内容不会更改,剩余内存是随机字节\n
|
||||
* 修改内存大小时将有一个新的分配操作\n
|
||||
* 如果分配失败,将返回旧内存,此函数将返回NULL\n
|
||||
* 如果缓冲区等于NULL,则此函数与TEE_Malloc相同
|
||||
* If <b>new_size</b> is greater than the old size, the content of the original memory does not change
|
||||
* and the space in excess of the old size contains unspecified content.
|
||||
* If the new size of the memory object requires movement of the object, the space for the previous
|
||||
* instantiation of the object is deallocated.
|
||||
* If the space cannot be allocated, the original object remains allocated and this function
|
||||
* returns a <b>NULL</b> pointer.
|
||||
* If the buffer is <b>NULL</b>, this function is equivalent to <b>TEE_Malloc</b>.
|
||||
*
|
||||
* @param buffer [IN]指向内存的指针
|
||||
* @param new_size [IN]重新分配的大小
|
||||
* @param buffer Indicates the pointer to the memory to reallocate.
|
||||
* @param new_size Indicates the new size required.
|
||||
*
|
||||
* @return 指向新内存的指针,不应为NULL
|
||||
* @return NULL表示失败
|
||||
* @return Returns a pointer to the allocated memory if the operation is successful.
|
||||
* @return Returns a <b>NULL</b> pointer if the operation fails.
|
||||
*
|
||||
*/
|
||||
void *TEE_Realloc(void *buffer, size_t new_size);
|
||||
|
||||
/**
|
||||
* @brief 内存内容比较
|
||||
* @brief Compares memory content from the beginning.
|
||||
*
|
||||
* @param buffer1 [IN]第一个指针
|
||||
* @param buffer2 [IN]第二个指针
|
||||
* @param size [IN]要比较的字节大小
|
||||
* @param buffer1 Indicates the pointer to the first buffer.
|
||||
* @param buffer2 Indicates the pointer to the second buffer.
|
||||
* @param size Indicates the number of the bytes to compare.
|
||||
*
|
||||
* @return -1 buffer1 < buffer2
|
||||
* @return 0 buffer1 == buffer2
|
||||
* @return 1 buffer1 > buffer2
|
||||
* @return Returns <b>–1</b> if buffer1 < buffer2.
|
||||
* @return Returns <b>0</b> if buffer1 == buffer2.
|
||||
* @return Returns <b>1</b> if buffer1 > buffer2.
|
||||
*
|
||||
*/
|
||||
int32_t TEE_MemCompare(const void *buffer1, const void *buffer2, size_t size);
|
||||
|
||||
/**
|
||||
* @brief 检查缓冲区的访问权限
|
||||
* @brief Checks whether this TA has the requested permissions to access a buffer.
|
||||
*
|
||||
* @param accessFlags [IN]待检查的访问权限
|
||||
* @param buffer [IN]指向内存的指针
|
||||
* @param size [IN]要检查的内存大小
|
||||
* @param accessFlags Indicates the access permissions to check.
|
||||
* @param buffer Indicates the pointer to the target buffer.
|
||||
* @param size Indicates the size of the buffer to check.
|
||||
*
|
||||
* @return TEE_SUCCESS 具有访问权限
|
||||
* @return TEE_ERROR_ACCESS_DENIED 没有访问权限
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the TA has the requested permissions.
|
||||
* @return Returns <b>TEE_ERROR_ACCESS_DENIED</b> otherwise.
|
||||
*/
|
||||
TEE_Result TEE_CheckMemoryAccessRights(uint32_t accessFlags, const void *buffer, size_t size);
|
||||
|
||||
/**
|
||||
* @brief 用于在同一实例的不同会话中共享的全局变量
|
||||
* @brief Sets the TA instance data pointer.
|
||||
*
|
||||
* @param instanceData [IN]全局变量地址
|
||||
* @param instanceData Indicates the pointer to the global TA instance data.
|
||||
*
|
||||
*/
|
||||
void TEE_SetInstanceData(void *instanceData);
|
||||
|
||||
/**
|
||||
* @brief 获取TEE_SetInstanceData设置的指针
|
||||
* @brief Obtains the instance data pointer set by the TA using <b>TEE_SetInstanceData</b>.
|
||||
*
|
||||
* @return 指向TEE_SetInstanceData设置的变量的指针,指针不应为NULL
|
||||
* @return NULL 未设置InstanceData
|
||||
* @return Returns the pointer to the instance data set by <b>TEE_SetInstanceData</b>
|
||||
* @return or <b>NULL</b> if no instance data pointer has been set.
|
||||
*
|
||||
*/
|
||||
void *TEE_GetInstanceData(void);
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* get heap usage of current TA
|
||||
* @brief Obtains the heap usage of this trusted application (TA).
|
||||
*
|
||||
* @param show [IN] weather need to print result in log file
|
||||
* @param show Indicates whether to print the result in the log file.
|
||||
*
|
||||
* @return percentage of heap usage
|
||||
* @return Returns the heap usage in percentage.
|
||||
*/
|
||||
uint32_t get_heap_usage(bool show);
|
||||
|
||||
|
||||
+121
-104
@@ -13,9 +13,9 @@
|
||||
/**
|
||||
* @file tee_object_api.h
|
||||
*
|
||||
* @brief 安全存储接口
|
||||
* @brief Provides trusted storage APIs.
|
||||
*
|
||||
* 开发者可以使用这些接口实现安全存储的相关功能。
|
||||
* You can use these APIs to implement trusted storage features.
|
||||
*
|
||||
* @since 1
|
||||
*/
|
||||
@@ -25,48 +25,49 @@
|
||||
#include "tee_defines.h"
|
||||
|
||||
/**
|
||||
* @brief HANDLE_NULL的定义,无效的对象句柄
|
||||
* @brief Defines <b>HANDLE_NULL</b>, which is used to denote the absence of a handle.
|
||||
*/
|
||||
#define TEE_HANDLE_NULL 0x00000000
|
||||
|
||||
/**
|
||||
* @brief TEE_ObjectHandle的密钥使用方式,决定了对象密钥的使用情况
|
||||
* @brief Enumerates the usages of the key of the <b>TEE_ObjectHandle</b>.
|
||||
*/
|
||||
enum Usage_Constants {
|
||||
/** 可以提取对象的密钥 */
|
||||
/** The object's key is extractable. */
|
||||
TEE_USAGE_EXTRACTABLE = 0x00000001,
|
||||
/** 对象的密钥可以用于加密 */
|
||||
/** Used for encryption. */
|
||||
TEE_USAGE_ENCRYPT = 0x00000002,
|
||||
/** 对象的密钥可以用于解密 */
|
||||
/** Used for decryption. */
|
||||
TEE_USAGE_DECRYPT = 0x00000004,
|
||||
/** 对象的密钥可以用于哈希计算 */
|
||||
/** Used for hash calculation. */
|
||||
TEE_USAGE_MAC = 0x00000008,
|
||||
/** 对象的密钥可以用于签名 */
|
||||
/** Used for creating a signature. */
|
||||
TEE_USAGE_SIGN = 0x00000010,
|
||||
/** 对象的密钥可以用来验签 */
|
||||
/** Used for signature verification. */
|
||||
TEE_USAGE_VERIFY = 0x00000020,
|
||||
/** 对象的密钥可用于派生 */
|
||||
/** Used for key derivation. */
|
||||
TEE_USAGE_DERIVE = 0x00000040,
|
||||
/** 对象初始化,默认分配所有权限 */
|
||||
/** Used for object initialization, with all permissions assigned by default. */
|
||||
TEE_USAGE_DEFAULT = 0xFFFFFFFF,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief TEE_ObjectHandle的句柄标志指示对象的一些信息,是否为永久对象,是否已初始化等。
|
||||
* @brief Defines information about the object pointed to by the flag of the <b>TEE_ObjectHandle</b>,
|
||||
* for example, whether the object is a persistent object or is initialized.
|
||||
*/
|
||||
enum Handle_Flag_Constants {
|
||||
/** 持久化对象 */
|
||||
/** The object is a persistent object. */
|
||||
TEE_HANDLE_FLAG_PERSISTENT = 0x00010000,
|
||||
/** 对象已初始化 */
|
||||
/** The object is initialized. */
|
||||
TEE_HANDLE_FLAG_INITIALIZED = 0x00020000,
|
||||
/** 未使用 */
|
||||
/**Reserved */
|
||||
TEE_HANDLE_FLAG_KEY_SET = 0x00040000,
|
||||
/** 未使用 */
|
||||
/**Reserved */
|
||||
TEE_HANDLE_FLAG_EXPECT_TWO_KEYS = 0x00080000,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 属性标识符标志列表
|
||||
* @brief Defines a list of attribute identifier flags.
|
||||
*/
|
||||
#define TEE_ATTR_FLAG_VALUE 0x20000000
|
||||
#define TEE_ATTR_FLAG_PUBLIC 0x10000000
|
||||
@@ -78,184 +79,200 @@ enum Handle_Flag_Constants {
|
||||
#define TEE_ATTR_IS_PUBLIC(attribute_id) ((((attribute_id) << 3) >> 31) == 1)
|
||||
|
||||
/**
|
||||
* @brief 在TEE_ObjectHandle指向的对象的TEE_Attribute结构中获取联合的缓冲区内容
|
||||
* @brief Obtains a buffer attribute from the <b>TEE_Attribute</b> struct of the object pointed
|
||||
* to by <b>TEE_ObjectHandle</b>.
|
||||
*
|
||||
* TEE_Attribute结构中的联合成员需要是ref。如果TEE_Attribute是私有的,则对象的使用常数必须包括TEE_USAGE_EXTRACTABLE
|
||||
* The members in the <b>TEE_Attribute</b> struct must be <b>ref</b>. If the <b>TEE_Attribute</b> is private,
|
||||
* the <b>Usage_Constants</b> of the object must include <b>TEE_USAGE_EXTRACTABLE</b>.
|
||||
*
|
||||
* @param object [IN]源TEE_ObjectHandle
|
||||
* @param attributeID [IN]要获取的属性ID,如TEE_ObjectAttribute,也可以自定义
|
||||
* @param buffer [OUT]指针,指向的缓冲区用于存储获取的缓冲区的内容
|
||||
* @param size [IN/OUT]指针,存储内容字节长度
|
||||
* @param object Indicates the handle of the object.
|
||||
* @param attributeID Indicates the ID of the attribute to obtain, for example, <b>TEE_ObjectAttribute</b>.
|
||||
* The attribute ID can also be customized.
|
||||
* @param buffer Indicates the pointer to the buffer that stores the attribute obtained.
|
||||
* @param size Indicates the pointer to the length of the content stored.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return TEE_ERROR_ITEM_NOT_FOUND 在对象中找不到要查找的TEE_Attribute,或者对象未初始化
|
||||
* @return TEE_ERROR_SHORT_BUFFER提供的缓冲区太小,无法存储获取的内容
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_ITEM_NOT_FOUND</b> if the <b>TEE_Attribute</b> cannot be found in the object
|
||||
* or the object is not initialized.
|
||||
* @return Returns <b>TEE_ERROR_SHORT_BUFFER</b> if the buffer is too small to store the content obtained.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_GetObjectBufferAttribute(TEE_ObjectHandle object, uint32_t attributeID, void *buffer, size_t *size);
|
||||
|
||||
/**
|
||||
* @brief 在对象中的TEE_Attribute中获取联合的值
|
||||
* @brief Obtains a value attribute from the <b>TEE_Attribute</b> of an object.
|
||||
*
|
||||
* TEE_Attribute结构中联合的成员必须为value。如果TEE_Attribute是私有的,则对象的Usage_Constants需要包括TEE_USAGE_EXTRACTABLE
|
||||
* The members of the <b>TEE_Attribute</b> struct must be values. If the <b>TEE_Attribute</b> is private,
|
||||
* the <b>Usage_Constants</b> of the object must include <b>TEE_USAGE_EXTRACTABLE</b>.
|
||||
*
|
||||
* @param object [IN]源TEE_ObjectHandle
|
||||
* @param attributeID [IN]需要获取的属性ID,如TEE_ObjectAttribute,也可以自定义
|
||||
* @param a [OUT]指针,指向的空间用于存储
|
||||
* @param b [OUT]指针,指向的空间用于存储b
|
||||
* @param object Indicates the handle of the object.
|
||||
* @param attributeID Indicates the ID of the attribute to obtain, for example, <b>TEE_ObjectAttribute</b>.
|
||||
* The attribute ID can also be customized.
|
||||
* @param a Indicates the pointer to the placeholder filled with the attribute field <b>a</b>.
|
||||
* @param b Indicates the pointer to the placeholder filled with the attribute field <b>b</b>.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return TEE_ERROR_ITEM_NOT_FOUND 在对象中找不到要查找的TEE_Attribute,或者对象未初始化
|
||||
* @return TEE_ERROR_ACCESS_DENIED 尝试获取私有TEE_Attribute,但未设置TEE_USAGE_EXTRACTABLE
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_ITEM_NOT_FOUND</b> if the <b>TEE_Attribute</b> cannot be found in the object
|
||||
* or the object is not initialized.
|
||||
* @return Returns <b>TEE_ERROR_ACCESS_DENIED</b> if <b>TEE_Attribute</b> is private
|
||||
* but the object <b>Usage_Constants</b> does not contain the <b>TEE_USAGE_EXTRACTABLE</b> flag.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_GetObjectValueAttribute(TEE_ObjectHandle object, uint32_t attributeID, uint32_t *a, uint32_t *b);
|
||||
|
||||
/**
|
||||
* @brief 关闭打开的TEE_ObjectHandle对象
|
||||
* @brief Closes a <b>TEE_ObjectHandle</b> object.
|
||||
*
|
||||
* 对象可以是持久对象,也可以是临时对象
|
||||
* The object can be persistent or transient.
|
||||
*
|
||||
* @param object [IN]待关闭的TEE_ObjectHandle对象
|
||||
* @param object Indicates the <b>TEE_ObjectHandle</b> object to close.
|
||||
*
|
||||
*/
|
||||
void TEE_CloseObject(TEE_ObjectHandle object);
|
||||
|
||||
/**
|
||||
* @brief 分配一个未初始化的对象来存储键
|
||||
* @brief Allocates an uninitialized object to store keys.
|
||||
*
|
||||
* objectType和maxObjectSize需要指定以预分配
|
||||
* <b>objectType</b> and <b>maxObjectSize</b> must be specified.
|
||||
*
|
||||
* @param objectType [IN]待创建对象的类型,取值为TEE_ObjectType
|
||||
* @param maxObjectSize [IN]对象的最大字节数
|
||||
* @param object [OUT]指向新创建对象句柄的指针
|
||||
* @param objectType Indicates the type of the object to create. The value is <b>TEE_ObjectType</b>.
|
||||
* @param maxObjectSize Indicates the maximum number of bytes of the object.
|
||||
* @param object Indicates the pointer to the handle of the newly created object.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return TEE_ERROR_OUT_OF_MEMORY 内存不足,无法分配
|
||||
* @return TEE_ERROR_NOT_SUPPORTED 不支持对象提供的字节
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_OUT_OF_MEMORY</b> if the memory is insufficient.
|
||||
* @return Returns <b>TEE_ERROR_NOT_SUPPORTED</b> if the object type is not supported.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_AllocateTransientObject(uint32_t objectType, uint32_t maxObjectSize, TEE_ObjectHandle *object);
|
||||
|
||||
/**
|
||||
* @brief 释放已分配的临时对象
|
||||
* @brief Releases a transient object that is previously allocated with <b>TEE_AllocateTransientObject</b>.
|
||||
*
|
||||
* 函数调用后,句柄失效,所有分配的都被释放。与TEE_AllocateTransientObject配对
|
||||
* After the function is called, the handle becomes invalid and all allocated resources are released.
|
||||
* <b>TEE_FreeTransientObject</b> and <b>TEE_AllocateTransientObject</b> are used in pairs.
|
||||
*
|
||||
* @param object[IN]需要释放的TEE_ObjectHandle
|
||||
* @param object Indicates the <b>TEE_ObjectHandle</b> to release.
|
||||
*
|
||||
*/
|
||||
void TEE_FreeTransientObject(TEE_ObjectHandle object);
|
||||
|
||||
/**
|
||||
* @brief 将瞬态对象重置为初始状态,即分配后的状态
|
||||
* @brief Resets a transient object to its initial state after allocation.
|
||||
*
|
||||
* 可以重用已分配但未存储密钥的未初始化对象来存储密钥
|
||||
* You can use an allocated object, which has not been initialized or used to store a key, to store a key.
|
||||
*
|
||||
* @param object [IN]需要重置的TEE_ObjectHandle
|
||||
* @param object Indicates the <b>TEE_ObjectHandle</b> to reset.
|
||||
*
|
||||
*/
|
||||
void TEE_ResetTransientObject(TEE_ObjectHandle object);
|
||||
|
||||
/**
|
||||
* @brief 将参数attrs中的属性分配给未初始化的瞬态对象
|
||||
* @brief Populates an uninitialized object with object attributes passed by the TA in the <b>attrs</b> parameter.
|
||||
*
|
||||
* 确保对象仍未初始化\n
|
||||
* 参数attrs由可信应用程序提供
|
||||
* The object must be uninitialized. \n
|
||||
* The <b>attrs</b> parameter is passed by a TA.
|
||||
*
|
||||
* @param object [IN/OUT]TEE_ObjectHandle已创建但未初始化
|
||||
* @param attrs [IN]对象属性数组,可以是一个或多个TEE_Attribute
|
||||
* @param attrCount [IN]数组成员数
|
||||
* @param object Indicates the handle on a created but uninitialized object.
|
||||
* @param attrs Indicates the pointer to an array of object attributes, which can be one or more <b>TEE_Attribute</b>s.
|
||||
* @param attrCount Indicates the number of members in the attribute array.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return TEE_ERROR_BAD_PARAMETERS 属性不正确或不一致
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_BAD_PARAMETERS</b> if an incorrect or inconsistent attribute value is detected.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_PopulateTransientObject(TEE_ObjectHandle object, TEE_Attribute *attrs, uint32_t attrCount);
|
||||
|
||||
/**
|
||||
* @brief 初始化缓冲区类型TEE_Attribute
|
||||
* @brief Initializes the <b>TEE_Attribute</b> of the buffer type.
|
||||
*
|
||||
* TEE_Attribute结构中的联合成员需要是ref
|
||||
* The members in the <b>TEE_Attribute</b> struct must be <b>ref</b>.
|
||||
*
|
||||
* @param attr [OUT]要初始化的TEE_Attribute
|
||||
* @param attributeID [IN]分配给TEE_Attribute的ID
|
||||
* @param buffer [IN]缓冲区存储要分配的内容
|
||||
* @param length [IN]赋值内容的字节长度
|
||||
* @param attr Indicates the pointer to the <b>TEE_Attribute</b> initialized.
|
||||
* @param attributeID Indicates the ID assigned to the <b>TEE_Attribute</b>.
|
||||
* @param buffer Indicates the pointer to the buffer that stores the content to be allocated.
|
||||
* @param length Indicates the length of the assigned value, in bytes.
|
||||
*
|
||||
*/
|
||||
void TEE_InitRefAttribute(TEE_Attribute *attr, uint32_t attributeID, void *buffer, size_t length);
|
||||
|
||||
/**
|
||||
* @brief 初始化TEE_Attribute
|
||||
* @brief Initializes a <b>TEE_Attribute</b>.
|
||||
*
|
||||
* @param attr [OUT]要初始化的TEE_Attribute
|
||||
* @param attributeID [IN]分配给TEE_Attribute的ID
|
||||
* @param a [IN]将值赋值给TEE_Attribute中的联合的成员值a
|
||||
* @param b [IN]将值赋值给TEE_Attribute中的联合的成员值b
|
||||
* @param attr Indicates the pointer to the <b>TEE_Attribute</b> initialized.
|
||||
* @param attributeID Indicates the ID assigned to the <b>TEE_Attribute</b>.
|
||||
* @param a Indicates the value to be assigned to the member <b>a</b> in the <b>TEE_Attribute</b>.
|
||||
* @param b Indicates the value to be assigned to the member <b>b</b> in the <b>TEE_Attribute</b>.
|
||||
*
|
||||
*/
|
||||
void TEE_InitValueAttribute(TEE_Attribute *attr, uint32_t attributeID, uint32_t a, uint32_t b);
|
||||
|
||||
/**
|
||||
* @brief 此函数生成随机密钥或密钥对,并将其分配给临时对象
|
||||
* @brief Generates a random key or a key pair and populates a transient key object with the generated key.
|
||||
*
|
||||
* @param object [IN]瞬态对象,用于存储生成的密钥
|
||||
* @param keySize [IN]所需密钥的字节数
|
||||
* @param params [IN]密钥生成参数说明
|
||||
* @param paramCount [IN]生成密钥所需的参数数
|
||||
* @param object Indicates a transient object used to hold the generated key.
|
||||
* @param keySize Indicates the number of bytes of the key.
|
||||
* @param params Indicates the pointer to the parameters for key generation.
|
||||
* @param paramCount Indicates the number of parameters required for key generation.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return TEE_ERROR_BAD_PARAMETERS 生成的密钥与临时对象可以存储的密钥类型不一致
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_BAD_PARAMETERS</b> if the type of the key generated does not match
|
||||
* the key that can be held in the transient object.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_GenerateKey(TEE_ObjectHandle object, uint32_t keySize, TEE_Attribute *params, uint32_t paramCount);
|
||||
|
||||
/**
|
||||
* @brief 获取对象的TEE_ObjectInfo
|
||||
* @brief Obtains <b>TEE_ObjectInfo</b>.
|
||||
*
|
||||
* 获取对象的TEE_ObjectInfo,并将其复制到参数objectInfo指向的空间中,该空间由用户预分配
|
||||
* This function obtains <b>TEE_ObjectInfo</b> and copies the obtained information to the pre-allocated space
|
||||
* pointed to by <b>objectInfo</b>.
|
||||
*
|
||||
* @param object [IN]源TEE_ObjectHandle
|
||||
* @param objectInfo [OUT]用于存储TEE_ObjectInfo的结构体指针
|
||||
* @param object Indicates the handle of the object.
|
||||
* @param objectInfo Indicates the pointer to the <b>TEE_ObjectInfo</b> obtained.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return TEE_ERROR_CORRUPT_OBJECT 文件损坏,文件句柄将被关闭
|
||||
* @return TEE_ERROR_STORAGE_NOT_AVAILABLE 无法访问文件所在的存储区域
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_CORRUPT_OBJECT</b> if the object is corrupted and the object handle will be closed.
|
||||
* @return Returns <b>TEE_ERROR_STORAGE_NOT_AVAILABLE</b> if the object is stored
|
||||
* in a storage area that is inaccessible currently.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_GetObjectInfo1(TEE_ObjectHandle object, TEE_ObjectInfo *objectInfo);
|
||||
|
||||
/**
|
||||
* @brief 使用初始化对象将TEE_Attribute赋值给未初始化的对象
|
||||
* @brief Assigns the <b>TEE_Attribute</b> of an initialized object to an uninitialized object.
|
||||
*
|
||||
* 该函数使用初始化对象将TEE_Attribute赋值给未初始化的对象,相当于将srcobject的TEE_Attribute复制到destobject中\n
|
||||
* 两个对象的TEE_Attribute类型和编号必须匹配
|
||||
* This function populates an uninitialized object with <b>TEE_Attribute</b>.
|
||||
* That is, it copies <b>TEE_Attribute</b> of <b>srcobject</b> to <b>destobject</b>.
|
||||
* The <b>TEE_Attribute</b> types and IDs of the two objects must match.
|
||||
*
|
||||
* @param destObject [IN]要分配的未初始化的TEE_ObjectHandle
|
||||
* @param srcObject [IN]初始化的TEE_ObjectHandle用于给另一个对象赋值
|
||||
* @param destObject Indicates the uninitialized object.
|
||||
* @param srcObject Indicates the initialized object.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return TEE_ERROR_CORRUPT_OBJECT 文件损坏,文件句柄将被关闭
|
||||
* @return TEE_ERROR_STORAGE_NOT_AVAILABLE 无法访问文件所在的存储区域
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_CORRUPT_OBJECT</b> if the object is corrupted and the object handle will be closed.
|
||||
* @return Returns <b>TEE_ERROR_STORAGE_NOT_AVAILABLE</b> if the object is stored
|
||||
* in a storage area that is inaccessible currently.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_CopyObjectAttributes1(TEE_ObjectHandle destObject, TEE_ObjectHandle srcObject);
|
||||
|
||||
/**
|
||||
* @brief 限制对象的objectUse位
|
||||
* @brief Restricts the <b>objectUse</b> bit of an object.
|
||||
*
|
||||
* 此位决定对象中密钥的使用情况。取值范围为“使用量_常量”。对于参数objectUse的标志位:\n
|
||||
* 如果此位设置为1,则对象的使用标志不会改变\n
|
||||
* 当该参数设置为0时,清除该对象对应的对象使用标志。\n
|
||||
* 新创建的对象将包含所有的使用量_常量,并且使用量标志只能清除,不能设置
|
||||
* This bit determines the usage of the key in the object. The value range is <b>Usage_Constant</b>.
|
||||
* The bit in the <b>objectUse</b> parameter can be set as follows: \n
|
||||
* If it is set to <b>1</b>, the corresponding usage flag in the object is left unchanged. \n
|
||||
* If it is set to <b>0</b>, the corresponding usage flag in the object is cleared. \n
|
||||
* The newly created object contains all <b>Usage_Constant</b>, and the usage flag can be cleared only.
|
||||
*
|
||||
* @param object [IN]需要限制的TEE_ObjectHandle
|
||||
* @param objectUsage [IN]用户希望更改的objectUsage
|
||||
* @param object Indicates the <b>TEE_ObjectHandle</b> of the target object.
|
||||
* @param objectUsage Indicates the new object usage.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return TEE_ERROR_CORRUPT_OBJECT 文件损坏,文件句柄将被关闭
|
||||
* @return TEE_ERROR_STORAGE_NOT_AVAILABLE 无法访问文件所在的存储区域
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_CORRUPT_OBJECT</b> if the object is corrupted and the object handle will be closed.
|
||||
* @return Returns <b>TEE_ERROR_STORAGE_NOT_AVAILABLE</b> if the object is stored
|
||||
* in a storage area that is inaccessible currently.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_RestrictObjectUsage1(TEE_ObjectHandle object, uint32_t objectUsage);
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
#include "tee_defines.h"
|
||||
|
||||
/*
|
||||
* below definitions are defined by Global Platform or Platform SDK released previously
|
||||
* for compatibility:
|
||||
* don't make any change to the content below
|
||||
* The definitions below are defined by Global Platform or Platform SDK released previously
|
||||
* for compatibility.
|
||||
* Do not make any change to the content below.
|
||||
*/
|
||||
typedef enum {
|
||||
TEE_PROPSET_UNKNOW = 0,
|
||||
@@ -30,157 +30,158 @@ typedef enum {
|
||||
typedef uint32_t TEE_PropSetHandle;
|
||||
|
||||
/*
|
||||
* performs a lookup in a property set to retrieve an individual
|
||||
* property and convert its value into a printable string
|
||||
* @brief Obtains a property from a property set and converts its value into a printable string.
|
||||
*
|
||||
* @param propsetOrEnumerator [IN] One of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator
|
||||
* @param name [IN] Pointer to the zero-terminated string containing name of the property to retrieve
|
||||
* @param valueBuffer [OUT] Output buffer for the property value
|
||||
* @param valueBufferLen [IN/OUT] Output buffer length
|
||||
*
|
||||
* @return TEE_SUCCESS operation success
|
||||
* @return TEE_ERROR_ITEM_NOT_FOUND cannot find target property
|
||||
* @return TEE_ERROR_SHORT_BUFFER the value buffer is not large enough to hold the whole property value
|
||||
* @param propsetOrEnumerator Indicates one of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator.
|
||||
* @param name Indicates the pointer to the zero-terminated string containing the name of the property to obtain.
|
||||
* @param valueBuffer Indicates the pointer to the buffer for holding the property value obtained.
|
||||
* @param valueBufferLen Indicates the pointer to the buffer length.
|
||||
*
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_ITEM_NOT_FOUND</b> if the target property cannot be obtained.
|
||||
* @return Returns <b>TEE_ERROR_SHORT_BUFFER</b> if the value buffer is too small to hold the property value obtained.
|
||||
*/
|
||||
TEE_Result TEE_GetPropertyAsString(TEE_PropSetHandle propsetOrEnumerator, const char *name, char *valueBuffer,
|
||||
size_t *valueBufferLen);
|
||||
|
||||
/*
|
||||
* retrieves a single property in a property set and converts its value to a Boolean
|
||||
* @brief Obtains a property from a property set and converts its value into a Boolean value.
|
||||
*
|
||||
* @param propsetOrEnumerator [IN] One of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator
|
||||
* @param name [IN] Pointer to the zero-terminated string containing name of the property to retrieve
|
||||
* @param value [OUT] A pointer to the variable that will contain the value of the property
|
||||
* @param propsetOrEnumerator Indicates one of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator.
|
||||
* @param name Indicates the pointer to the zero-terminated string containing the name of the property to obtain.
|
||||
* @param value Indicates the pointer to the variable that holds the property value obtained.
|
||||
*
|
||||
* @return TEE_SUCCESS operation success
|
||||
* @return TEE_ERROR_ITEM_NOT_FOUND cannot find target property
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_ITEM_NOT_FOUND</b> if the target property cannot be obtained.
|
||||
*/
|
||||
TEE_Result TEE_GetPropertyAsBool(TEE_PropSetHandle propsetOrEnumerator, const char *name, bool *value);
|
||||
|
||||
/*
|
||||
* retrieves a single property in a property set and converts its value to a 32-bit unsigned integer
|
||||
* @brief Obtains a property from a property set and converts its value into a 32-bit unsigned integer.
|
||||
*
|
||||
* @param propsetOrEnumerator [IN] One of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator
|
||||
* @param name [IN] Pointer to the zero-terminated string containing name of the property to retrieve
|
||||
* @param value [OUT] A pointer to the variable that will contain the value of the property
|
||||
* @param propsetOrEnumerator Indicates one of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator.
|
||||
* @param name Indicates the pointer to the zero-terminated string containing the name of the property to obtain.
|
||||
* @param value Indicates the pointer to the variable that holds the property value obtained.
|
||||
*
|
||||
* @return TEE_SUCCESS operation success
|
||||
* @return TEE_ERROR_ITEM_NOT_FOUND cannot find target property
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_ITEM_NOT_FOUND</b> if the target property cannot be obtained.
|
||||
*/
|
||||
TEE_Result TEE_GetPropertyAsU32(TEE_PropSetHandle propsetOrEnumerator, const char *name, uint32_t *value);
|
||||
|
||||
#if defined(API_LEVEL) && (API_LEVEL >= API_LEVEL1_2)
|
||||
/*
|
||||
* retrieves a single property in a property set and converts its value to a 64-bit unsigned integer
|
||||
* @brief Obtains a property from a property set and converts its value into a 64-bit unsigned integer.
|
||||
*
|
||||
* @param propsetOrEnumerator [IN] One of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator
|
||||
* @param name [IN] Pointer to the zero-terminated string containing name of the property to retrieve
|
||||
* @param value [IN/OUT] A pointer to the variable that will contain the value of the property
|
||||
* @param propsetOrEnumerator Indicates one of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator.
|
||||
* @param name Indicates the pointer to the zero-terminated string containing the name of the property to obtain.
|
||||
* @param value Indicates the pointer to the variable that holds the property value obtained.
|
||||
*
|
||||
* @return TEE_SUCCESS operation success
|
||||
* @return TEE_ERROR_ITEM_NOT_FOUND cannot find target property
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_ITEM_NOT_FOUND</b> if the target property cannot be obtained.
|
||||
*/
|
||||
TEE_Result TEE_GetPropertyAsU64(TEE_PropSetHandle propsetOrEnumerator, const char *name, uint64_t *value);
|
||||
#endif // API_LEVEL
|
||||
|
||||
/*
|
||||
* retrieves an individual property and converts its value into a binary block
|
||||
* @brief Obtains a property from a property set and converts its value into a binary block.
|
||||
*
|
||||
* @param propsetOrEnumerator [IN] One of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator
|
||||
* @param name [IN] Pointer to the zero-terminated string containing name of the property to retrieve
|
||||
* @param valueBuffer [OUT] Output buffer for the property value
|
||||
* @param valueBufferLen [IN/OUT] Output buffer length
|
||||
* @param propsetOrEnumerator Indicates one of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator.
|
||||
* @param name Indicates the pointer to the zero-terminated string containing the name of the property to obtain.
|
||||
* @param valueBuffer Indicates the pointer to the buffer for holding the property value obtained.
|
||||
* @param valueBufferLen Indicates the pointer to the buffer length.
|
||||
*
|
||||
* @return TEE_SUCCESS operation success
|
||||
* @return TEE_ERROR_ITEM_NOT_FOUND cannot find target property
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_ITEM_NOT_FOUND</b> if the target property cannot be obtained.
|
||||
* @return TEE_ERROR_SHORT_BUFFER the value buffer is not large enough to hold the whole property value
|
||||
*/
|
||||
TEE_Result TEE_GetPropertyAsBinaryBlock(TEE_PropSetHandle propsetOrEnumerator, const char *name, void *valueBuffer,
|
||||
size_t *valueBufferLen);
|
||||
|
||||
/*
|
||||
* retrieves a single property in a property set and converts its value to TEE_UUID struct
|
||||
* @brief Obtains a property from a property set and converts its value to the <b>TEE_UUID</b> struct.
|
||||
*
|
||||
* @param propsetOrEnumerator [IN] One of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator
|
||||
* @param name [IN] Pointer to the zero-terminated string containing name of the property to retrieve
|
||||
* @param value [OUT] A pointer to the variable that will contain the value of the property
|
||||
* @param propsetOrEnumerator Indicates one of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator.
|
||||
* @param name Indicates the pointer to the zero-terminated string containing the name of the property to obtain.
|
||||
* @param value Indicates the pointer to the variable that holds the property value obtained.
|
||||
*
|
||||
* @return TEE_SUCCESS operation success
|
||||
* @return TEE_ERROR_ITEM_NOT_FOUND cannot find target property
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_ITEM_NOT_FOUND</b> if the target property cannot be obtained.
|
||||
*/
|
||||
TEE_Result TEE_GetPropertyAsUUID(TEE_PropSetHandle propsetOrEnumerator, const char *name, TEE_UUID *value);
|
||||
|
||||
/*
|
||||
* retrieves a single property in a property set and converts its value to TEE_Identity struct
|
||||
* @brief Obtains a property from a property set and converts its value to the <b>TEE_Identity</b> struct.
|
||||
*
|
||||
* @param propsetOrEnumerator [IN] One of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator
|
||||
* @param name [IN] Pointer to the zero-terminated string containing name of the property to retrieve
|
||||
* @param value [OUT] A pointer to the variable that will contain the value of the property
|
||||
* @param propsetOrEnumerator Indicates one of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator.
|
||||
* @param name Indicates the pointer to the zero-terminated string containing the name of the property to obtain.
|
||||
* @param value Indicates the pointer to the variable that holds the property value obtained.
|
||||
*
|
||||
* @return TEE_SUCCESS operation success
|
||||
* @return TEE_ERROR_ITEM_NOT_FOUND cannot find target property
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_ITEM_NOT_FOUND</b> if the target property cannot be obtained.
|
||||
*/
|
||||
TEE_Result TEE_GetPropertyAsIdentity(TEE_PropSetHandle propsetOrEnumerator, const char *name, TEE_Identity *value);
|
||||
|
||||
/*
|
||||
* allocates a property enumerator object
|
||||
* @brief Allocates a property enumerator object.
|
||||
*
|
||||
* @param enumerator [OUT] A pointer filled with an opaque handle on the property enumerator
|
||||
* @param enumerator Indicates the pointer to the property enumerator filled with an opaque handle.
|
||||
*
|
||||
* @return TEE_SUCCESS operation success
|
||||
* @return TEE_ERROR_OUT_OF_MEMORY not enough resources to allocate the property enumerator
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_OUT_OF_MEMORY</b> if there is no enough resources to allocate the property enumerator.
|
||||
*/
|
||||
TEE_Result TEE_AllocatePropertyEnumerator(TEE_PropSetHandle *enumerator);
|
||||
|
||||
/*
|
||||
* deallocates a property enumerator object
|
||||
* @brief Releases a property enumerator object.
|
||||
*
|
||||
* @param enumerator [IN] A handle on the enumerator to free
|
||||
* @param enumerator Indicates the handle on the property enumerator to release.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
void TEE_FreePropertyEnumerator(TEE_PropSetHandle enumerator);
|
||||
|
||||
/*
|
||||
* starts to enumerate the properties in an enumerator
|
||||
* @brief Starts to enumerate the properties in an enumerator.
|
||||
*
|
||||
* @param enumerator [IN] A handle on the enumerator
|
||||
* @param propSet [IN] A pseudo-handle on the property set to enumerate
|
||||
* @param enumerator Indicates the handle on the enumerator.
|
||||
* @param propSet Indicates the pseudo-handle on the property set to enumerate.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
void TEE_StartPropertyEnumerator(TEE_PropSetHandle enumerator, TEE_PropSetHandle propSet);
|
||||
|
||||
/*
|
||||
* resets a property enumerator to its state immediately after allocation
|
||||
* @brief Resets a property enumerator immediately after allocation.
|
||||
*
|
||||
* @param enumerator A handle on the enumerator to reset
|
||||
* @param enumerator Indicates the handle on the enumerator to reset.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
void TEE_ResetPropertyEnumerator(TEE_PropSetHandle enumerator);
|
||||
|
||||
/*
|
||||
* gets the name of the current property in an enumerator
|
||||
* @brief Obtains the name of this property in an enumerator.
|
||||
*
|
||||
* @param enumerator [IN] A handle on the enumerator
|
||||
* @param nameBuffer [OUT] The buffer to be filled with the name
|
||||
* @param nameBufferLen [IN/OUT] The length of buffer to be filled
|
||||
* @param enumerator Indicates the handle on the enumerator.
|
||||
* @param nameBuffer Indicates the pointer to the buffer that stores the property name obtained.
|
||||
* @param nameBufferLen Indicates the pointer to the buffer length.
|
||||
*
|
||||
* @return TEE_SUCCESS operation success
|
||||
* @return TEE_ERROR_ITEM_NOT_FOUND no current property either because the enumerator has not started
|
||||
* or because it has reached the end of the property set
|
||||
* @return TEE_ERROR_SHORT_BUFFER If the name buffer is not large enough to contain the property name
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_ITEM_NOT_FOUND</b> if the property is not found because the enumerator has not started
|
||||
* or has reached the end of the property set.
|
||||
* @return Returns <b>TEE_ERROR_SHORT_BUFFER</b> if the buffer is too small to hold the property name.
|
||||
*/
|
||||
TEE_Result TEE_GetPropertyName(TEE_PropSetHandle enumerator, void *nameBuffer, size_t *nameBufferLen);
|
||||
|
||||
/*
|
||||
* advances the enumerator to the next property
|
||||
* @brief Obtains the next property in an enumerator.
|
||||
*
|
||||
* @param enumerator [IN] A handle on the enumerator
|
||||
* @param enumerator Indicates the handle on the enumerator.
|
||||
*
|
||||
* @return TEE_SUCCESS operation success
|
||||
* @return TEE_ERROR_ITEM_NOT_FOUND enumerator has reached the end of the property set or if it has not started
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_ITEM_NOT_FOUND</b> if the property is not found because the enumerator
|
||||
* has not started or has reached the end of the property set.
|
||||
*/
|
||||
TEE_Result TEE_GetNextProperty(TEE_PropSetHandle enumerator);
|
||||
#endif
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
/**
|
||||
* @file tee_time_api.h
|
||||
*
|
||||
* @brief 安全时间接口
|
||||
* @brief Provides APIs for managing the Trusted Execution Environment (TEE) time.
|
||||
*
|
||||
* 开发者可以使用这些接口实现安全时间相关的功能。
|
||||
* You can use these APIs to implement time-related features in a TEE.
|
||||
*
|
||||
* @since 1
|
||||
*/
|
||||
@@ -32,55 +32,57 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief 获取当前TEE系统时间
|
||||
* @brief Obtains the current TEE system time.
|
||||
*
|
||||
* @param time [OUT]当前系统时间
|
||||
* @param time Indicates the pointer to the current system time obtained.
|
||||
*
|
||||
*/
|
||||
void TEE_GetSystemTime(TEE_Time *time);
|
||||
|
||||
/**
|
||||
* @brief 等待指定的毫秒数
|
||||
* @brief Waits for the specified period of time, in milliseconds.
|
||||
*
|
||||
* @param timeout [IN]指定的毫秒数
|
||||
* @param timeout Indicates the period of time to wait, in milliseconds.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_CANCEL 等待已取消
|
||||
* @return TEE_ERROR_OUT_OF_MEMORY 没有足够的内存来完成操作
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_CANCEL</b> if the wait is canceled.
|
||||
* @return Returns <b>TEE_ERROR_OUT_OF_MEMORY</b> if the memory is not sufficient to complete the operation.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_Wait(uint32_t timeout);
|
||||
|
||||
/**
|
||||
* @brief 检索受信任应用程序的持久时间
|
||||
* @brief Obtains the persistent time of this trusted application (TA).
|
||||
*
|
||||
* @param time [IN]受信任应用程序的持久时间
|
||||
* @param time Indicates the pointer to the persistent time of the TA.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_TIME_NOT_SET 持久时间尚未设置
|
||||
* @return TEE_ERROR_TIME_NEEDS_RESET 永久时间已设置,但可能已损坏,不得再信任
|
||||
* @return TEE_ERROR_OVERFLOW TA持续时间中的秒数超过了uint32_t的范围
|
||||
* @return TEE_ERROR_OUT_OF_MEMORY 没有足够的内存来完成操作
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_TIME_NOT_SET</b> if the persistent time has not been set.
|
||||
* @return Returns <b>TEE_ERROR_TIME_NEEDS_RESET</b> if the persistent time is corrupted and
|
||||
* the application is not longer trusted.
|
||||
* @return Returns <b>TEE_ERROR_OVERFLOW</b> if the number of seconds in the TA persistent time
|
||||
* exceeds the range of <b>uint32_t</b>.
|
||||
* @return Returns <b>TEE_ERROR_OUT_OF_MEMORY</b> if the memory is not sufficient to complete the operation.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_GetTAPersistentTime(TEE_Time *time);
|
||||
|
||||
/**
|
||||
* @brief 设置当前受信任应用程序的持久化时间
|
||||
* @brief Sets the persistent time for this TA.
|
||||
*
|
||||
* @param time [IN]受信任应用程序的持久时间
|
||||
* @param time Indicates the pointer to the persistent time of the TA.
|
||||
*
|
||||
* @return TEE_SUCCESS 成功
|
||||
* @return TEE_ERROR_OUT_OF_MEMORY 没有足够的内存来完成操作
|
||||
* @return TEE_ERROR_STORAGE_NO_SPACE 没有足够的存储空间来完成操作
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_OUT_OF_MEMORY</b> if the memory is not sufficient to complete the operation.
|
||||
* @return Returns <b>TEE_ERROR_STORAGE_NO_SPACE</b> if the storage space is not sufficient to complete the operation.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_SetTAPersistentTime(TEE_Time *time);
|
||||
|
||||
/**
|
||||
* @brief 获取当前REE系统时间
|
||||
* @brief Obtains the current Rich Execution Environment (REE) system time.
|
||||
*
|
||||
* @param time [OUT]当前REE系统时间
|
||||
* @param time Indicates the pointer to the REE system time obtained.
|
||||
*
|
||||
*/
|
||||
void TEE_GetREETime(TEE_Time *time);
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
/**
|
||||
* @file tee_trusted_storage_api.h
|
||||
*
|
||||
* @brief 安全存储接口
|
||||
* @brief Provides trusted storage APIs.
|
||||
*
|
||||
* 开发者可以调用这些接口实现安全存储相关的功能
|
||||
* You can use these APIs to implement trusted storage features.
|
||||
*
|
||||
* @since 1
|
||||
*/
|
||||
@@ -27,15 +27,14 @@
|
||||
#include "tee_object_api.h"
|
||||
|
||||
/**
|
||||
* @brief 数据流定位起始位置选项,用于TEE_SeekObjectData函数
|
||||
* @brief Defines the start position in the data stream associated with an object.
|
||||
* It is used in the <b>TEE_SeekObjectData</b> function.
|
||||
*/
|
||||
enum __TEE_Whence {
|
||||
/** 将起始位置定位为数据流的起始位置 */
|
||||
TEE_DATA_SEEK_SET = 0, /* Position the starting position as the beginning of the data stream */
|
||||
/** 将起始位置定位为当前数据流位置 */
|
||||
TEE_DATA_SEEK_CUR, /* Position the starting position as the current data stream position */
|
||||
/** 将起始位置定位在数据流的末尾 */
|
||||
TEE_DATA_SEEK_END /* Position the starting position at the end of the data stream */
|
||||
|
||||
TEE_DATA_SEEK_SET = 0, /* Set the start position to the beginning of the data stream. */
|
||||
TEE_DATA_SEEK_CUR, /* Set the start position to the current data stream position. */
|
||||
TEE_DATA_SEEK_END /* Set the start position to the end of the data stream. */
|
||||
};
|
||||
|
||||
struct __TEE_ObjectEnumHandle;
|
||||
@@ -44,82 +43,89 @@ typedef struct __TEE_ObjectEnumHandle *TEE_ObjectEnumHandle;
|
||||
typedef uint32_t TEE_Whence;
|
||||
|
||||
/**
|
||||
* @brief 存储ID,定义对应应用的存储空间
|
||||
* @brief Defines the storage ID, which identifies the storage space of the application.
|
||||
*/
|
||||
enum Object_Storage_Constants {
|
||||
/** 为每个应用程序单独使用私有存储空间 */
|
||||
TEE_OBJECT_STORAGE_PRIVATE = 0x00000001, /* Separate private storage space for each application */
|
||||
/** 用于应用程序的单独个人存储空间 */
|
||||
TEE_OBJECT_STORAGE_PERSO = 0x00000002, /* Separate perso storage space for application */
|
||||
/** 添加以实现安全闪存存储 */
|
||||
TEE_OBJECT_SEC_FLASH = 0x80000000, /* Add for secure flash storage */
|
||||
/** 添加用于存储ce */
|
||||
TEE_OBJECT_STORAGE_CE = 0x80000002, /* Add for storage ce */
|
||||
|
||||
TEE_OBJECT_STORAGE_PRIVATE = 0x00000001, /* Separate private storage space for each application. */
|
||||
TEE_OBJECT_STORAGE_PERSO = 0x00000002, /* Separate personal storage space for application. */
|
||||
TEE_OBJECT_SEC_FLASH = 0x80000000, /* Space for secure flash storage. */
|
||||
TEE_OBJECT_STORAGE_CE = 0x80000002, /* Credential encrypted storage space. */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 系统资源约束,如数据流位置指示可以采取的最大值
|
||||
* @brief Defines the system resource constraints, such as the maximum value for the data stream position indicator.
|
||||
*/
|
||||
enum Miscellaneous_Constants {
|
||||
/** 数据流的位置指示符可以占用的最大长度 */
|
||||
TEE_DATA_MAX_POSITION = 0xFFFFFFFF, /* The maximum length that the position indicator of the data stream can take */
|
||||
/** objectID的最大长度,实际扩展到128字节 */
|
||||
TEE_OBJECT_ID_MAX_LEN = 64, /* The maximum length of objectID, which actually extends to 128 bytes */
|
||||
|
||||
TEE_DATA_MAX_POSITION = 0xFFFFFFFF, /* Maximum length that the position indicator of the data stream can take. */
|
||||
TEE_OBJECT_ID_MAX_LEN = 64, /* Maximum length of the object ID, which can extend to 128 bytes. */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 数据流可存储的最大数据字节数
|
||||
* @brief Defines the maximum number of bytes that can be held in a data stream.
|
||||
*/
|
||||
enum TEE_DATA_Size {
|
||||
/** 对象数据流可存储的最大数据字节数 */
|
||||
TEE_DATA_OBJECT_MAX_SIZE = 0xFFFFFFFF /* The maximum bytes of data that the object data stream can store */
|
||||
|
||||
TEE_DATA_OBJECT_MAX_SIZE = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief TEE_ObjectHandle的handleFlags决定了TEE_ObjectHandle对对象数据流的访问权限
|
||||
* @brief Defines the <b>handleFlags</b> of a <b>TEE_ObjectHandle</b>.
|
||||
* The <b>handleFlags</b> determines the access permissions to the data stream associated with the object.
|
||||
*/
|
||||
enum Data_Flag_Constants {
|
||||
/** 对数据流具有读权限,可以读 */
|
||||
/** The data stream can be read. */
|
||||
TEE_DATA_FLAG_ACCESS_READ = 0x00000001,
|
||||
/** 对数据流具有写权限,可以写和截断 */
|
||||
/** The data stream can be written or truncated. */
|
||||
TEE_DATA_FLAG_ACCESS_WRITE = 0x00000002,
|
||||
/** 对数据流具有写入_META权限,可以删除和重命名操作 */
|
||||
/** The data stream can be deleted or renamed. */
|
||||
TEE_DATA_FLAG_ACCESS_WRITE_META = 0x00000004,
|
||||
/** 对数据流具有共享读权限,您可以打开多个TEE_ObjectHandles进行并发读 */
|
||||
/** Multiple TEE_ObjectHandles can be opened for concurrent read. */
|
||||
TEE_DATA_FLAG_SHARE_READ = 0x00000010,
|
||||
/** 对数据流具有共享写入权限,可以打开多个TEE_ObjectHandles并发写入 */
|
||||
/** Multiple TEE_ObjectHandles can be opened for concurrent write. */
|
||||
TEE_DATA_FLAG_SHARE_WRITE = 0x00000020,
|
||||
/** 未使用 */
|
||||
/** Reserved. */
|
||||
TEE_DATA_FLAG_CREATE = 0x00000200,
|
||||
/** 保护同名的现有文件。如果同名文件不存在,则创建新的数据文件;如果同名文件存在,则报错 */
|
||||
/**
|
||||
* Protect the existing file with the same name. Throw an error if the file with the same name exists;
|
||||
* create a data file otherwise.
|
||||
*/
|
||||
TEE_DATA_FLAG_EXCLUSIVE = 0x00000400,
|
||||
/** 保护同名的现有文件。如果同名文件不存在,则创建新的数据文件;如果同名文件存在,则报错 */
|
||||
/**
|
||||
* Protect the existing file with the same name. Throw an error if the file with the same name exists;
|
||||
* create a data file otherwise.
|
||||
*/
|
||||
TEE_DATA_FLAG_OVERWRITE = 0x00000400,
|
||||
/** 如果bit28设置为1,表示AES256,如果为0,表示AES128 */
|
||||
/** Use AES256 if bit 28 is 1; use AES128 if bit 28 is 0. */
|
||||
TEE_DATA_FLAG_AES256 = 0x10000000,
|
||||
/** 如果bit29设置为1,则表示先打开低版本 */
|
||||
/** If bit 29 is set to 1, open the earlier version preferentially. */
|
||||
TEE_DATA_FLAG_OPEN_AESC = 0x20000000,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 创建一个新的持久化对象
|
||||
* @brief Creates a persistent object.
|
||||
*
|
||||
* 创建一个新的持久化对象,可以直接初始化数据流和TEE_Attribute,用户可以使用返回的句柄访问对象的TEE_Attribute和数据流
|
||||
* This function creates a persistent object with initialized <b>TEE_Attribute</b> and data stream.
|
||||
* You can use the returned handle to access the <b>TEE_Attribute</b> and data stream of the object.
|
||||
*
|
||||
* @param storageID [IN]对应于每个应用程序的单独存储空间,值为Object_Storage_Constants
|
||||
* @param ojbectID [IN]对象标识符,要创建的对象的名称
|
||||
* @param objectIDLen [IN]对象标识符的长度(按字节),不超过128字节
|
||||
* @param flags [IN]对象创建后的标志,值可以是Data_Flag_Constant或Handle_Flag_Constant中的一个或多个
|
||||
* @param attributes [IN]临时对象的TEE_ObjectHandle用于初始化对象的TEE_Attribute,可以是TEE_HANDLE_NULL
|
||||
* @param initialData [IN]初始化数据,用于初始化数据流数据
|
||||
* @param initialDataLen [IN]初始数据长度(以字节为单位)
|
||||
* @param object [OUT]函数执行成功后返回的TEE_ObjectHandle
|
||||
* @param storageID Indicates the storage to use. The value is specified by <b>Object_Storage_Constants</b>.
|
||||
* @param ojbectID Indicates the pointer to the object identifier, that is, the name of the object to create.
|
||||
* @param objectIDLen Indicates the length of the object identifier, in bytes. It cannot exceed 128 bytes.
|
||||
* @param flags Indicates the flags of the object created. The value can be
|
||||
* one or more of <b>Data_Flag_Constants</b> or <b>Handle_Flag_Constants</b>.
|
||||
* @param attributes Indicates the <b>TEE_ObjectHandle</b> of a transient object from which to take
|
||||
* <b>TEE_Attribute</b>. It can be <b>TEE_HANDLE_NULL</b> if the persistent object contains no attribute.
|
||||
* @param initialData Indicates the pointer to the initial data used to initialize the data stream data.
|
||||
* @param initialDataLen Indicates the length of the initial data, in bytes.
|
||||
* @param object Indicates the pointer to the <b>TEE_ObjectHandle</b> returned
|
||||
* after the function is successfully executed.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return TEE_ERROR_ITEM_NOT_FOUND storageID不存在
|
||||
* @return TEE_ERROR_ACCESS_CONFLICT 访问冲突
|
||||
* @return TEE_ERROR_OUT_OF_MEMORY 内存不足,无法完成操作
|
||||
* @return TEE_ERROR_STORAGE_NO_SPACE 没有足够的空间来创建对象
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_ITEM_NOT_FOUND</b> if the storage specified by <b>storageID</b> does not exist.
|
||||
* @return Returns <b>TEE_ERROR_ACCESS_CONFLICT</b> if an access conflict occurs.
|
||||
* @return Returns <b>TEE_ERROR_OUT_OF_MEMORY</b> if the memory is not sufficient to complete the operation.
|
||||
* @return Returns <b>TEE_ERROR_STORAGE_NO_SPACE</b> if there is no enough space to create the object.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_CreatePersistentObject(uint32_t storageID, const void *ojbectID, size_t objectIDLen, uint32_t flags,
|
||||
@@ -127,186 +133,199 @@ TEE_Result TEE_CreatePersistentObject(uint32_t storageID, const void *ojbectID,
|
||||
TEE_ObjectHandle *object);
|
||||
|
||||
/**
|
||||
* @brief 打开现有的永久对象
|
||||
* @brief Opens an existing persistent object.
|
||||
*
|
||||
* 打开现有的永久对象,用户可以使用返回的句柄访问对象的TEE_Attribute和数据流
|
||||
* The handle returned can be used to access the <b>TEE_Attribute</b> and data stream of the object.
|
||||
*
|
||||
* @param storageID [IN]对应于每个应用程序的单独存储空间,值为Object_Storage_Constants
|
||||
* @param ojbectID [IN]对象标识符,要打开的对象的名称
|
||||
* @param objectIDLen [IN]对象标识符的长度(按字节),不超过128字节
|
||||
* @param flags [IN]对象打开后的标志,值可以是Data_Flag_Constants或Handle_Flag_Constants中的一个或多个
|
||||
* @param object[OUT]函数执行成功后返回的TEE_ObjectHandle
|
||||
* @param storageID Indicates the storage to use. The value is specified by <b>Object_Storage_Constants</b>.
|
||||
* @param ojbectID Indicates the pointer to the object identifier, that is, the name of the object to open.
|
||||
* @param objectIDLen Indicates the length of the object identifier, in bytes. It cannot exceed 128 bytes.
|
||||
* @param flags Indicates the flags of the object opened.
|
||||
* The value can be one or more of <b>Data_Flag_Constants</b> or <b>Handle_Flag_Constants</b>.
|
||||
* @param object Indicates the pointer to the <b>TEE_ObjectHandle</b> returned
|
||||
* after the function is successfully executed.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return TEE_ERROR_ITEM_NOT_FOUND storageID不存在或找不到对象标识符
|
||||
* @return TEE_ERROR_ACCESS_CONFLICT 访问冲突
|
||||
* @return TEE_ERROR_OUT_OF_MEMORY 内存不足,无法完成操作
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_ITEM_NOT_FOUND</b> if the storage specified by <b>storageID</b> does not exist
|
||||
* or the object identifier cannot be found in the storage.
|
||||
* @return Returns <b>TEE_ERROR_ACCESS_CONFLICT</b> if an access conflict occurs.
|
||||
* @return Returns <b>TEE_ERROR_OUT_OF_MEMORY</b> if the memory is not sufficient to complete the operation.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_OpenPersistentObject(uint32_t storageID, const void *ojbectID, size_t objectIDLen, uint32_t flags,
|
||||
TEE_ObjectHandle *object);
|
||||
|
||||
/**
|
||||
* @brief 从对象的数据流读取数据的大小字节到缓冲区
|
||||
* @brief Reads data from the data stream associated with an object into the buffer.
|
||||
*
|
||||
* 从对象的数据流读取数据的大小字节到缓冲区,TEE_ObjectHandle需要使用TEE_DATA_FLAG_ACCESS_READ权限打开
|
||||
* The <b>TEE_ObjectHandle</b> of the object must have been opened with the <b>TEE_DATA_FLAG_ACCESS_READ</b> permission.
|
||||
*
|
||||
* @param ojbect [IN]要读取的TEE_ObjectHandle
|
||||
* @param buffer [OUT]存储读数据的缓冲区
|
||||
* @param size [IN]按字节读取的数据大小
|
||||
* @param count [OUT]按字节实际读取的数据大小
|
||||
* @param ojbect Indicates the <b>TEE_ObjectHandle</b> of the object to read.
|
||||
* @param buffer Indicates the pointer to the buffer used to store the data read.
|
||||
* @param size Indicates the number of bytes to read.
|
||||
* @param count Indicates the pointer to the variable that contains the number of bytes read.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return TEE_ERROR_OUT_OF_MEMORY 内存不足,无法完成操作
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_OUT_OF_MEMORY</b> if the memory is not sufficient to complete the operation.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_ReadObjectData(TEE_ObjectHandle ojbect, void *buffer, size_t size, uint32_t *count);
|
||||
|
||||
/**
|
||||
* @brief 将数据从缓冲区写入对象的数据流的大小字节
|
||||
* @brief Writes bytes from the buffer to the data stream associated with an object.
|
||||
*
|
||||
* 将数据从缓冲区写入对象的数据流的大小字节,TEE_ObjectHandle需要使用TEE_DATA_FLAG_ACCESS_WRITE权限打开
|
||||
* The <b>TEE_ObjectHandle</b> must have been opened with the <b>TEE_DATA_FLAG_ACCESS_WRITE</b> permission.
|
||||
*
|
||||
* @param ojbect [IN]要写入的TEE_ObjectHandle
|
||||
* @param buffer [IN]存储要写入的数据
|
||||
* @param size [IN]要写入的数据长度,大小不超过4096字节
|
||||
* @param ojbect Indicates the <b>TEE_ObjectHandle</b> of the object.
|
||||
* @param buffer Indicates the pointer to the buffer that stores the data to be written.
|
||||
* @param size Indicates the number of bytes to be written. It cannot exceed 4096 bytes.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return TEE_ERROR_OUT_OF_MEMORY 内存不足,无法完成操作
|
||||
* @return TEE_ERROR_STORAGE_NO_SPACE 没有足够的空间来执行操作
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_OUT_OF_MEMORY</b> if the memory is not sufficient to complete the operation.
|
||||
* @return Returns <b>TEE_ERROR_STORAGE_NO_SPACE</b> if the storage space is not sufficient to complete the operation.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_WriteObjectData(TEE_ObjectHandle ojbect, const void *buffer, size_t size);
|
||||
|
||||
/**
|
||||
* @brief 更改数据流的大小
|
||||
* @brief Changes the size of a data stream.
|
||||
*
|
||||
* 如果大小小于当前数据流的大小,则删除所有多余的字节。如果大小大于当前数据流的大小,则使用“0”扩展TEE_ObjectHandle\n
|
||||
* 需要具有TEE_DATA_FLAG_ACCESS_WRITE权限打开
|
||||
* If the size is less than the current size of the data stream, all bytes beyond <b>size</b> are deleted. If the size
|
||||
* is greater than the current size of the data stream, add 0s at the end of the stream to extend the stream.
|
||||
* The object handle must be opened with the <b>TEE_DATA_FLAG_ACCESS_WRITE</b> permission.
|
||||
*
|
||||
* @param object [IN]要截断的TEE_ObjectHandle
|
||||
* @param size [IN]数据流的新长度,大小不超过4096字节
|
||||
* @param object Indicates the <b>TEE_ObjectHandle</b> of the object.
|
||||
* @param size Indicates the new size of the data stream. It cannot exceed 4096 bytes.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return TEE_ERROR_STORAGE_NO_SPACE 没有足够的空间来执行操作
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_STORAGE_NO_SPACE</b> if the storage space is not sufficient to complete the operation.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_TruncateObjectData(TEE_ObjectHandle object, size_t size);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* 设置TEE_ObjectHandle指向的数据流位置
|
||||
* @brief Sets the position of the data stream to which <b>TEE_ObjectHandle</b> points.
|
||||
*
|
||||
* 设置TEE_ObjectHandle指向的数据流位置,将数据流位置设置为:起始位置+偏移量参数wherece控制偏移量的起始位置,\n
|
||||
* 该值可以在TEE_Whence中选择,含义如下:\n
|
||||
* TEE_DATA_SEEK_SET,数据流偏移量的起始位置为文件头,为0\n
|
||||
* TEE_DATA_SEEK_CUR,数据流偏移的起始位置为当前位置\n
|
||||
* TEE_DATA_SEEK_END,数据流偏移量的起始位置是文件的末尾当参数偏移量为正数时,它向后偏移,当参数偏移量为负数时,它向前偏移。
|
||||
* The data position indicator is determined by the start position and an offset together.
|
||||
* The <b>whence</b> parameter determines the start position. Its value is set in <b>TEE_Whence</b> as follows:
|
||||
* <b>TEE_DATA_SEEK_SET = 0</b>: The start position is the beginning of the data stream.
|
||||
* <b>TEE_DATA_SEEK_CUR</b>: The start position is the current position of the data stream.
|
||||
* <b>TEE_DATA_SEEK_END</b>: The start position is the end of the data stream.
|
||||
* If the parameter <b>offset</b> is a positive number, the data position is moved forward.
|
||||
* If <b>offset</b> is a negative number, the data position is moved backward.
|
||||
*
|
||||
* @param object [IN]需要设置的TEE_ObjectHandle
|
||||
* @param offset [IN]数据流位置移动的大小,大小不超过4096字节
|
||||
* @param whence [IN]数据流偏移量的初始位置
|
||||
* @param object Indicates the <b>TEE_ObjectHandle</b> of the object.
|
||||
* @param offset Indicates the number of bytes to move the data position. It cannot exceed 4096 bytes.
|
||||
* @param whence Indicates the start position in the data stream to calculate the new position.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return TEE_ERROR_OVERFLOW 该操作导致位置指示器的值超过其系统限制TEE_DATA_MAX_POSIT
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_OVERFLOW</b> if the position indicator resulting from this operation
|
||||
* is greater than <b>TEE_DATA_MAX_POSIT</b>.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_SeekObjectData(TEE_ObjectHandle object, int32_t offset, TEE_Whence whence);
|
||||
|
||||
/**
|
||||
* @brief 同步打开的TEE_ObjectHandle并同步相应的安全属性文件到磁盘
|
||||
* @brief Synchronizes the opened <b>TEE_ObjectHandle</b> and the corresponding security attribute file to the disk.
|
||||
*
|
||||
* @param object [IN]需要同步的TEE_ObjectHandle
|
||||
* @param object Indicates the <b>TEE_ObjectHandle</b> of the object.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_SyncPersistentObject(TEE_ObjectHandle object);
|
||||
|
||||
/**
|
||||
* @brief 更改对象标识符
|
||||
* @brief Changes the object identifier.
|
||||
*
|
||||
* 需要使用TEE_DATA_FLAG_ACCESS_WRITE_META权限打开TEE_ObjectHandle
|
||||
* The <b>TEE_ObjectHandle</b> must have been opened with the <b>TEE_DATA_FLAG_ACCESS_WRITE_META</b> permission.
|
||||
*
|
||||
* @param object [IN/OUT]要修改的对象句柄
|
||||
* @param newObjectID [IN]新对象标识符
|
||||
* @param newObjectIDLen [IN]新对象标识符长度
|
||||
* @param object Indicates the handle of the target object.
|
||||
* @param newObjectID Indicates the pointer to the new object identifier.
|
||||
* @param newObjectIDLen Indicates the length of the new object identifier.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_RenamePersistentObject(TEE_ObjectHandle object, void *newObjectID, size_t newObjectIDLen);
|
||||
|
||||
/**
|
||||
* @brief 分配未初始化对象枚举器的句柄
|
||||
* @brief Allocates a handle on an uninitialized object enumerator.
|
||||
*
|
||||
* @param obj_enumerator [OUT]指向新创建的对象枚举器句柄的指针
|
||||
* @param obj_enumerator Indicates the pointer to the handle of the newly created object enumerator.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return TEE_ERROR_OUT_OF_MEMORY 没有足够的内存来分配
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_OUT_OF_MEMORY</b> if the memory is not sufficient to complete the operation.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_AllocatePersistentObjectEnumerator(TEE_ObjectEnumHandle *obj_enumerator);
|
||||
|
||||
/**
|
||||
* @brief 释放已分配的对象枚举器句柄。
|
||||
* @brief Releases all resources associated with an object enumerator handle.
|
||||
*
|
||||
* 函数调用后句柄失效,所有分配的句柄都被释放,与TEE_AllocatePersistentObjectEnumerator配对使用
|
||||
* After this function is called, the object handle is no longer valid and all resources associated with
|
||||
* the object enumerator handle will be reclaimed.
|
||||
* <b>TEE_FreePersistentObjectEnumerator</b> and <b>TEE_AllocatePersistentObjectEnumerator</b>are used in pairs.
|
||||
*
|
||||
* @param obj_enumerator [IN]待发布的TEE_ObjectEnumHandle
|
||||
* @param obj_enumerator Indicates the <b>TEE_ObjectEnumHandle</b> to release.
|
||||
*
|
||||
*/
|
||||
void TEE_FreePersistentObjectEnumerator(TEE_ObjectEnumHandle obj_enumerator);
|
||||
|
||||
/**
|
||||
* @brief 将临时对象枚举器重置为其初始状态,即分配后的状态
|
||||
* @brief Resets an object enumerator handle to its initial state after allocation.
|
||||
*
|
||||
* @param obj_enumerator [IN]需要重置的对象枚举器的TEE_ObjectEnumHandle
|
||||
* @param obj_enumerator Indicates the <b>TEE_ObjectEnumHandle</b> of the object enumerator to reset.
|
||||
*
|
||||
*/
|
||||
void TEE_ResetPersistentObjectEnumerator(TEE_ObjectEnumHandle obj_enumerator);
|
||||
|
||||
/**
|
||||
* @brief 开始枚举给定存储空间中的所有对象
|
||||
* @brief Starts the enumeration of all the objects in the given trusted storage.
|
||||
*
|
||||
* 对象的信息可以通过TEE_GetNextPersistentObject函数获取
|
||||
* The object information can be obtained by using <b>TEE_GetNextPersistentObject</b>.
|
||||
*
|
||||
* @param obj_enumerator [IN]分配的对象枚举器TEE_ObjectEnumHandle
|
||||
* @param storage_id [IN]对应于每个应用程序的单独存储空间,值为Object_Storage_Constants,\n
|
||||
* 目前仅支持TEE_STORAGE_PRIVATE
|
||||
* @param obj_enumerator Indicates the <b>TEE_ObjectEnumHandle</b> of the object enumerator.
|
||||
* @param storage_id Indicates the storage, in which the objects are enumerated.
|
||||
* The value is specified by <b>Object_Storage_Constants</b>.
|
||||
* Currently, only <b>TEE_STORAGE_PRIVATE</b> is supported.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return TEE_ITEM_NOT_FOUND storageID不是TEE_STORAGE_PRIVATE或者存储空间中没有对象
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ITEM_NOT_FOUND</b> if <b>storageID</b> is not <b>TEE_STORAGE_PRIVATE</b>
|
||||
* or there is no object in the specified storage.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_StartPersistentObjectEnumerator(TEE_ObjectEnumHandle obj_enumerator, uint32_t storage_id);
|
||||
|
||||
/**
|
||||
* @brief 获取对象枚举器中的下一个对象
|
||||
* @brief Obtains the next object in the object enumerator.
|
||||
*
|
||||
* 返回对象的TEE_ObjectInfo、objectID、objectIDLen信息
|
||||
* Information such as <b>TEE_ObjectInfo</b>, <b>objectID</b>, and <b>objectIDLen</b> will be obtained.
|
||||
*
|
||||
* @param obj_enumerator [IN]初始化对象枚举器TEE_ObjectEnumHandle
|
||||
* @param object_info [IN]存储获取到的TEE_ObjectInfo结构体指针
|
||||
* @param object_id [IN]缓冲区指针,用于存储获取的objectID
|
||||
* @param object_id_len[IN]用于存储获取到的对象IDLen
|
||||
* @param obj_enumerator Indicates the <b>TEE_ObjectEnumHandle</b> of the object enumerator.
|
||||
* @param object_info Indicates the pointer to the obtained<b>TEE_ObjectInfo</b>.
|
||||
* @param object_id Indicates the pointer to the buffer used to store the obtained <b>objectID</b>.
|
||||
* @param object_id_len Indicates the pointer to the <b>objectIDLen</b>.
|
||||
*
|
||||
* @param TEE_SUCCESS 指示函数已成功执行
|
||||
* @param TEE_ITEM_NOT_FOUND 枚举器没有对象或枚举器尚未初始化
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @param Returns <b>TEE_ITEM_NOT_FOUND</b> if the object enumerator has no element
|
||||
* or the enumerator has not been initialized.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_GetNextPersistentObject(TEE_ObjectEnumHandle obj_enumerator,
|
||||
TEE_ObjectInfo *object_info, void *object_id, size_t *object_id_len);
|
||||
|
||||
/**
|
||||
* @brief 关闭打开的TEE_ObjectHandle并删除对象
|
||||
* @brief Closes a <b>TEE_ObjectHandle</b> and deletes the object.
|
||||
*
|
||||
* 该对象是持久对象,并且需要使用TEE_DATA_FLAG_ACCESS_WRITE_META权限打开
|
||||
* The object must be a persistent object, and the object handle must have been opened with
|
||||
* the <b>TEE_DATA_FLAG_ACCESS_WRITE_META</b> permission.
|
||||
*
|
||||
* @param object [IN]需要关闭和删除的TEE_ObjectHandle
|
||||
* @param object Indicates the object handle to close.
|
||||
*
|
||||
* @return TEE_SUCCESS 指示函数已成功执行
|
||||
* @return TEE_ERROR_STORAGE_NOT_AVAILABLE 无法访问文件所在的存储区域
|
||||
* @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
|
||||
* @return Returns <b>TEE_ERROR_STORAGE_NOT_AVAILABLE</b> if the object is stored
|
||||
* in a storage area that is inaccessible currently.
|
||||
*
|
||||
*/
|
||||
TEE_Result TEE_CloseAndDeletePersistentObject1(TEE_ObjectHandle object);
|
||||
|
||||
Reference in New Issue
Block a user