Performing Elliptic Curve Operations

Step 5b: Build the public-key acceleration table

It can take a while to generate the table, so use a surrender function. See “The Surrender Context” on page 118 for more information:

ITEM pubKeyAccelTableItem;

generalSurrenderContext.Surrender = GeneralSurrenderFunction; generalSurrenderContext.handle = (POINTER)&generalFlag; generalSurrenderContext.reserved = NULL_PTR;

generalFlag = 0;

if ((status = B_BuildTableFinal

(buildTable, pubKeyAccelTableItem.data, &(pubKeyAccelTableItem.len), maxTableLen, &generalSurrenderContext)) != 0)

break;

Step 6: Destroy

Zeroize and free all sensitive information when it is no longer needed:

T_memset(pubKeyAccelTableItem.data, 0, pubKeyAccelTableItem.len); T_free(pubKeyAccelTableItem.data); B_DestroyAlgorithmObject(&buildTable);

Performing EC Diffie-Hellman Key Agreement

Performing elliptic curve key agreement is similar to the ordinary Diffie-Hellman key agreement scheme, which allows two parties to obtain the same symmetric key. First, the two parties seeking to generate a secret key need to agree on the elliptic curve parameters. The parameters can be generated by a central authority or by the parties themselves.

The example in this section corresponds to the file ecdh.c.

In this example, the two parties who wish to derive the same secret key are Alice and Bob. Both parties need to be provided with the same parameters:

B_ALGORITHM_OBJ ecParamsObj = (B_ALGORITHM_OBJ)NULL_PTR;

2 8 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 302
Image 302
RSA Security 5.2.2 manual Performing EC Diffie-Hellman Key Agreement, Build the public-key acceleration table