/*
 * Copyright (c) 2016 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: Mar 17, 2016
 * Author: Oleksii Kachkan <o.kachkan@samsung.com>
 * Brief: Module that responds for attk key managment.
 */


#ifndef TIGERATTK_H_
#define TIGERATTK_H_

#include "TigerTci.h"
#include "TigerTypeDynamicBuf.h"
#include "TigerKeyDataStore.h"

/**
 * @brief Unwrap ATTK key data, parse it and store it in RPMB.
 * @param[in] wrappedDrkData - encrypted by DRK trustlet data.
 * @param[in] dataSize       - data size.
 * @return status of the operation, e.g. TEE_SUCCESS on success.
 */
TEE_Result saveAttestationKey(IN const TciDrkDataMessage_t* wrappedDrkData);

/**
 * @brief store attk into RPMB.
 * @param[in] keyData  - plain key blob
 * @param[in] keyLength - blob size.
 * @return status of the operation, e.g. TEE_SUCCESS on success.
 */
TEE_Result saveAttk(const uint8_t* keyData, const uint32_t keyLength);

/**
 * @brief Load ATTK data from RPMB.
 * @param[io] keyPair - Attestation key pair.
 * @param[in] useNextAttk - flag indicates load next copy of Attk.
 * @return status of the operation, e.g. TEE_SUCCESS on success.
 */
TEE_Result loadAttestationKey(IN OUT TigerKeyPair_t* keyPair, bool useNextAttk);


#endif /* TIGERATTK_H_ */
