MPHELL  4.0.0
Functions
mphell-jacobi.h File Reference

Declaration of Jacobi ECC functions. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void jacobi_quartic_compute_disc (ec_curve E, uint8_t stack)
 Set the discriminant of E: disc = (2^8).(a^2 - 1)^2. More...
 
bool jacobi_quartic_verify_random_generation (ec_curve E, const char *seed, uint8_t stack)
 Test if E if generated from the seed "seed". More...
 
void jacobi_quartic_curve_random_generation (fe_ptr a, char *seed_res, field_srcptr k, uint8_t stack)
 Generate a 160 bits seed and coefficients a and b defining a Weiestrass elliptic curve. The curve is not tested to be secure !!! More...
 
void jacobi_quartic_point_set_neutral (ec_point_ptr dst, ec_curve_srcptr E, uint8_t stack)
 Set dst to the neutral element: (0,1,0,1). More...
 
void jacobi_quartic_point_set_aff (ec_point_ptr P, fe_srcptr x, fe_srcptr y, field_srcptr k, uint8_t stack)
 Set dest to the affine point (x,y) More...
 
void jacobi_quartic_point_set_aff_str (ec_point_ptr P, const char *str_x, const char *str_y, const bool is_reduced, const uint8_t base, field_srcptr k, uint8_t stack)
 Set dest to the affine point (str_x,str_y) More...
 
bool jacobi_quartic_belongs (ec_point_srcptr P, ec_curve_srcptr E, uint8_t stack)
 Test if P belongs to E. More...
 
void jacobi_quartic_point_random (ec_point_ptr P, ec_curve_srcptr E, uint8_t stack)
 Create a random point P on the elliptic curve E. More...
 
void jacobi_quartic_point_norm (ec_point_ptr P, ec_curve_srcptr E, uint8_t stack)
 Convert a point in extented projective coordinate (X,Y,T,Z) to an affine point (x,y) with x=X/Z, y=Y/Z. More...
 
void jacobi_quartic_point_get_x_affine (field_elt x, ec_point_ptr P, ec_curve_srcptr E, uint8_t stack)
 Convert P->x to its affine representation. More...
 
void jacobi_quartic_point_get_y_affine (field_elt y, ec_point_ptr P, ec_curve_srcptr E, uint8_t stack)
 Convert P->y to its affine representation. More...
 
bool jacobi_quartic_point_is_neutral (ec_point_srcptr P, ec_curve_srcptr E)
 Test if P is the neutral element. More...
 
bool jacobi_quartic_point_are_equal (ec_point_srcptr P1, ec_point_srcptr P2, ec_curve_srcptr E, uint8_t stack)
 Test if P1 and P2 are equal on E. More...
 
void jacobi_quartic_point_neg (ec_point_ptr P3, ec_point_srcptr P1, ec_curve_srcptr E)
 Set P3 to -P1. More...
 
void jacobi_quartic_point_add_unified (ec_point_ptr P3, ec_point_srcptr P1, ec_point_srcptr P2, ec_curve_srcptr E, uint8_t stack)
 Set P3 to P1 + P2 using extended projective coordinate (T=(X^2)/Z), and unified formulae (protection against SPA) More...
 
void jacobi_quartic_point_dbl_dedicated (ec_point_ptr P3, ec_point_srcptr P1, ec_curve_srcptr E, uint8_t stack)
 Set P3 to 2*P1, using dedicated formulae (not protected against SPA, but faster) More...
 

Detailed Description

Declaration of Jacobi ECC functions.

Definition in file mphell-jacobi.h.

Function Documentation

◆ jacobi_quartic_belongs()

bool jacobi_quartic_belongs ( ec_point_srcptr  P,
ec_curve_srcptr  E,
uint8_t  stack 
)

Test if P belongs to E.

Parameters
PJacobi quartic point
EElliptic curve
stackTemporary memory stack to use
Returns
True if P belongs to E, false otherwise

Definition at line 352 of file mphell-jacobi.c.

◆ jacobi_quartic_compute_disc()

void jacobi_quartic_compute_disc ( ec_curve  E,
uint8_t  stack 
)

Set the discriminant of E: disc = (2^8).(a^2 - 1)^2.

Parameters
EElliptic curve
stackTemporary memory stack to use

Definition at line 32 of file mphell-jacobi.c.

◆ jacobi_quartic_curve_random_generation()

void jacobi_quartic_curve_random_generation ( fe_ptr  a,
char *  seed_res,
field_srcptr  k,
uint8_t  stack 
)

Generate a 160 bits seed and coefficients a and b defining a Weiestrass elliptic curve. The curve is not tested to be secure !!!

Parameters
aDestination coefficient, generated from a random seed
seed_resDestination seed (of 160 bits) used to generate an elliptic curve
kBase field, must be created by the user before use.
stackTemporary memory stack to use

Definition at line 172 of file mphell-jacobi.c.

◆ jacobi_quartic_point_add_unified()

void jacobi_quartic_point_add_unified ( ec_point_ptr  P3,
ec_point_srcptr  P1,
ec_point_srcptr  P2,
ec_curve_srcptr  E,
uint8_t  stack 
)

Set P3 to P1 + P2 using extended projective coordinate (T=(X^2)/Z), and unified formulae (protection against SPA)

Parameters
P3Resulting point
P1Source point
P2Source point
EElliptic curve
stackTemporary memory stack to use

Definition at line 565 of file mphell-jacobi.c.

◆ jacobi_quartic_point_are_equal()

bool jacobi_quartic_point_are_equal ( ec_point_srcptr  P1,
ec_point_srcptr  P2,
ec_curve_srcptr  E,
uint8_t  stack 
)

Test if P1 and P2 are equal on E.

Parameters
P1Point
P2Point
EElliptic curve
stackTemporary memory stack to use
Returns
True if P1 == P2, False otherwise

Definition at line 488 of file mphell-jacobi.c.

◆ jacobi_quartic_point_dbl_dedicated()

void jacobi_quartic_point_dbl_dedicated ( ec_point_ptr  P3,
ec_point_srcptr  P1,
ec_curve_srcptr  E,
uint8_t  stack 
)

Set P3 to 2*P1, using dedicated formulae (not protected against SPA, but faster)

Parameters
P3Resulting point
P1Source point
EElliptic curve (Jacobi quartic)
stackTemporary memory stack to use

Definition at line 659 of file mphell-jacobi.c.

◆ jacobi_quartic_point_get_x_affine()

void jacobi_quartic_point_get_x_affine ( field_elt  x,
ec_point_ptr  P,
ec_curve_srcptr  E,
uint8_t  stack 
)

Convert P->x to its affine representation.

Parameters
xP->x in affine coordinates
PPoint
EElliptic curve
stackTemporary memory stack to use

Definition at line 452 of file mphell-jacobi.c.

◆ jacobi_quartic_point_get_y_affine()

void jacobi_quartic_point_get_y_affine ( field_elt  y,
ec_point_ptr  P,
ec_curve_srcptr  E,
uint8_t  stack 
)

Convert P->y to its affine representation.

Parameters
xP->y in affine coordinates
PPoint
EElliptic curve
stackTemporary memory stack to use

Definition at line 465 of file mphell-jacobi.c.

◆ jacobi_quartic_point_is_neutral()

bool jacobi_quartic_point_is_neutral ( ec_point_srcptr  P,
ec_curve_srcptr  E 
)

Test if P is the neutral element.

Parameters
PPoint to test
EElliptic curve
Returns
True if P is neutral, False otherwise

Definition at line 480 of file mphell-jacobi.c.

◆ jacobi_quartic_point_neg()

void jacobi_quartic_point_neg ( ec_point_ptr  P3,
ec_point_srcptr  P1,
ec_curve_srcptr  E 
)

Set P3 to -P1.

Parameters
P3Resulting point
P1Source point
EElliptic curve (Jacobi quartic)

Definition at line 553 of file mphell-jacobi.c.

◆ jacobi_quartic_point_norm()

void jacobi_quartic_point_norm ( ec_point_ptr  P,
ec_curve_srcptr  E,
uint8_t  stack 
)

Convert a point in extented projective coordinate (X,Y,T,Z) to an affine point (x,y) with x=X/Z, y=Y/Z.

Parameters
PPoint in extented projective coordinate (X,Y,T,Z) with T=(X^2)/Z
EJacobi quartic elliptic curve
stackTemporary memory stack to use

Definition at line 436 of file mphell-jacobi.c.

◆ jacobi_quartic_point_random()

void jacobi_quartic_point_random ( ec_point_ptr  P,
ec_curve_srcptr  E,
uint8_t  stack 
)

Create a random point P on the elliptic curve E.

Parameters
PDestination point in extented projective coordinate (X,Y,T,Z) with T=(X^2)/Z
EJacobi quartic elliptic curve
stackTemporary memory stack to use

Definition at line 407 of file mphell-jacobi.c.

◆ jacobi_quartic_point_set_aff()

void jacobi_quartic_point_set_aff ( ec_point_ptr  P,
fe_srcptr  x,
fe_srcptr  y,
field_srcptr  k,
uint8_t  stack 
)

Set dest to the affine point (x,y)

Parameters
PDestination point
xx-coordinate of the affine point (x,y)
yy-coordinate of the affine point (x,y)
kBase field
stackTemporary memory stack to use

Definition at line 333 of file mphell-jacobi.c.

◆ jacobi_quartic_point_set_aff_str()

void jacobi_quartic_point_set_aff_str ( ec_point_ptr  P,
const char *  str_x,
const char *  str_y,
const bool  is_reduced,
const uint8_t  base,
field_srcptr  k,
uint8_t  stack 
)

Set dest to the affine point (str_x,str_y)

Parameters
PDestination point
str_xx-coordinate of the affine point (x,y) under string form
str_yy-coordinate of the affine point (x,y) under string form
is_reducedSet true if str_x and str_y are already reduced in k, false otherwise
baseBase (either 10 or 16) used for str_x and str_y
kBase field
stackTemporary memory stack to use

Definition at line 342 of file mphell-jacobi.c.

◆ jacobi_quartic_point_set_neutral()

void jacobi_quartic_point_set_neutral ( ec_point_ptr  dst,
ec_curve_srcptr  E,
uint8_t  stack 
)

Set dst to the neutral element: (0,1,0,1).

Parameters
dstDestination point
EElliptic curve
stackTemporary memory stack to use

Definition at line 323 of file mphell-jacobi.c.

◆ jacobi_quartic_verify_random_generation()

bool jacobi_quartic_verify_random_generation ( ec_curve  E,
const char *  seed,
uint8_t  stack 
)

Test if E if generated from the seed "seed".

Parameters
EElliptic curve to test
seedSeed (of 160 bits) used to generate an elliptic curve
Returns
true if E is generated from seed
false otherwise

Definition at line 54 of file mphell-jacobi.c.