MPHELL
4.0.0
|
Declaration of Edward ECC functions. More...
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... | |
Declaration of Edward ECC functions.
Definition in file mphell-edwards.h.
bool edwards_belongs | ( | ec_point_srcptr | P, |
ec_curve_srcptr | E, | ||
uint8_t | stack | ||
) |
Test if P belongs to E.
P | Point |
E | Edwards Elliptic curve |
stack | Temporary memory stack to use |
Definition at line 368 of file mphell-edwards.c.
void edwards_compute_disc | ( | ec_curve | E, |
uint8_t | stack | ||
) |
Set the discriminant of E: disc = a.d.(a-d)^4.
E | Elliptic curve |
stack | Temporary memory stack to use |
Definition at line 47 of file mphell-edwards.c.
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 !!!
d | Destination coefficient, generated from a random seed |
seed_res | Destination seed (of 160 bits) used to generate an elliptic curve |
k | Base field, must be created by the user before use. |
stack | Temporary memory stack to use |
Definition at line 180 of file mphell-edwards.c.
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)
P3 | Elliptic curve destination point |
P2 | Elliptic curve point |
P1 | Elliptic curve point |
E | Edwards Elliptic curve |
stack | Temporary memory stack to use |
Definition at line 735 of file mphell-edwards.c.
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.
P3 | Elliptic curve destination point |
P2 | Elliptic curve point |
P1 | Elliptic curve point |
E | Edwards Elliptic curve |
stack | Temporary memory stack to use |
Definition at line 668 of file mphell-edwards.c.
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 )
P1 | Point |
P2 | Point |
E | Elliptic curve |
stack | Temporary memory stack to use |
Definition at line 563 of file mphell-edwards.c.
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)
P3 | Elliptic curve destination point |
P1 | Elliptic curve point |
E | Edwards Elliptic curve |
stack | Temporary memory stack to use |
Definition at line 837 of file mphell-edwards.c.
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.
x | P->x in affine coordinates |
P | Point |
E | Elliptic curve |
stack | Temporary memory stack to use |
Definition at line 516 of file mphell-edwards.c.
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.
x | P->y in affine coordinates |
P | Point |
E | Elliptic curve |
stack | Temporary memory stack to use |
Definition at line 529 of file mphell-edwards.c.
bool edwards_point_is_neutral | ( | ec_point_srcptr | P, |
ec_curve_srcptr | E | ||
) |
Test if P is the neutral element.
P | Point to test |
E | Elliptic curve |
Definition at line 543 of file mphell-edwards.c.
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.
P3 | Elliptic curve destination point |
P1 | Elliptic curve point |
E | Edwards Elliptic curve |
Definition at line 655 of file mphell-edwards.c.
void edwards_point_norm | ( | ec_point_ptr | P, |
ec_curve_srcptr | E, | ||
uint8_t | stack | ||
) |
Set P in affine coordinates.
P | Point |
E | Elliptic curve |
stack | Temporary memory stack to use |
Definition at line 481 of file mphell-edwards.c.
void edwards_point_random | ( | ec_point_ptr | P, |
ec_curve_srcptr | E, | ||
uint8_t | stack | ||
) |
Set P to a random point on E.
P | Destination point |
E | Edwards Elliptic curve |
stack | Temporary memory stack to use |
Definition at line 436 of file mphell-edwards.c.
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)
P | Destination point |
x | x-coordinate of the extended twisted Edwards coordinates point (x,y,1,xy) |
y | y-coordinate of the extended twisted Edwards coordinates point (x,y,1,xy) |
k | Base field |
stack | Temporary memory stack to use |
Definition at line 347 of file mphell-edwards.c.
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)
P | Destination point |
str_x | x-coordinate of the extended twisted Edwards coordinates point (x,y,1,xy) under string form |
str_y | y-coordinate of the extended twisted Edwards coordinates point (x,y,1,xy) under string form |
is_reduced | set true if str_x and str_y are already reduced in k, false otherwise |
base | Base (either 10 or 16) used for str_x and str_y |
k | Base field |
stack | Temporary memory stack to use |
Definition at line 357 of file mphell-edwards.c.
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.
dst | Destination point |
E | Elliptic curve |
stack | Temporary memory stack to use |
Definition at line 336 of file mphell-edwards.c.
bool edwards_verify_random_generation | ( | ec_curve | E, |
const char * | seed, | ||
uint8_t | stack | ||
) |
Test if E if generated from the seed "seed".
E | Elliptic curve to test |
seed | Seed (of 160 bits) used to generate an elliptic curve |
stack | Temporary memory stack to use |
Definition at line 62 of file mphell-edwards.c.