Performing Elliptic Curve Operations

typedef struct {

B_INFO_TYPE parameterInfoType;

POINTER parameterInfoValue;

}B_EC_PARAMS;

Because you have the EC parameters in the A_EC_PARAMS structure ecParams, the appropriate AI that describes the data is AI_ECParameters:

B_EC_PARAMS commonECParams; commonECParams.parameterInfoType = AI_ECParameters; commonECParams.parameterInfoValue = (POINTER)&ecParams;

if ((status = B_SetAlgorithmInfo(alice, AI_EC_DHKeyAgree, (POINTER)&commonECParams)) != 0)

break;

Step 2b (optional): Set Acceleration Table Info

If you are using an acceleration table, you need to set the algorithm object with the appropriate acceleration table. Once you have gone through the steps in “Generating Acceleration Tables” on page 273 and have an ITEM structure containing the acceleration table, you can pass a pointer to the ITEM structure as the third argument to B_SetAlgorithmInfo:

if ((status = B_SetAlgorithmInfo (alice, AI_ECAcceleratorTable, (POINTER)&aTableItem)) != 0)

break;

Step 3: Initialize

Initialize the algorithm object to perform the key agreement protocol. The Reference Manual Chapter 2 entry for AI_EC_DHKeyAgree states which algorithm methods to include in your chooser:

B_ALGORITHM_METHOD *EC_DH_CHOOSER[] = { &AM_ECFP_DH_KEY_AGREE, &AM_ECF2POLY_DH_KEY_AGREE, (B_ALGORITHM_METHOD *)NULL_PTR

};

2 8 2

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 304
Image 304
RSA Security 5.2.2 manual Optional Set Acceleration Table Info, Typedef struct