Performing Elliptic Curve Operations

Step 1: Create

Declare a variable to be B_ALGORITHM_OBJ. As defined in the function prototype in Chapter 4 of the Reference Manual, its address is the argument for B_CreateAlgorithmObject:

B_ALGORITHM_OBJ buildTable = (B_ALGORITHM_OBJ)NULL_PTR;

if ((status = B_CreateAlgorithmObject(&buildTable)) != 0) break;

Step 2: Set

Step 2a: Retrieve the elliptic curve parameters

Because you are generating an acceleration table corresponding to a particular elliptic curve, you need to retrieve the elliptic curve parameters and place them in the algorithm object. Assume that you have gone through the steps to generate an elliptic curve and you have stored the parameters in the algorithm object ecParamsObj. See “Retrieving Elliptic Curve Parameters” on page 264 for more details:

A_EC_PARAMS *cryptocECParamInfo;

A_EC_PARAMS ecParamInfo;

if ((status = B_GetAlgorithmInfo((POINTER *)&cryptocECParamInfo, ecParamsObj, AI_ECParameters)) != 0)

break;

if ((status = AllocAndCopyECParamInfo(&ecParamInfo, cryptocECParamInfo)) != 0)

break;

Step 2b: Format the information

You must put the information you retrieved into the proper format. The Reference Manual Chapter 2 entry for AI_ECBuildAcceleratorTable says that you must supply

apointer to a B_EC_PARAMS structure to B_SetAlgorithmInfo:

typedef struct {

B_INFO_TYPE parameterInfoType;

POINTER parameterInfoValue;

}B_EC_PARAMS;

2 7 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 296
Image 296
RSA Security 5.2.2 manual Retrieve the elliptic curve parameters, Format the information