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

/** @cond */
interface IHmac {
/** @endcond */

  /** @cond */
  const int32 PARAM_KEY  = 1;
  const int32 PARAM_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_SHA3_224 = 28;
  const int32 SIZE_SHA3_256 = 32;
  const int32 SIZE_SHA3_384 = 48;
  const int32 SIZE_SHA3_512 = 64;
  const int32 SIZE_INVALID = -1;

  const int32 DIGEST_SIZE_SHA1 = 20;
  const int32 DIGEST_SIZE_SHA256 = 32;
  const int32 DIGEST_SIZE_SHA384 = 48;
  const int32 DIGEST_SIZE_SHA512 = 64;

  error ERROR_NOT_SUPPORTED;
  /** @endcond */

  /**
   * @addtogroup IHmac
   * @{
   */

  /**
    Updates HMAC per @xhyperref{FIPS198,FIPS PUB 198-1}, using the
    configured hash algorithm.

    @param[in] msg Pointer to message to be authenticated.

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

  /**
    Final operation for HMAC per @xhyperref{FIPS198,FIPS PUB 198-1} using
    the specified hash algorithm.

    @param[out] digest    Pointer to message digest (memory provided by caller).

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

  /**
    Modifies parameters for a given HMAC 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);

  /**
    Modifies parameters for a given HMAC operation.

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

    @return
    Object_OK -- Successful. \n
    Object_ERROR -- Any error encountered.
  */
  method setParamAsObject(in int32 paramID, in interface object);

  /**
    Calculate HMAC per @xhyperref{FIPS198,FIPS PUB 198-1}, using the
    configured hash algorithm and key for the input message.

    @param[in]  msg       Pointer to message to be authenticated.
    @param[out] digest    Pointer to message digest (memory provided by caller).

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

  /** @} */ /* end_addtogroup IHmac */
};
