1.22 CRYPT_ECC_DHE_KeyMake Function

C

int CRYPT_ECC_DHE_KeyMake(
    CRYPT_ECC_CTX* ecc, 
    CRYPT_RNG_CTX* rng, 
    int keySz
);

Description

This function creates a new ECC key.

Preconditions

The context must have been initialized with a call to CRYPT_ECC_Initialize. The random number generator context must have been initialized with a call to CRYPT_RNG_Initialize.

Parameters

ParametersDescription
eccPointer to context which saves state between calls.
rngPointer to the context for the random number generator.
keySzThe size of the key desired.

Returns

  • BAD_FUNC_ARG - An invalid pointer was passed to the function.

  • MEMORY_E - Could not create the memory buffer for the key.

  • 0 - An invalid pointer was not passed to the function.

Remarks

None.

Example

CRYPT_ECC_CTX userA; 
int           ret;
byte          sharedA[100];
unsigned int  aSz = (unsigned int)sizeof(sharedA);
unsigned int  usedA = 0;

ret = CRYPT_ECC_Initialize(&userA);
ret = CRYPT_ECC_DHE_KeyMake(&userA, &mcRng, 32);