hu_RngDrbgCreate()

Creates an DRBG RNG context object with optional personalized String.

Synopsis:

#include "hurandom.h"
 
int hu_RngDrbgCreate(int algId, int securityStrength, int predictiveResistanceFlag, size_t personalizedStringLen, const unsigned char *personalizedString, sb_YieldCtx yieldCtx, sb_RNGCtx *rngCtx, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

algId

DRBG algorithm Identifier. The acceptable values are HU_DRBG_CIPHER, HU_DRBG_EC, HU_DRBG_EC_CERTICOM, HU_DRBG_HASH, and HU_DRBG_HMAC.

securityStrength

Security strength in bits; must be less than or equal to 256. While you can specify any number between 0 and 256, inclusive; internally the value will be rounded up to the four supported strengths: 112, 128, 192, 256.

predictiveResistanceFlag

Future use; set to zero.

personalizedStringLen

The length (in bytes) of personalized string. (Optional - set to zero if not used.)

personalizedString

The intent of the personalization string is to differentiate this DRBG instance from all other instantiations that might be created. It should be set to some bitstring as unique as possible. Examples include: device serial number, public key, user identification, timestamps, network address, application identifiers, protocol version identifiers, random number and nonce. (Optional - set to NULL if not used.)

yieldCtx

A yield context. (Optional - set to NULL if not used.)

rngCtx

An RNG context object pointer.

sbCtx

A global context.

Library:

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

Description:

Returns:

SB_ERR_BAD_ALG

The DRBG algorithm identifier is unknown.

SB_ERR_NULL_CONTEXT_PTR

The RNG context object pointer is NULL.

SB_FAIL_ALLOC

Memory allocation failure.

SB_SUCCESS

Success.