43.3.7.2 Point Addition

Purpose

This service is used to perform a point addition, based on a given elliptic curve over GF(2n).

Please note that this service is not intended to add the same point twice. In this particular case, use the doubling service (see Point Doubling).

How to Use the Service

Description

The operation performed is:

PtC = PtA + PtB

In this computation, the following parameters need to be provided:

  • Point A the input point is filled in projective coordinates (X,Y,Z) (pointed by {nu1PointABase,3*u2ModLength + 12}). This point can be the Infinite Point.
  • Point B the input point is filled in projective coordinates (X,Y,Z) (pointed by {nu1PointBBase,3*u2ModLength + 12}). This point can be the Infinite Point.
  • Cns the Fast Modular Constant filled (pointed by {nu1CnsBase,u2ModLength + 12})
  • P the modulus filled (pointed by {nu1ModBase,u2ModLength + 4})
  • The a parameter relative to the elliptic curve equation (pointed by {nu1ABase,u2ModLength + 4})
  • The workspace not initialized (pointed by {nu1WorkSpace, 7*u2ModLength + 40}

The resulting C point is represented in projective coordinates (X,Y,Z) and is stored at the same place than the input point A. This Point can be the Infinite Point.

The services for this operation are:
  • Service GF2NEccAddFast: The fast mode is used, the fast modular reduction is used in the computations.
Important: Before using this service, ensure that the constant Cns has been calculated with the setup of the Modular Reductions service.

Parameters Definition

Table 43-94. GF2NEccAddFast Service Parameters
ParameterTypeDirectionLocationData LengthBefore Executing the ServiceAfter Executing the Service
nu1ModBasenu1ICrypto RAMu2ModLength + 4Base of Modulus PBase of Modulus P
nu1CnsBasenu1ICrypto RAMu2ModLength + 12Base of CnsBase of Cns
u2ModLengthu2ILength of moduloLength of modulo
nu1PointABasenu1I/OCrypto RAM3*u2ModLength + 12Input point A (projective coordinates)Resulting point C (projective coordinates)
nu1PointBBasenu1ICrypto RAM3*u2ModLength + 12Input point B (projective coordinates)Input point B
nu1ABBasenu1ICrypto RAMu2ModLength + 4Parameter a of the elliptic curveUnchanged
nu1Workspacenu1ICrypto RAM7*u2ModLength + 40Corrupted workspace

Code Example

PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;
//Depending on the function the Random Number Generator
//must be initialized and started
//following the directives given for the RNG on the chip
PUKCL(u2Option) = 0;
PUKCL_GF2NEccAdd(nu1ModBase) = <Base of the ram location of P>;
PUKCL_GF2NEccAdd(nu1CnsBase) = <Base of the ram location of Cns>;
PUKCL_GF2NEccAdd(u2ModLength) = <Byte length of P>;
PUKCL_GF2NEccAdd(nu1PointABase) = <Base of the ram location of the A point>;
PUKCL_GF2NEccAdd(nu1PointBBase) = <Base of the ram location of the B point>;
PUKCL_GF2NEccAdd(nu1ABBase) = <Base of the ram location of the a Parameter>;
PUKCL_GF2NEccAdd(nu1Workspace) = <Base of the ram location of the workspace>;
. . .
// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library...
vPUKCL_Process(GF2NEccAddFast, pvPUKCLParam);
if (PUKCL(u2Status) == PUKCL_OK)
               {
               ...
               }
else // Manage the error

Constraints

No overlapping between either input and output are allowed The following conditions must be avoided to ensure the service works correctly:

  • nu1ModBase,nu1CnsBase, nu1PointABase, nu1PointBBase, nu1ABBase, nu1Workspace are not aligned on 32-bit boundaries
  • {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength+ 12}, {nu1PointBBase, 3*u2ModLength + 12}, {nu1ABase,u2ModLength + 4}, {nu1Workspace, <WorkspaceLength>} are not in Crypto RAM
  • u2ModLength is either: < 12, > 0xffc or not a 32-bit length
  • All overlapping between {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength +8}, {nu1PointABase, 3*u2ModLength + 12}, {nu1PointBBase, 3*u2ModLength + 12}, {nu1ABase,u2ModLength + 4} and {nu1Workspace, 5*u2ModLength + 32}

Status Returned Values

Table 43-95. GF2NEccAddFast Service Return Codes
Returned StatusImportanceMeaning
PUKCL_OKThe computation passed without errors.