hu_HMACSHA256TagGet()

Generates a MAC tag without destroying the HMAC-SHA-256 context.

Synopsis:

#include "husha2.h"
 
int hu_HMACSHA256TagGet(sb_Context hmacContext, size_t tagLen, unsigned char *tag, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

hmacContext

HMAC-SHA-256 context pointer.

tagLen

MAC tag length in bytes. This value must be between SB_HMAC_SHA256_256_TAG_LEN (32) and SB_HMAC_SHA256_128_TAG_LEN (16) inclusive.

tag

MAC tag buffer.

sbCtx

SB context or memory callback data.

Library:

libhuapi (For the qcc command, use the -l huapi option to link against this library)

Description:

Sufficient buffer space for MAC tag must be supplied.

Returns:

SB_ERR_NULL_CONTEXT

Context is NULL.

SB_ERR_BAD_CONTEXT

Context is invalid.

SB_ERR_BAD_OUTPUT_BUF_LEN

Length of the tag buffer is greater than SB_HMAC_SHA256_256_TAG_LEN or less than SB_HMAC_SHA256_128_TAG_LEN.

SB_ERR_NULL_OUTPUT_BUF

Tag buffer is NULL.

SB_SUCCESS

Success.