hu_IDLCDHParamsSet()

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

Synopsis:

#include "huidlc.h"
 
int hu_IDLCDHParamsSet(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 length (in bits) of the prime modulus p. The length must be greater than or equal to 512.

qSize

The length (in bits) of the prime divisor q, if using. Otherwise, the length (in bits) of the private keys.

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. (Optional)

q

Prime divisor of p-1. (Optional)

rngCtx

An RNG context. (Optional - set to NULL if key generation will not be performed.)

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 DH.

An RNG context and/or yielding context must be supplied if key generation and/or yielding will be performed, respectively.

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.

q is optional. If q is not supplied, then qSize specifies the size of private keys to be used with these parameters. In this case, if qSize is set to zero, the default size of 160 bits will be used.

Returns:

SB_ERR_NULL_PARAMS_PTR

The idlcParams object pointer is NULL.

SB_ERR_BAD_INPUT

The length 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.