3. Double_fun_ctest_gfp

3.1. Function description:

This demo shows the operation of ECC point doubling using projective coordinate formula for short-weierstrass curve in GF(p).

  • Allocate enough memory space of SRAM used by internal logic during computation.

  • Filling data to address of N, then configure & start INV_N0 operation.

  • Filling data to address of RR, then configure & start MOD operation.

  • Filling data to address of operand a & b for montgomery multiplication operation, then configure & start MontMult operation.

  • Filling data to address of Gx, Gy, Gz, then configure & transfer Gx, Gy, Gz to montmult form.

  • Configure & start ECC point addition for short-weierstrass curve.

  • Configure & transfer to affine coordinates for short-weierstrass curve.

  • Waiting process done to compare the result with the golden data to check.

3.2. Main Configuration:

3.2.1. INV_N0 operation:

Operation code

Field

Data length

Reserved area size

OP_INV_N0

GF(p)

6 words

11 words per variable

Note

Operation code is OP_INV_N0, the operand is N.

3.2.2. MOD operation:

Operation code

Option

Field

Operand a length

Operand b length

OP_MOD

ordinary

GF(p)

15 words

6 words

Note

Operation code is OP_MOD, the operand a is RR, operand b is N.

3.2.3. MontMult operation:

Operation code

Type

Field

OP_MontMult

MM_MULT

GF(p)

Note

Operation code is OP_MontMult:

  1. The operand a is A, operand b is RR, the result stored in A;

  2. The operand a is B, operand b is RR, the result stored in B;

  3. The operand a is Gx, operand b is RR, the result stored in Gx;

  4. The operand a is Gy, operand b is RR, the result stored in Gy;

  5. The operand a is Gz, operand b is RR, the result stored in Gz;

3.2.4. PDBL operation:

Operation code

Field

Gx length

Gy length

Gz length

Qx length

Qy length

Qz length

OP_GFP_PDBL

GF(p)

6 words

6 words

6 words

6 words

6 words

6 words

Note

Operation code is OP_GFP_PDBL:

  1. The x-coordinate of the first input point is Gx, the y-coordinate of the first input point is Gy, the z-coordinate of the first input point is Gz;

  2. The x-coordinate of the second input point is Qx, the y-coordinate of the second input point is Qy, the z-coordinate of the second input point is Qz.

3.2.5. PTC operation:

Operation code

Field

Gx length

Gy length

Gz length

OP_PTC

GF(p)

6 words

6 words

6 words

3.3. Test result:

If the result is same as the standard data, then print pass, if not print fail.

3.4. IO connection:

None