Chapter 7 Public-Key Operations 279
Performing Elliptic Curve Operations
Step 3: Init
To initialize the proper algorithms, you must supply an algorithm chooser with the
appropriate algorithm methods. See the Reference Manual Chapter 2 entry for
AI_ECBuildPubKeyAccelTable for a list of the appropriate AMs to include in the
chooser:
Step 4: Update
There is no Update step for building acceleration tables.
Step 5: Final
Step 5a: Allocate memory
You must allocate sufficient memory to hold the acceleration table. Use
B_BuildTableGetBufSize to obtain the maximum size of the public key acceleration
table. Then allocate enough space to hold the table:
B_ALGORITHM_METHOD *ecAccelChooser[] = {
&AM_ECFP_BLD_PUB_KEY_ACC_TAB,
&AM_ECF2POLY_BLD_PUB_KEY_ACC_TAB,
(B_ALGORITHM_METHOD *)NULL_PTR
};
if ((status = B_BuildTableInit(buildTable, ecAccelChooser,
(A_SURRENDER_CTX *)NULL_PTR)) != 0)
break;
ITEM pubKeyAccelTableItem;
unsigned int maxTableLen;
if ((status = B_BuildTableGetBufSize(buildTable, &maxTableLen)) != 0)
break;
pubKeyAccelTableItem.data = T_malloc(maxTableLen);
if ((status = (pubKeyAccelTableItem.data == NULL_PTR)) != 0)
break;