RSA Security 5.2.2 If status = output-order.data == Nullptr != 0 break, Aecparams ecParamInfo

Models: 5.2.2

1 376
Download 376 pages 13.91 Kb
Page 289
Image 289

Performing Elliptic Curve Operations

output->order.len = input->order.len; output->order.data = T_malloc(output->order.len);

if ((status = (output->order.data == NULL_PTR)) != 0) break;

T_memcpy(output->order.data, input->order.data, output->order.len);

output->cofactor.len = input->cofactor.len; output->cofactor.data = T_malloc(output->cofactor.len); if ((status = (output->cofactor.data == NULL_PTR)) != 0)

break;

T_memcpy(output->cofactor.data, input->cofactor.data, output->cofactor.len);

output->pointRepresentation = input->pointRepresentation;

output->fieldElementBits = input->fieldElementBits; } while(0);

if (status != 0)

printf("AllocAndCopyECParamInfo failed with status %i\n", status);

return status;

}

For this example application, use AllocAndCopyECParamInfo() to make a copy of the information that cryptocECParamInfo points to and place that in your own buffer, ecParamInfo:

A_EC_PARAMS ecParamInfo;

if ((status = AllocAndCopyECParamInfo(&ecParamInfo, cryptocECParamInfo)) != 0)

break;

When the information in ecParamInfo is no longer needed, you must remember to free any memory that you allocated:

FreeECParamInfo(&ecParamInfo);

where FreeECParamInfo is a procedure that performs this operation.

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 6 7

Page 289
Image 289
RSA Security 5.2.2 If status = output-order.data == Nullptr != 0 break, Aecparams ecParamInfo, FreeECParamInfo&ecParamInfo