#ifndef __GP_OEM_H__
#define __GP_OEM_H__

#include <tzWrappers/TzwCommon.h>
/**
 * @brief Retrieve unique device ID, the minimum length of returned device ID
 * should be 40 bytes.
 *
 * @param[out] deviceID The buffer that receives the device ID
 * @param[inout] size in bytes, of the buffer that deviceID points to
 *
 * @return TEE_Result
 */
EXTERNC TEE_Result TEE_GetDeviceID(uint8_t * deviceID, uint32_t * size);

/**
 * @brief Sign digest with preset RSA private key
 *
 * @note OEMs should use the below RSA modulus n and private key exponent d
 * during integration test with alipay, the algorithm used when signing the
 * digest should be `TEE_ALG_RSASSA_PKCS1_V1_5_SHA256`. In release version,
 * OEMs should generate a new RSA key pair(RSA 2048). The private key should
 * be kept secretly from being leaked. The public key should be deliverd to
 * alipay in PEM format.
 *
 * @param[in] digest The digest to be signed
 * @param[in] digestLen The length of digest in bytes
 * @param[out] signature The buffer receives the returned signature
 * @param[inout] signatureLen Size, in bytes, of the buffer that signature
 * points to
 *
 * @return TEE_Result
 */
EXTERNC TEE_Result TEE_AuthenticatorSignDigest(void* digest, size_t digestLen,
                                               void* signature,
                                               size_t* signatureLen);
/**
 * @brief Retrieves the version of authenticator
 *
 * This is the version of the private key used by TEE_AuthenticatorSignDigest,
 * which starts from 1. If the private key is leaked, the server will reject
 * that private key according to the version. A new key has to be applied in
 * TEE_AuthenticatorSignDigest and the version should be incremented by 1.
 *
 * @return version
 */
EXTERNC int32_t TEE_GetAuthenticatorVersion(void);

/**
 * @brief Retrieve last identified fingerprint ID from fingerprint sensor
 *
 * @param[out] id fingerprint ID
 *
 * @return TEE_ERROR_TIMEOUT: The function is called after 1 second delay
 * @return TEE_SUCCESS: success
 */
TEE_Result TEE_GetFpLastIdentifiedResult(int32_t *id);

/**
 * @brief This function is implemented by alipay, OEM should invoke this
 * function in TA's entry point.
 *
 * @note OEM should check the validity of the input and output buffer.
 *
 * @param[in] in The exact data from alipay's android application
 * @param[in] in_len The size of the buffer that in points
 * @param[out] out The buffer that receives output
 * @param[inout] out_len Size, in bytes, of the buffer that out points to.
 * Recommended value is 4K.
 *
 * @return TEE_Result
 */
EXTERNC TEE_Result alipay_tz_invoke_command(uint8_t* in, size_t in_len,
                                            uint8_t* out, size_t* out_len);


/**
 * @brief Retrieve enrolled fingerprint id list from fingerprint TA
 * @param : TBD -- waiting fingerPrint TA.
 *
 */
EXTERNC TEE_Result TEE_GetFpList(uint8_t *idList, uint32_t *idListLen);

#endif // IFAA_OEM_H
