MPHELL  4.0.0
Functions
mphell-edwards.h File Reference

Declaration of Edward ECC functions. More...

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

Go to the source code of this file.

Functions

void edwards_compute_disc (ec_curve E, uint8_t stack)
 Set the discriminant of E: disc = a.d.(a-d)^4. More...
 
bool edwards_verify_random_generation (ec_curve E, const char *seed, uint8_t stack)
 Test if E if generated from the seed "seed". More...
 
void edwards_curve_random_generation (fe_ptr d, 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 edwards_point_set_neutral (ec_point_ptr dst, ec_curve_srcptr E, uint8_t stack)
 Set dst to the neutral element: (0,1,0,1) for extended twisted Edwards coordinates. More...
 
void edwards_point_set_aff (ec_point_ptr P, fe_srcptr x, fe_srcptr y, field_srcptr k, uint8_t stack)
 Set dest to the extended twisted Edwards coordinates point (x,y,1,xy) More...
 
void edwards_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 twisted Edwards coordinates point (str_x,str_y,1,str_x str_y) More...
 
bool edwards_belongs (ec_point_srcptr P, ec_curve_srcptr E, uint8_t stack)
 Test if P belongs to E. More...
 
void edwards_point_random (ec_point_ptr P, ec_curve_srcptr E, uint8_t stack)
 Set P to a random point on E. More...
 
void edwards_point_norm (ec_point_ptr P, ec_curve_srcptr E, uint8_t stack)
 Set P in affine coordinates. More...
 
void edwards_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 edwards_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 edwards_point_is_neutral (ec_point_srcptr P, ec_curve_srcptr E)
 Test if P is the neutral element. More...
 
bool edwards_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 (BUT do not test if the points belongs to the curve ) More...
 
void edwards_point_neg (ec_point_ptr P3, ec_point_srcptr P1, ec_curve_srcptr E)
 Compute the opposite of a point of the the Edwards elliptic curve E. More...
 
void edwards_point_add_unified (ec_point_ptr P3, ec_point_srcptr P1, ec_point_srcptr P2, ec_curve_srcptr E, uint8_t stack)
 Compute the unified addition of 2 points P1 and P2 of the Edwards elliptic curve E, using unified formulae (protection against SPA). Only available with Extended Edwards coordinates. More...
 
void edwards_point_add_dedicated (ec_point_ptr P3, ec_point_srcptr P1, ec_point_srcptr P2, ec_curve_srcptr E, uint8_t stack)
 Compute the addition of 2 points P1 and P2 of the Edwards elliptic curve E (not protected against SPA, but faster) More...
 
void edwards_point_dbl_dedicated (ec_point_ptr P3, ec_point_srcptr P1, ec_curve_srcptr E, uint8_t stack)
 Compute the double of a point of the Edwards elliptic curve E (not protected against SPA, but faster) More...
 

Detailed Description

Declaration of Edward ECC functions.

Definition in file mphell-edwards.h.

Function Documentation

◆ edwards_belongs()

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

Test if P belongs to E.

Parameters
PPoint
EEdwards Elliptic curve
stackTemporary memory stack to use
Returns
true if P belongs to E, false otherwise

Definition at line 368 of file mphell-edwards.c.

◆ edwards_compute_disc()

void edwards_compute_disc ( ec_curve  E,
uint8_t  stack 
)

Set the discriminant of E: disc = a.d.(a-d)^4.

Parameters
EElliptic curve
stackTemporary memory stack to use

Definition at line 47 of file mphell-edwards.c.

◆ edwards_curve_random_generation()

void edwards_curve_random_generation ( fe_ptr  d,
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
dDestination 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 180 of file mphell-edwards.c.

◆ edwards_point_add_dedicated()

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

Compute the addition of 2 points P1 and P2 of the Edwards elliptic curve E (not protected against SPA, but faster)

Parameters
P3Elliptic curve destination point
P2Elliptic curve point
P1Elliptic curve point
EEdwards Elliptic curve
stackTemporary memory stack to use

Definition at line 735 of file mphell-edwards.c.

◆ edwards_point_add_unified()

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

Compute the unified addition of 2 points P1 and P2 of the Edwards elliptic curve E, using unified formulae (protection against SPA). Only available with Extended Edwards coordinates.

Parameters
P3Elliptic curve destination point
P2Elliptic curve point
P1Elliptic curve point
EEdwards Elliptic curve
stackTemporary memory stack to use

Definition at line 668 of file mphell-edwards.c.

◆ edwards_point_are_equal()

bool edwards_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 (BUT do not test if the points belongs to the curve )

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

Definition at line 563 of file mphell-edwards.c.

◆ edwards_point_dbl_dedicated()

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

Compute the double of a point of the Edwards elliptic curve E (not protected against SPA, but faster)

Parameters
P3Elliptic curve destination point
P1Elliptic curve point
EEdwards Elliptic curve
stackTemporary memory stack to use

Definition at line 837 of file mphell-edwards.c.

◆ edwards_point_get_x_affine()

void edwards_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 516 of file mphell-edwards.c.

◆ edwards_point_get_y_affine()

void edwards_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 529 of file mphell-edwards.c.

◆ edwards_point_is_neutral()

bool edwards_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 543 of file mphell-edwards.c.

◆ edwards_point_neg()

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

Compute the opposite of a point of the the Edwards elliptic curve E.

Parameters
P3Elliptic curve destination point
P1Elliptic curve point
EEdwards Elliptic curve

Definition at line 655 of file mphell-edwards.c.

◆ edwards_point_norm()

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

Set P in affine coordinates.

Parameters
PPoint
EElliptic curve
stackTemporary memory stack to use

Definition at line 481 of file mphell-edwards.c.

◆ edwards_point_random()

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

Set P to a random point on E.

Parameters
PDestination point
EEdwards Elliptic curve
stackTemporary memory stack to use

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

◆ edwards_point_set_aff()

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

Set dest to the extended twisted Edwards coordinates point (x,y,1,xy)

Parameters
PDestination point
xx-coordinate of the extended twisted Edwards coordinates point (x,y,1,xy)
yy-coordinate of the extended twisted Edwards coordinates point (x,y,1,xy)
kBase field
stackTemporary memory stack to use

Definition at line 347 of file mphell-edwards.c.

◆ edwards_point_set_aff_str()

void edwards_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 twisted Edwards coordinates point (str_x,str_y,1,str_x str_y)

Parameters
PDestination point
str_xx-coordinate of the extended twisted Edwards coordinates point (x,y,1,xy) under string form
str_yy-coordinate of the extended twisted Edwards coordinates point (x,y,1,xy) 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 357 of file mphell-edwards.c.

◆ edwards_point_set_neutral()

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

Set dst to the neutral element: (0,1,0,1) for extended twisted Edwards coordinates.

Parameters
dstDestination point
EElliptic curve
stackTemporary memory stack to use

Definition at line 336 of file mphell-edwards.c.

◆ edwards_verify_random_generation()

bool edwards_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
stackTemporary memory stack to use
Returns
true if E is generated from seed
false otherwise

Definition at line 62 of file mphell-edwards.c.