//Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
//All rights reserved.
//Confidential and Proprietary - Qualcomm Technologies, Inc. 

 /**
 * IRuntimeAttestation provides an interface to generate attestation report which can be initiated by OEM using an HLOS app.
 * This report should contain data which indicates whether any corruption was found in critical data partitions. This report
 * will contain label, GUID and hashes of all critical data partitions(primary and back up) in SPINOR. Also the report will contain boot 
 * time corruption log from NIST Log framework. This hash can be used by the OEM to compare with an original hash they possess. 
 * If the hashes do not match, it indicates that the partition is corrupted.
 *
 */

/** @cond */
interface IRuntimeAttestation
{
/** @endcond */

  /**
  * @addtogroup IRuntimeAttestation
  * @{
  */

  /* Error codes */
  error ERROR_FAILURE;                              /**< Deprecated and should no longer be used. */
  error ERROR_INVALID_PARAM;                        /**< Deprecated and should no longer be used. */
  error ERROR_STORAGE_ITERATOR_UNAVAILABLE;         /**< Deprecated and should no longer be used. */
  error ERROR_END_STORAGE_ITERATOR_FAILURE;         /**< Returned when failed to close partition iterator. */
  error ERROR_INSUFICIENT_MEMORY;                   /**< Deprecated and should no longer be used. */
  error ERROR_GPT_ENTRY_UNAVAILABLE;                /**< Deprecated and should no longer be used. */
  error ERROR_OPEN_PARTITION_FAILURE;               /**< Returned when unable to open partition. */
  error ERROR_CLOSE_PARTITION_FAILURE;              /**< Returned when unable to close partition. */
  error ERROR_READ_PARTITION_FAILURE;               /**< Returned when unable to read partition. */
  error ERROR_PARTITION_HASH_FAILURE;               /**< Returned when failed to calculate partition hash. */
  error ERROR_QCBOR_ENCODE_FAILURE;                 /**< Returned when failed to encode partition hash info in qcbor format. */
  error ERROR_RELEASE_STORAGE_OBJECT_FAILURE;       /**< Deprecated and should no longer be used. */
  error ERROR_PARTITION_NOT_FOUND;                  /**< Returned when no primary partition found. */
  error ERROR_READ_NISTLOG_FAILURE;                 /**< Returned when unable to read nist log from nistlog framework. */
  error ERROR_ERASE_NISTLOG_FAILURE;                /**< Returned when unable to erase nist log from nistlog partition. */

  /**
  * @brief This method is responsible for calculating the size of the report that is created from an array of
  * hashes representing all critical data partitions, with an attached NIST log at the end. The function returns
  * the size of the report, which is crucial for memory allocation. OEMs should call this method prior
  * to generating the buffer, ensuring that they allocate sufficient memory to accommodate the entire report.
  *
  * @param[out] size    The total size of the report
  *
  * @return 
  * Object_OK if successful. \n
  * Object_ERROR or other error codes on failure.
  */
  method getPartitionHashSize(out uint32 size);

  /** 
  * @brief This method is designed to create a buffer from an array of hashes representing all critical data partitions, 
  * and it appends boot time corruption log from NIST Log framework at the end of the buffer. The purpose
  * of this buffer is to facilitate the generation of reports by the OEMs. By default, the buffer is 
  * formatted in CBor. However, the method also allows the customer to modify the format according to their
  * specific needs, providing flexibility in how the data and logs are presented for report generation.
  *
  * @param[out] data    The data of the report
  *
  * @return 
  * Object_OK if successful. \n
  * Object_ERROR_SIZE_OUT if output length is less than required length. \n
  * Object_ERROR or other error codes on failure.
  */
  method getPartitionHashData(out buffer data);
  
  /** @} */ /* end_addtogroup IRuntimeAttestation */
};
