hu_HMACSHA1Msg()

Generates a MAC tag of the specified length for the given data using HMAC-SHA-1.

Synopsis:

#include "husha1.h"
 
int hu_HMACSHA1Msg(size_t keyLen, const unsigned char *key, sb_YieldCtx yieldCtx, size_t dataBlkLen, const unsigned char *dataBlk, size_t tagLen, unsigned char *tag, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

keyLen

The length (in bytes) of the key.

key

The key value.

yieldCtx

Ignored.

dataBlkLen

The length (in bytes) of the data.

dataBlk

The data buffer.

tagLen

The length (in bytes) of MAC tag. This value must be between SB_HMAC_SHA1_80_TAG_LEN and SB_HMAC_SHA1_160_TAG_LEN, inclusive.

tag

The MAC tag buffer.

sbCtx

A global context.

Library:

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

Description:

Note: Yielding is not supported for message digest operations.

Note: This function should only be called for data that can be stored entirely in memory.

Returns:

SB_ERR_NULL_KEY

The key value is NULL.

SB_ERR_NULL_INPUT_BUF

The data buffer is NULL.

SB_ERR_BAD_OUTPUT_BUF_LEN

The tag buffer length is invalid.

SB_ERR_NULL_OUTPUT_BUF

The tag buffer is NULL.

SB_FAIL_ALLOC

Memory allocation failure.

SB_SUCCESS

Success.