hu_ARC2BeginV2()

Creates an ARC2 context initialized with the given parameters, with the ability to override the mode in the parameters, and key that can later be used for encryption and/or decryption.

Synopsis:

#include "huarc2.h"
 
int hu_ARC2BeginV2(sb_Params arc2Params, sb_Key arc2Key, int mode, size_t ivLen, const unsigned char *iv, sb_Context *arc2Context, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

arc2Params

An ARC2 parameters object.

arc2Key

An ARC2 key object.

mode

The mode of operation. The acceptable values are SB_ARC2_ECB, SB_ARC2_CBC, SB_ARC2_CFB64 and SB_ARC2_OFB64. Specifying 0 will use the mode from the parameters object.

ivLen

The length (in bytes) of the initial vector. The only acceptable value is SB_ARC2_IV_SIZE.

iv

The initial vector.

arc2Context

The ARC2 context object pointer.

sbCtx

A global context.

Library:

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

Description:

An initial vector, iv, is required for the SB_ARC2_CBC, SB_ARC2_CFB64 and SB_ARC2_OFB64 modes of operation. iv is ignored for SB_ARC2_ECB, as an initial vector is not required for that mode.

Returns:

SB_ERR_NULL_PARAMS

The arc2Params parameters object is NULL.

SB_ERR_BAD_PARAMS

The tag for the params object is not of the expected type.

SB_ERR_NULL_KEY

The arc2Key key object is NULL.

SB_ERR_BAD_KEY

The arc2Key key object is invalid.

SB_ERR_NULL_IV

The initial vector, iv, is NULL.

SB_ERR_BAD_IV_LEN

ivLen is an invalid initial vector length.

SB_ERR_NULL_CONTEXT_PTR

The arc2Context context object pointer is NULL.

SB_ERR_NO_MODE

No mode has been specified.

SB_FAIL_ALLOC

Memory allocation failure.

SB_SUCCESS

Success.