/** @file  ISWHash.idl */

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

/** @cond */
interface ISWHash {
/** @endcond */

  /**
   * @addtogroup ISWHash
   * @{
   */

  /** @cond */
  const int32 ALGO_SHA1 = 1;
  const int32 ALGO_SHA224 = 2;
  const int32 ALGO_SHA256 = 3;
  const int32 ALGO_SHA384 = 4;
  const int32 ALGO_SHA512 = 5;
  const int32 ALGO_MD5 = 6;
  const int32 ALGO_SM3 = 7;
  const int32 ALGO_SHAKE128 = 8;
  const int32 ALGO_SHAKE256 = 9;
  const int32 ALGO_SHA3_224 = 10;
  const int32 ALGO_SHA3_256 = 11;
  const int32 ALGO_SHA3_384 = 12;
  const int32 ALGO_SHA3_512 = 13;
  const int32 ALGO_INVALID = 99;
  /** @endcond */

  /**
    Initializes hash context based on requested hash
    algorithm and acceleration engine. If engine parameter
    is passed as zero, the default engine will be used.
    The default engine is defined in UCLIB configuration file.

    @param[in] hash type enumerated in UCLIB_HASH_ALG

    @return
    Object_OK -- Successful. \n
    Object_ERROR -- Any error encountered.
  */
  method init(in int32 algo);

  /**
    Hashes data into the hash context.
    Also used for absorb operation for XOF functions

    @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);

  /**
    Squeeze step of XOF Hash. Squeezes arbitraily many bytes
    The max digest length returned is equal to the squeeze rate.

    @param[out] digest Message digest hash.

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

  /**
    Squeeze step of XOF Hash. Squeezes full blocks of
    rate bytes each. Can be called multiple times
    to keep squeezing

    @param[out] digest Message digest hash.

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

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

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

  /**
    Computes the digest hash value with the input data.

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

    @return
    Object_OK -- Successful. \n
    Object_ERROR -- Any error encountered.
  */
  method hash(in buffer plain, out buffer digest);
 
  /** @} */ /* end_addtogroup ISWHash */
};
