// Copyright (c) 2022 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.

/** @cond */
interface IRPMBService {
/** @endcond */

  /**
   * @addtogroup IRPMBService
   * @{
   */

  /**
   * Error codes
   */
  /** @cond */
  error ERROR_RPMB_MAC;                    /**<RPMB key not provisioned */
  error ERROR_RPMB_WRITE_COUNTER;          /**<Write counter mismatch during RPMB access */
  error ERROR_RPMB_ADDR;                   /**<RPMB address failure */
  error ERROR_RPMB_WRITE;                  /**<Failure during RPMB write */
  error ERROR_RPMB_READ;                   /**<Failure during RPMB read */
  error ERROR_RPMB_NOT_PROVISIONED;        /**<RPMB not provisioned */
  error ERROR_RPMB_MAC_GENERATION;         /**<Failure during MAC generation */
  error ERROR_RPMB_RNG_GENERATION;         /**<Failure during RNG generation */
  error ERROR_RPMB_NONCE;                  /**<Nounce authentication error */
  error ERROR_RPMB_PROVISIONED;            /**<RPMB already provisioned */

  /**
    Provision RPMB key

    @param[in]  key_type: Type of RPMB key to provision:
                          TZBSP_SD_DEVICE_RPMB_PROVISION_PRODUCTION
                          TZBSP_SD_DEVICE_RPMB_PROVISION_TEST

    @return  Object_OK if successful.
    @return  Object_ERROR_INVALID in case of invalid parameters passed.
    @return  IRPMBSerive_ERROR_RPMB_XXX error based speicific to failure.
    @return  Object_ERROR if unsuccessful otherwise.
   */
  method rpmbProvisionKey(in int32 keyType);

  /**
    Erase RPMB partition by overwriting the entire partition with zeroes.

    @return  Object_OK if successful.
    @return  Object_ERROR_INVALID in case of invalid parameters passed.
    @return  IRPMBSerive_ERROR_RPMB_XXX error based speicific to failure.
    @return  Object_ERROR if unsuccessful otherwise.
   */
  method rpmbErase();

  /**
    This function reads the value of the RPMB write counter.

    @return  Object_OK if successful.
    @return  Object_ERROR_INVALID in case of invalid parameters passed.
    @return  IRPMBSerive_ERROR_RPMB_XXX error based speicific to failure.
    @return  Object_ERROR if unsuccessful otherwise.
   */
  method rpmbCheckProv();

  /** @} */ /* end_addtogroup IRPMBService */

};

