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

/** @cond */
interface IHash {
/** @endcond */

  /** @cond */
  const int32 PARAM_MODE  = 0;
  const int32 PARAM_HMAC_KEY  = 1;
  const int32 PARAM_SEQ  = 2;
  const int32 PARAM_INVALID = -1;

  const int32 MODE_HASH = 0;
  const int32 MODE_HMAC = 1;
  const int32 MODE_INVALID = -1;

  const int32 SEQ_MODE_FIRST = 0;
  const int32 SEQ_MODE_LAST = 1;
  const int32 SEQ_MODE_INVALID = -1;

  const int32 SIZE_SHA1 = 20;
  const int32 SIZE_SHA256 = 32;
  const int32 SIZE_SHA384 = 48;
  const int32 SIZE_SHA512 = 64;
  const int32 SIZE_INVALID = 0;
  /** @endcond */

  /**
   * @addtogroup IHash
   * @{
   */

  /**
    Hashes data into the hash context.

    @param[in] plain  Plain text message to hash.

    @return
    Object_OK -- Successful. \n
    Object_ERROR -- Any error encountered.
  */
  method update(in buffer plain);

  /**
    Computes the digest hash value.

    @param[out] digest Message digest hash.

    @return
    Object_OK -- Successful. \n
    Object_ERROR -- Any error encountered.
  */
  method final(out buffer digest);

  /**
    Modifies the 32-bit unsigned int parameter value for a given hash operation.

    @param[in] paramID     Parameter to modify.
    @param[in] param       Parameter value to set.

    @return
    Object_OK -- Successful. \n
    Object_ERROR -- Any error encountered.
  */
  method setParamAsU32(in int32 paramID, in uint32 param);

  /**
    Modifies parameter value for a given hash operation.

    @param[in] paramID     Parameter to modify.
    @param[in] param       Parameter value to set.

    @return
    Object_OK -- Successful. \n
    Object_ERROR -- Any error encountered.
  */
  method setParamAsData(in int32 paramID, in buffer param);

  /**
    Performs a simultaneous hash/cipher encrypt operation.

    @param[in]  cipher_obj Cipher context (object).
    @param[in]  plain      Input plaintext buffer.
    @param[out] cipher     Output ciphertext buffer.
    @param[out] digest     Digest to store.

    @return
    Object_OK -- Successful. \n
    Object_ERROR -- Any error encountered.
  */
  method encrypt(in interface cipher_obj, in buffer plain, out buffer cipher, out buffer digest);

  /**
    Performs a simultaneous hash/cipher decrypt operation.

    @param[in] cipher_obj   Cipher context (object).
    @param[in]  cipher      Input ciphertext buffer.
    @param[out]  plain      Output plaintext buffer.
    @param[out] digest      Digest to store.

    @return
    Object_OK -- Successful. \n
    Object_ERROR -- Any error encountered.
  */
  method decrypt(in interface cipher_obj, in buffer cipher, out buffer plain, out buffer digest);

  /**
    Resets hash context; does not reset the key.

    @return
    Object_OK -- Successful. \n
    Object_ERROR -- Any error encountered.
  */
  method reset();

  /** @} */ /* end_addtogroup IHash */
};

