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

/** @file  IVMSessionKey.idl */

/** @cond */
interface IVMSessionKey {
/** @endcond */ 

    /**
     * @addtogroup IVMSessionKey
     * @{
     */
     
      /*
     * Error codes
     */
    /** @cond */
    error ERROR_PRNG_FAILED;                   /**< Session Key generation(RNG) failed */
    error ERROR_CRYPTO_FAILED;                 /**< Key Derivation (crypto) failed */
    error ERROR_MAX_SESSIONS;                  /**< Max sessions exhausted by key derivation service */
    error ERROR_IMPROPER_CTXT;                 /**< Key requested for same session ID from same context */
    /** @endcond */

    /**
    Derive a key based on TA distinguished ID, VM unique ID and Session ID.\n
    TA uses this interface for deriving key with VM unique ID, session ID inputs.

    @param[in] sessionID  Used as factor for key derivation and has to be the same as passed by VM
                          to derive the same key.

    @param[in] VMUniqueId Holds the VM unique identifier and used as factor for
                          Key derivation.

    @param[out] outKey    Output buffer to hold the key of desired size.

    @return 
    Object_OK    -  success. \n
    Object_ERROR_SIZE_IN               - Invalid input arguments\n
    Object_ERROR_MEM                   - Memory allocation failure\n
    IVMSessionKey_ERROR_PRNG_FAILED    - Session Key generation failed due to RNG failure\n
    IVMSessionKey_ERROR_CRYPTO_FAILED  - Key Derivation failed due to crypto operation\n
    IVMSessionKey_ERROR_MAX_SESSIONS   - Key Derivation failed due to maximum active sessions\n
    IVMSessionKey_ERROR_IMPROPER_CTXT  - Key request failed as other endpoint has not taken this session key\n
    */
    method derive (in uint32 sessionID, in buffer VMUniqueId, out buffer outKey);

    /** @} */ /* end_addtogroup IVMSessionKey */
};
