Creates an ANSI X9.31 RNG context object.
#include "hurandom.h"
int hu_RngANSIX931Create(int alg, size_t keyLen, const unsigned char *key, size_t vLen, const unsigned char *v, hu_ReseedCallbackFunc *timeFunc, void *rsourceParam, sb_YieldCtx yieldCtx, sb_RNGCtx *rngCtx, sb_GlobalCtx sbCtx)
BlackBerry 10.0.0
The algorithm to use. The acceptable values are: HU_RNG_X931_ALG_AES and HU_RNG_X931_ALG_3DES.
The length (in bytes) of key. For AES, the acceptable values are: SB_AES_128_KEY_BYTES, SB_AES_192_KEY_BYTES and SB_AES_256_KEY_BYTES. For DES, the acceptable value is: 3*SB_DES_KEY_SIZE.
The symmetric algorithm key.
The length (in bytes) of the initial seed (v). When alg is set to HU_RNG_X931_ALG_AES, the buffer size must be 16 bytes. When alg is set to HU_RNG_X931_ALG_3DES, the buffer size must be 8 bytes.
The initial seed value.
A user-provided callback function. When called, the user is required to fill the buffer with the current time and date.
This is user-defined data that will be passed to seedFunc. (Optional - set to NULL if not used.)
A yield context. (Optional - set to NULL if not used.)
An RNG context object pointer.
A global context.
Any reseeding information in calls to hu_RngReseed() or hu_RngReseedGetBytes() will update the internal v state but will not affect the internal symmetric key.
Note: You must call hu_RngANSIX931Destroy() to destroy the context; the hu_RngDestroy() function cannot destroy an RNG context object created by hu_RngANSIX931Create().
The RNG context object pointer is NULL.
Unacceptable alg.
Unacceptable keyLen.
key is NULL.
seed is NULL.
timeFunc is NULL.
seedLen is less than required.
Success.