Performing Elliptic Curve Operations

if ((status = B_SetAlgorithmInfo (ecKeyGen, AI_ECAcceleratorTable, (POINTER)&accelTableItem)) != 0)

break;

Step 3: Initialize

Here, you can pass a NULL_PTR for the surrender context, because B_GenerateInit is a speedy function. The Reference Manual entry on AI_ECKeyGen indicates which algorithm methods you need to include in your chooser, keyGenChooser:

B_ALGORITHM_METHOD *keyGenChooser[] = { &AM_ECFP_KEY_GEN, &AM_ECF2POLY_KEY_GEN, (B_ALGORITHM_METHOD *)NULL_PTR

};

if ((status = B_GenerateInit (ecKeyGen, keyGenChooser, (A_SURRENDER_CTX *)NULL_PTR)) != 0)

break;

Step 4: Update

There is no Update step for key generation.

Step 5: Generate

Now you can complete the key-generation operation. Note that you must pass in a properly-initialized random algorithm as the fourth argument:

if ((status = B_GenerateKeypair

(ecKeyGen, publicKey, privateKey, randomAlgorithm, (A_SURRENDER_CTX *)NULL_PTR)) != 0)

break;

Step 6: Destroy

Remember to destroy all key objects and algorithm objects once they are no longer needed:

2 7 0

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 292
Image 292
RSA Security 5.2.2 manual Initialize, There is no Update step for key generation