Chapter 7 Public-Key Operations 299
Performing Elliptic Curve Operations
Step 1: Create
First, create the algorithm object that will hold the information necessary to perform
the encryption operation:
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:
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 page273 and placed the information in
accelerationTableItem
:
Now, pass this information into your algorithm object:
B_ALGORITHM_OBJ ecESEncrypt = (B_ALGORITHM_OBJ)NULL_PTR;
if ((status = B_CreateAlgorithmObject (&ecESEncrypt)) != 0)
break;
if ((status = B_SetAlgorithmInfo
(ecESEncrypt, AI_EC_ES, NULL_PTR)) != 0)
break;
ITEM accelerationTableItem;
if ((status = B_SetAlgorithmInfo
(ecESEncrypt, AI_ECAcceleratorTable,
(POINTER)&accelerationTableItem)) != 0)
break;