37.3.6.5 Fast Multiplying by a Scalar Number of a Point

Purpose

This service is used to multiply a point by an integral constant K on a given elliptic curve over GF(p).

How to Use the Service

Description

These two services process the Multiplying by a scalar number:

PtC = K × PtA

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

  • 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.
  • 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, 8*u2ModLength +44}
  • The a parameter relative to the elliptic curve (pointed by {nu1ABase,u2ModLength +4})
  • K the scalar number (pointed by {nu1ScalarNumber,u2ScalarLength +4})

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

The service name for this operation is ZpEccMulFast. This service uses Fast mode and Fast Modular Reduction for computations.

Note: Before using this service, ensure that the constant Cns has been calculated with the setup of the Fast Modular Reduction service.

Parameters Definition

Table 37-73. ZpEccMulFast Service Parameters
Parameter Type Direction Location Data Length Before Executing the Service After Executing the Service
nu1ModBase nu1 I Crypto RAM u2ModLength + 4 Base of modulus P Base of modulus P
nu1CnsBase nu1 I Crypto RAM u2ModLength + 8 Base of Cns Base of Cns
u2ModLength u2 I Length of modulus P Length of modulus P

nu1KBase

nu1

I

Crypto RAM

u2KLength

Scalar number used to multiply the point A

Unchanged

u2KLength u2 I Length of scalar K Length of scalar K
nu1PointABase nu1 I/O Crypto RAM 3*u2ModLength + 12 Input point A (projective coordinates) Resulting point C (projective coordinates)

nu1ABas

nu1 I Crypto RAM u2ModLength + 4 Parameter a of the elliptic curve Unchanged
nu1Workspace nu1 I Crypto RAM 8*u2ModLength + 44 Corrupted workspace

Code Example

PUKCL_PARAM PUKCLParam;
PPUKCL_PARAM pvPUKCLParam = &PUKCLParam;


PUKCL (u2Option) = 0;

PUKCL _ZpEccMul(nu1ModBase) = <Base of the ram location of P>; 
PUKCL _ZpEccMul(u2ModLength) = <Byte length of P>;
PUKCL _ZpEccMul(nu1CnsBase) = <Base of the ram location of Cns>; 
PUKCL _ZpEccMul(nu1PointABase) = <Base of the ram location of the A point>; 
PUKCL _ZpEccMul(nu1ABase) = <Base of the ram location of the parameter A of the elliptic curve>; 
PUKCL _ZpEccMul(nu1KBase) = <Base of the ram location of the scalar number>; 
PUKCL _ZpEccMul(nu1Workspace) = <Base of the ram location of the workspace>; 
PUKCL_ZpEccMul(u2KLength) = <Byte length of the Scalar Number K>;
...

// vPUKCL_Process() is a macro command, which populates the service name
// and then calls the library...
vPUKCL_Process(ZpEccMulFast,&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, nu1ABase, nu1ScalarNumber, nu1Workspace are not aligned on 32-bit boundaries
  • {nu1ModBase, u2ModLength + 4}, {nu1CnsBase, u2ModLength + 8}, {nu1PointABase, 3*u2ModLength+ 12}, {nu1ABase, u2ModLength + 4}, {nu1ScalarNumber, u2ScalarLength} or {nu1Workspace, 8*u2ModLength + 44} 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}, {nu1ABase, u2ModLength + 4}, {nu1ScalarNumber, u2ScalarLength} and {nu1Workspace, 8*u2ModLength + 44}

Status Returned Values

Returned Status Importance Meaning
PUKCL_OK The computation passed without problem.