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

/** @cond */
interface ILicenseImage {
/** @endcond */

    /**
     @addtogroup ILicenseImage
     @{
    */
    
    /** @cond */

    /* ILicenseImage Error Codes */
    error INVALID_PARAMETERS;
    error DECRYPT_ERROR;

    /** @endcond */

    /**
      Decrypt segment and calculate hash if required.
     
      @param[in]   segmentID    ID of the segment in the elf image.
      @param[in]   segmentIn    Encrypted segment.
      @param[out]  segmentOut   Decrypted segment.
      @param[out]  segmentHash  Hash of the segment.
     
      @detdesc
      This method decrypts encrypted segment of elf file. Decrypted segment and its hash 
      are returned in segmentOut & segmentHash respectively.
      
      @return
      Object_OK if successful.
    */
    method decryptSegment(in uint32 segmentID,
            in buffer segmentIn, out buffer segmentOut, out buffer segmentHash);
    
    /** @} */ /* end_addtogroup ILicenseImage */
};

/** @cond */
interface ILicenseManager {
/** @endcond */

    /**
     @addtogroup ILicenseManager
     @{
    */

    /** @cond */

    /* ILicenseManager Error Codes */
    error INVALID_PARAMETERS;
    error UNKNOWN_CLIENT;
    error UNSUPPORTED;
    error CONFIG_ERROR;
    error LOAD_KEY_ERROR;
    error PERMISSION_ERROR;
    
    /**
      ClientIDs for decryptImage
    */
    const uint32 DOLBY_DSP = 1;
    const uint32 DOLBY_ARM = 2;
    
    /** @endcond */

    /**
      Decrypt an ELF Image.
     
      @param[in]   clientID     ID of the client.
      @param[in]   params       Header segment of the elf image to be decryted.
      @param[out]  image        \link ILicenseImage \endlink

      @detdesc
      This method initializes Decryption context with header segment data of an elf image. 
      Same decrypt context will be used during decryption of segments of elf file.
      
      @return
      Object_OK if successful.
    */
    method decryptImage(in uint32 clientID, in buffer params, out ILicenseImage image);

    /** @} */ /* end_addtogroup ILicenseManager */
};