43.3.6.9 Randomize a Coordinate

Purpose

This service is used to convert the projective representation of a point to another projective representation.

How to Use the Service

Description

The operation performed is:

Projective(X1, Y1, Z1) → Projective(X2, Y2, Z2)

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

  • The input point is filled in projective coordinates (X,Y,Z) (pointed by {nu1PointBase,3*u2ModLength + 12}). This Point must not be the point at infinity.
  • Cns the Fast Modular Constant filled (pointed by {nu1CnsBase,u2ModLength +8})
  • P the modulus filled (pointed by {nu1ModBase,u2ModLength +4})
  • The workspace not initialized (pointed by {nu1WorkSpace, 3*u2ModLength +28}
  • The random number (pointed by {nu1RandomBase, u2ModLength +4}).

The result is the point nu1PointBase with its (X,Y,Z) coordinates randomized.

The service for this operation is ZpEcRandomiseCoordinate.

Important: Before using this service:
  • Ensure that the constant Cns has been calculated with the setup of the Modular Reduction service.
  • Be sure to follow the directives given for the RNG on the chip you use (particularly initialization, seeding) and compulsorily start the RNG
.

Parameters Definition

Table 43-81. ZpEccRandomiseCoordinate Service Parameters
ParameterTypeDirectionLocationData LengthBefore Executing the ServiceAfter Executing the Service
nu1ModBasenu1ICrypto RAMu2ModLength + 4Base of modulus PBase of modulus P
nu1CnsBasenu1ICrypto RAMu2ModLength + 8Base of CnsBase of Cns
u2ModLengthu2ILength of modulus PLength of modulus P
nu1PointBasenu1ICrypto RAM3*u2ModLength + 12Input pointResulting point
nu1RandomBasenu1ICrypto RAMu2ModLength + 4RandomCorrupted
nu1Workspacenu1ICrypto RAM3*u2ModLength + 28Workspace

Code Example

PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;

// ! The Random Number Generator must be initialized and started
// ! following the directives given for the RNG on the chip

PUKCL (u2Option) = 0;

// Depending on the option specified, not all fields should be filled
PUKCL _ZpEccRandomiseCoordinate(nu1ModBase) = <Base of the ram location of P>; 
PUKCL _ZpEccRandomiseCoordinate(u2ModLength) = <Byte length of P>;
PUKCL _ZpEccRandomiseCoordinate(nu1CnsBase) = <Base of the ram location of Cns>; 
PUKCL_ZpEccRandomiseCoordinate(nu1RandomBase) = <Base of the ram location where the the RNG is stored>;
PUKCL _ZpEccRandomiseCoordinate(nu1PointBase) = <Base of the ram location of the point>; 
PUKCL _ZpEccRandomiseCoordinate(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(ZpEccRandomiseCoordinate,&PUKCLParam); 
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 that the service works correctly:

  • nu1ModBase, nu1CnsBase, nu1PointABase, nu1RandomBase, nu1Workspace are not aligned on 32-bit boundaries
  • {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength + 12}, {nu1RandomBase, 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}, {nu1RandomBase, u2ModLength + 4} and {nu1Workspace, 3*u2ModLength + 28}

Status Returned Values

Table 43-82. ZpEccRandomiseCoordinate Service Return Codes
Returned StatusImportanceMeaning
PUKCL_OKThe computation passed without problem.