hu_MACTagGet()

Computes the MAC value without destroying or changing the state of the MAC context.

Synopsis:

#include "humac.h"
 
int hu_MACTagGet(sb_Context macContext, size_t *tagLen, unsigned char *tag, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

macContext

The MAC context object.

tagLen

The length (in bytes) of the tag.

tag

The MAC output.

sbCtx

A global context.

Library:

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

Description:

To specify the length of the tag value, a pointer to a buffer large enough to hold the tag value should be passed in tag and its length in tagLen. This function will copy the first tagLen bytes of the computed tag into tag. If tagLen is greater than the default tag length, the entire tag value is copied, and the default length of the tag value is set in tagLen.

If tag is NULL, then this function will set the default length of the tag value in tagLen. If tag is not NULL but tagLen is too small, this function will return an error and will also set the default length of the tag value in tagLen.

For HMAC algorithms, the default length of the tag value is the underlying digest's output length. The minimum length of the tag value is half the default length.

Returns:

SB_ERR_NULL_CONTEXT

The macContext object is NULL.

SB_ERR_BAD_CONTEXT

The macContext object is invalid.

SB_ERR_NULL_OUTPUT_BUF_LEN_PTR

The tagLen pointer is NULL.

SB_ERR_BAD_OUTPUT_BUF_LEN

The tagLen value is too small.

Last modified: 2014-05-14



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus