Performing Elliptic Curve Operations

Step 2b (Optional): Set Public Key Acceleration Table Info

You can use either the public key acceleration table or the generic acceleration table to accelerate ECDSA verification. Verification using the public key acceleration table is faster than verification using only the generic acceleration table.

ITEM pubKeyAccelTableItem;

Go through the steps in the section “Generating Acceleration Tables” to create a generic acceleration table, placing the table information in aTableItem:

if ((status = B_SetAlgorithmInfo (ecDSAVerify, AI_ECAcceleratorTable, (POINTER)&pubKeyAccelTableItem)) != 0)

break;

Step 3: Init

Associate a key with the algorithm object and provide a chooser that contains the necessary algorithm methods:

if ((status = B_VerifyInit (ecDSAVerify, publicKey, EC_DSA_CHOOSER, (A_SURRENDER_CTX *)NULL_PTR)) != 0)

break;

Step 4: Update

Pass in the original message. It will be internally digested to make a new signature that can be compared with the signature received by B_VerifyFinal:

if ((status = B_VerifyUpdate (ecDSAVerify, dataToSign, dataToSignLen, (A_SURRENDER_CTX *)NULL_PTR)) != 0)

break;

Step 5: Final

Pass in the signature that was received with the message. B_VerifyFinal returns 0 if the signature verifies, or an error if it is an invalid signature:

2 9 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 312
Image 312
RSA Security 5.2.2 manual Optional Set Public Key Acceleration Table Info, Item pubKeyAccelTableItem