43.3.6.7 Projective to Affine Coordinates Conversion

Purpose

This service is used to perform a point coordinates conversion from projective representation to affine.

How to Use the Service

Description

The operation performed is:

PtXAffinecoordinate=[PtXProjectivecoordinate(PtZProjectivecoordinate)2]
PtYAffinecoordinate=[PtYProjectivecoordinate(PtZProjectivecoordinate)3]

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

  • A the input point is filled in projective coordinates (X,Y,Z) or affine coordinates for X and Y, and setting Z to 1(pointed by {nu1PointABase,3*u2ModLength + 12}). The Point A can be the point at infinity. In this case, the u2Status returned is PUKCL_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, 4*u2ModLength +48}

The result is the point A with its (X,Y) coordinates converted to affine, and the Z coordinate set to 1. The service for this operation is ZpEcConvProjToAffine.

Important: Before using this service, ensure that the constant Cns has been calculated with the Setup of the fast Modular Reductions service.

Parameters Definition

Table 43-77. ZpEccConvAffineToProjective 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
nu1PointABasenu1ICrypto RAM3*u2ModLength + 12Input point AResulting point A in affine coordinates
nu1Workspacenu1ICrypto RAM4*u2ModLength + 48Workspace

Code Example

PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;


PUKCL (u2Option) = 0;

PUKCL _ZpEcConvProjToAffine(nu1ModBase) = <Base of the ram location of P>; 
PUKCL _ZpEcConvProjToAffine(u2ModLength) = <Byte length of P>;
PUKCL _ZpEcConvProjToAffine(nu1CnsBase) = <Base of the ram location of Cns>; 
PUKCL _ZpEcConvProjToAffine(nu1PointABase) = <Base of the ram location of the A point>; 
PUKCL _ZpEcConvProjToAffine(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(ZpEcConvProjToAffine,&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, nu1Workspace are not aligned on 32-bit boundaries
  • {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8},{nu1PointABase, 3*u2ModLength+ 12}, {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} and {nu1Workspace, 4*u2ModLength + 48}

Status Returned Values

Table 43-78. ZpEccConvAffineToProjective Service Return Codes
Returned StatusImportanceMeaning
PUKCL_OKThe computation passed without problem.
PUKCL_POINT_AT_INFINITYWarningThe input point has its Z equal to zero, so it’s a representation of the infinite point.