Performing Elliptic Curve Operations

Step 5: Generate

This function may take a while, so you should use a surrender function. See “The Surrender Context” on page 118. B_GenerateParameters places the newly-generated elliptic curve parameters in ecParamsObj:

generalSurrenderContext.Surrender = GeneralSurrenderFunction; generalSurrenderContext.handle = (POINTER)&generalFlag; generalSurrenderContext.reserved = NULL_PTR;

generalFlag = 0;

if ((status = B_GenerateParameters(paramGenObj, ecParamsObj, randomAlgorithm, &generalSurrenderContext)) != 0)

break;

Step 6: Destroy

Destroy all algorithm objects that are no longer necessary. However, do not destroy ecParamsObj until you have retrieved and stored the parameters. See “Retrieving Elliptic Curve Parameters” on page 264 for more information. Destroy ecParamsObj when it is no longer needed:

B_DestroyAlgorithmObject (¶mGenObj);

B_DestroyAlgorithmObject (&randomAlgorithm);

Retrieving Elliptic Curve Parameters

Once you have your elliptic curve parameters in an algorithm object, you need to be able to retrieve those parameters in an accessible form. Once you have retrieved your parameters, you can store the information or print it out. You also need to retrieve the elliptic curve parameters from the algorithm object when you generate acceleration tables.

This section outlines two application-specific procedures, AllocAndCopyECParamInfo and FreeECParamInfo, that are used to retrieve and store information. These procedures are referred to in subsequent sections.

To retrieve information from an algorithm object, call B_GetAlgorithmInfo with an appropriate AI. The only AI listed in the Reference Manual that allows you to set or retrieve the parameters is AI_ECParameters:

2 6 4

R S A B S A F E C r y p t o - C D e v e l o p e r ’s G u i d e

Page 286
Image 286
RSA Security 5.2.2 manual Retrieving Elliptic Curve Parameters, GeneralFlag =