hu_IDLCDSAParamsSet()

Creates an IDLC parameters object from the given IDLC domain parameter values.

Synopsis:

#include "huidlc.h"
 
int hu_IDLCDSAParamsSet(size_t pSize, size_t qSize, size_t pLength, const unsigned char *p, size_t gLength, const unsigned char *g, size_t qLength, const unsigned char *q, sb_RNGCtx rngCtx, sb_YieldCtx yieldCtx, sb_Params *idlcParams, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

pSize

The size (in bits) of the prime modulus p. The size must be greater than or equal to 512.

qSize

The size (in bits) of the prime divisor q. The size must be greater than or equal to 160 and less than pSize.

pLength

The length (in bytes) of the prime modulus.

p

Prime modulus.

gLength

The length (in bytes) of the generator. Must be less than or equal to pLength.

g

Generator of order q.

qLength

The length (in bytes) of the prime divisor.

q

Prime divisor of p-1.

rngCtx

An RNG context.

yieldCtx

A yield context. (Optional - set to NULL if yielding is not required.)

idlcParams

The IDLC parameters object pointer.

sbCtx

A global context.

Library:

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

Description:

This IDLC parameter object can be used for DSA.

An RNG context must be supplied. A yielding context must be supplied if yielding will be performed.

The values should satisfy the following properties: p and q are prime, q is a divisor of (p-1), and g has order q modulo p. The bit length of prime p must be set in pSize and that of prime q in qSize.

Returns:

SB_ERR_NULL_PARAMS_PTR

The idlcParams object pointer is NULL.

SB_ERR_NULL_IDLC_P

The prime modulus value is NULL.

SB_ERR_NULL_IDLC_Q

The prime divisor value is NULL.

SB_ERR_NULL_IDLC_G

The generator value is NULL.

SB_ERR_BAD_INPUT

The bit size of p and/or q is invalid.

SB_ERR_BAD_INPUT_BUF_LEN

The length of the p, q and/or g buffers is invalid.

SB_FAIL_ALLOC

Memory allocation failure.

SB_SUCCESS

Success.