/*
 * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Created in Samsung Ukraine R&D Center (SRK) under a contract between
 * LLC "Samsung Electronics Ukraine Company" (Kiev, Ukraine)
 * and "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
 *
 * Created on: June 15, 2017
 * Author: Oleksii Kachkan <o.kachkan@samsung.com>
 * Brief: Module that responds for communication auth module(fingerprint Ta).
 */

#ifndef TIGERAUTH_H_
#define TIGERAUTH_H_

#include "TzwCommon.h"

#define AUTH_KEY_LENGTH (32)
#define MAX_BIO_EXT_DATA_SIZE (128)
#define MAX_BIO_AUTH_VALID_TIME_IN_SECOND (3)
/**
 * @brief Get AES key from authhat TA (In case QCOM unwrap it, if Blowfish get it from device).
 * @param[in] wrappedKey - buffer, contains a header and MAC obtained from authhat TA. (NULL in case of Blowfish)
 * @param[in] wrappedKeySize - buffer length(zero in case of Blowfish).
 * @param[io] authKey - AES sec key or will be set by zero in case of error.
 * @param[io] authKeySize - auth key size.
 * @return status of the operation, e.g. TEE_SUCCESS on success.
 */
TEE_Result setUpAuthKey(const uint8_t* wrappedKey, const uint32_t wrappedKeySize,
                        uint8_t* authKey, const uint32_t authKeySize);

/**
 * @brief Obtain real FID and fpIndex from fingerprint module.
 * @param[io] realFid - real FID
 * @param[io] realFidSize - real FID size
 * @param[io] fpIndex - current FP index
 * @param[io] challenge - challenge
 * @return status of the operation, e.g. TEE_SUCCESS on success
 */
TEE_Result getLatestAuthResult(IN OUT uint8_t* realFid, OUT uint32_t* realFidSize,
                               OUT uint32_t* fpIndex, OUT uint64_t* challenge);

#endif
