14 typedef unsigned int TZCRYPT_Result;
15 typedef unsigned char TZCRYPT_UINT8;
16 typedef unsigned int TZCRYPT_UINT32;
17 typedef unsigned long TZCRYPT_UINT64;
21 #define TZCRYPT_SUCCESS 0x00000000
22 #define TZCRYPT_ERROR_INIT_FAILED 0x20000001
23 #define TZCRYPT_ERROR_TERMINATE_FAILED 0x20000002
24 #define TZCRYPT_ERROR_ENCRYPT_FAILED 0x20000003
25 #define TZCRYPT_ERROR_DECRYPT_FAILED 0x20000004
26 #define TZCRYPT_ERROR_WRAPIDENTITY_FAILED 0x20000005
27 #define TZCRYPT_ERROR_UNWRAPIDENTITY_FAILED 0x20000006
28 #define TZCRYPT_ERROR_HASH_FAILED 0x20000007
29 #define TZCRYPT_ERROR_INVALID_PARAMETER 0x20000008
31 /* Sec Crypto error code */
32 #define SEC_CRYPTO_SUCCESS 0x00000000
33 #define SEC_CRYPTO_ENCRYPT_ERROR 0x30000001
34 #define SEC_CRYPTO_DECRYPT_ERROR 0x30000002
35 #define SEC_CRYPTO_WRAPIDENTITY_ERROR 0x30000003
36 #define SEC_CRYPTO_UNWRAPIDENTITY_ERROR 0x30000004
37 #define SEC_CRYPTO_HASH_ERROR 0x30000005
40 * This function provides an encryption of user data.
42 * @param [in] Src : User data to be encrypted
43 * @param [in] SrcLen : Length of user data to be encrypted (multiple by chunk size, SIZE_CHUNK)
44 * @param [out] Dst : Encrypted data
45 * @param [out] *DstLen : a pointer to length of encrypted data (multiple by secure object size, SIZE_SECUREOBJECT)
47 * return TZCRYPT_SUCCESS if operation has been succesfully completed. (Refer to the previous TLC error code)
49 TZCRYPT_Result TzCrypt_Encrypt(TZCRYPT_UINT8 *Src, TZCRYPT_UINT32 SrcLen, TZCRYPT_UINT8 *Dst, TZCRYPT_UINT32 *DstLen);
52 * This function provides an decryption of user data.
54 * @param [in] Src : Cipher data to be decrypted
55 * @param [in] SrcLen : Length of Cipher data to be decrypted (multiple by chunk size, SIZE_SECUREOBJECT)
56 * @param [out] Dst : Encrypted data
57 * @param [out] *DstLen : a pointer to length of encrypted data (multiple by secure object size, SIZE_CHUNK)
59 * return TZCRYPT_SUCCESS if operation has been succesfully completed. (Refer to the tlc error code)
61 TZCRYPT_Result TzCrypt_Decrypt(TZCRYPT_UINT8 *Src, TZCRYPT_UINT32 SrcLen, TZCRYPT_UINT8 *Dst, TZCRYPT_UINT32 *DstLen);
64 * This function provides an hash of user data.
66 * @param [in] Src : Plain information
67 * @param [in] SrcLen : Length of Plain information
68 * @param [out] Dst : Hashed information
69 * @param [out] *DstLen : a pointer to length of hashed information
71 * return TZCRYPT_SUCCESS if operation has been succesfully completed. (Refer to the tlc error code)
73 TZCRYPT_Result TzCrypt_Hash(TZCRYPT_UINT8 *Src, TZCRYPT_UINT32 SrcLen, TZCRYPT_UINT8 *Dst, TZCRYPT_UINT32 *DstLen);
76 * This function provides an wrapping of App data. (+ include hash operation)
78 * @param [in] Src : Plain information
79 * @param [in] SrcLen : Length of Plain information
80 * @param [out] Dst : Wrapped information
81 * @param [out] *DstLen : a pointer to length of wrapped information
83 * return TZCRYPT_SUCCESS if operation has been succesfully completed. (Refer to the tlc error code)
85 TZCRYPT_Result TzCrypt_WrapIdentity(TZCRYPT_UINT8 *Src, TZCRYPT_UINT32 SrcLen, TZCRYPT_UINT8 *Dst, TZCRYPT_UINT32 *DstLen);
88 * This function provides an unwrapping of App data. (- exclude hash operation)
90 * @param [in] Src : Plain information
91 * @param [in] SrcLen : Length of Plain information
92 * @param [out] Dst : Wrapped information
93 * @param [out] *DstLen : a pointer to length of wrapped information
95 * return TZCRYPT_SUCCESS if operation has been succesfully completed. (Refer to the tlc error code)
97 TZCRYPT_Result TzCrypt_UnwrapIdentity(TZCRYPT_UINT8 *Src, TZCRYPT_UINT32 SrcLen, TZCRYPT_UINT8 *Dst, TZCRYPT_UINT32 *DstLen);
100 * This function provides the length of secure object from a given length of source data
102 * @param [in] SrcLen : Length of Plain information
104 * return TZCRYPT_UINT32 (size) if operation has been succesfully completed.
106 TZCRYPT_UINT32 TzCrypt_GetSOLen(TZCRYPT_UINT32 SrcLen);