Performing Elliptic Curve Operations

Step 1: Create

First, create the algorithm object that will hold the information necessary to perform the encryption operation:

B_ALGORITHM_OBJ ecESEncrypt = (B_ALGORITHM_OBJ)NULL_PTR;

if ((status = B_CreateAlgorithmObject (&ecESEncrypt)) != 0) break;

Step 2: Set

Associate the elliptic curve encryption AI, AI_EC_ES, with the algorithm object. According to the Reference Manual Chapter 2 entry for AI_EC_ES, you should pass NULL_PTR as the third argument to B_SetAlgorithmInfo:

if ((status = B_SetAlgorithmInfo

(ecESEncrypt, AI_EC_ES, NULL_PTR)) != 0)

break;

Step 2b (optional) Acceleration Table

You can use an acceleration table containing precomputed values to speed up encryption. Because users frequently perform encryption, it is worthwhile to use the acceleration table whenever the required memory is available.

To use the acceleration table, assume you have gone through the steps in “Generating a Generic Acceleration Table” on page 273 and placed the information in accelerationTableItem:

ITEM accelerationTableItem;

Now, pass this information into your algorithm object:

if ((status = B_SetAlgorithmInfo

(ecESEncrypt, AI_ECAcceleratorTable, (POINTER)&accelerationTableItem)) != 0)

break;

C h a p t e r 7 P u b l i c - K e y O p e r a t i o n s

2 9 9

Page 321
Image 321
RSA Security 5.2.2 manual Optional Acceleration Table, Now, pass this information into your algorithm object