hu_AESXTSIVSet()

Sets the IV for XTS mode.

Synopsis:

#include "huaes.h"
 
int hu_AESXTSIVSet(size_t unitNo, sb_Uint32 blockIndex, size_t ivLen, unsigned char *iv, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

unitNo

Data Unit Sequence Number to start.

blockIndex

Block index to start in a Data Unit. The value shall not be equal to or larger than 2^20.

ivLen

The byte length of the IV. This value must be SB_AES_128_BLOCK_BYTES (=16).

iv

The IV value.

sbCtx

A global context.

Library:

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

Description:

This function does not consider the size of a data unit. Therefore, if the block index supplied to this function exceeds the size of the data unit, it will be detected by the calls to hu_AESBegin(), hu_AESBeginV2() or hu_AESCtxReset().

Block index in a data unit starts at 0.

Returns:

SB_ERR_BAD_INPUT

Block index is invalid.

SB_ERR_NULL_KEY_LEN

ivLen is NULL.

SB_ERR_BAD_INPUT_BUF_LEN

The iv buffer length is invalid.