Skip to content

Latest commit

 

History

History
56 lines (36 loc) · 1.17 KB

GUID-A7331860-E143-4EA3-B7E7-C3615B3A041A.md

File metadata and controls

56 lines (36 loc) · 1.17 KB

CRYPT_ECC_DHE_KeyMake Function

Parent topic:MPLAB® Harmony Crypto Library

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

Parameters Description
ecc Pointer to context which saves state between calls.
rng Pointer to the context for the random number generator.
keySz The 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);