Performing Elliptic Curve Operations
274 RSA BSAFE Crypto-C Developers Guide
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:
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:
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
a pointer to a B_EC_PARAMS structure to B_SetAlgorithmInfo:
B_ALGORITHM_OBJ buildTable = (B_ALGORITHM_OBJ)NULL_PTR;
if ((status = B_CreateAlgorithmObject(&buildTable)) != 0)
break;
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;
typedef struct {
B_INFO_TYPE parameterInfoType;
POINTER parameterInfoValue;
} B_EC_PARAMS;