A SERVICE OF

logo

Chapter 7 Public-Key Operations 263
Performing Elliptic Curve Operations
Step 3: Init
You can pass a NULL_PTR for the surrender context, because B_GenerateInit is a
speedy function. For
AI_ECParamGen, Chapter 2 of the Reference Manual indicates
which algorithm methods you need to include in your chooser,
paramGenChooser
:
Because you are using an odd prime, use
AM_ECFP_PARAM_GEN:
Step 4: Update
No Update step is necessary for parameter generation.
B_EC_PARAM_GEN_PARAMS paramGenInfo;
paramGenInfo.version = 0;
paramGenInfo.fieldType = FT_FP;
paramGenInfo.fieldElementBits = 160;
paramGenInfo.pointRepresentation = CI_NO_COMPRESS;
paramGenInfo.minOrderBits = 0;
paramGenInfo.trialDivBound = 0;
if ((status = B_SetAlgorithmInfo(paramGenObj, AI_ECParamGen,
(POINTER)&paramGenInfo)) != 0)
break;
Algorithm methods to include in applications algorithm chooser:
AM_ECFP_PARAM_GEN for odd prime fields and AM_ECF2POLY_PARAM_GEN for even
characteristic.
B_ALGORITHM_METHOD *paramGenChooser[] = {
&AM_ECFP_PARAM_GEN,
&AM_ECF2POLY_PARAM_GEN,
(B_ALGORITHM_METHOD *)NULL_PTR
};
if ((status = B_GenerateInit(paramGenObj, paramGenChooser,
(A_SURRENDER_CTX *)NULL_PTR)) != 0)
break;