MPHELL  4.0.0
mphell-jacobi.h
Go to the documentation of this file.
1 /*
2  MPHELL-4.0
3  Author(s): The MPHELL team
4 
5  (C) Copyright 2015-2018 - Institut Fourier / Univ. Grenoble Alpes (France)
6 
7  This file is part of the MPHELL Library.
8  MPHELL is free software: you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation, version 3 of the License.
11 
12  MPHELL is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with MPHELL. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
26 #ifndef MPHELL_JACOBI_H
27 #define MPHELL_JACOBI_H
28 /* E: y^2 = x^4 + 2ax^2 + 1 */
29 /* extended Jacobi Quartic with d=1 in affine coordinates */
30 /* which can be extented to the extended Jacobi Quartic (with Projective equation) E_ext: y^2 = bx^4 + 2ax^2z^2 + z^4 */
31 /* Homogeneous projective coordinates represent an affine point (x,y) on an extended Jacobi Quartic E: y^2 = x^4 + 2ax^2 + 1 as (X:Y:T:Z) satisfying Y^2 = Z^2 + 2aX^2 + T^2; X^2 = ZT; a != 1 Here (X:Y:T:Z) = (sX:sY:T:sZ) for all nonzero s. */
32 /* The Quadruplet (X, Y, T, Z) with X^2=ZT represents the affine point (X / Z, Y / Z) */
33 /* We work here only with homogeneous projective coordinates. */
34 
35 
36 /************************************SETTERS**********************************/
37 
44 void
45 jacobi_quartic_compute_disc(ec_curve E, uint8_t stack);
46 
55 bool
56 jacobi_quartic_verify_random_generation(ec_curve E, const char * seed, uint8_t stack);
57 
66 void
67 jacobi_quartic_curve_random_generation(fe_ptr a, char * seed_res, field_srcptr k, uint8_t stack);
68 
76 void
78 
88 void
90 
102 void
103 jacobi_quartic_point_set_aff_str (ec_point_ptr P, const char *str_x,
104  const char *str_y, const bool is_reduced, const uint8_t base,
105  field_srcptr k, uint8_t stack);
106 
115 bool
117 
125 void
127 
135 void
137 
146 void
148 
157 void
159 
160 
161 
162 /*******************************COMPARISON************************************/
163 
171 bool
173 
183 bool
185  ec_curve_srcptr E, uint8_t stack);
186 
187 
188 /*******************************OPERATIONS************************************/
189 
197 void
199 
200 /* UNIFIED => Resistant to SPA */
201 
211 void
213  ec_curve_srcptr E, uint8_t stack);
214 
215 /* DEDICATED => Not resistant to SPA, but faster
216  * Only the doubling is implemented as dedicated because the dedicated addition is not faster than the unified addition
217  */
218 
227 void
229 
230 
231 #endif
fp_elt * field_elt
Generic field element.
Definition: mphell-field.h:39
bool jacobi_quartic_belongs(ec_point_srcptr P, ec_curve_srcptr E, uint8_t stack)
Test if P belongs to E.
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.
Define a field.
Definition: mphell-field.h:90
Define an elliptic curve point.
Definition: mphell-curve.h:103
void jacobi_quartic_compute_disc(ec_curve E, uint8_t stack)
Set the discriminant of E: disc = (2^8).(a^2 - 1)^2.
Definition: mphell-jacobi.c:32
void jacobi_quartic_point_neg(ec_point_ptr P3, ec_point_srcptr P1, ec_curve_srcptr E)
Set P3 to -P1.
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.
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.
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 ...
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).
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....
const fp_elt * fe_srcptr
Pointer on a field element, the field element cannot be modified through this pointer.
Definition: mphell-field.h:51
bool jacobi_quartic_verify_random_generation(ec_curve E, const char *seed, uint8_t stack)
Test if E if generated from the seed "seed".
Definition: mphell-jacobi.c:54
fp_elt * fe_ptr
Pointer on a field element.
Definition: mphell-field.h:45
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.
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)
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)
Define an elliptic curve.
Definition: mphell-curve.h:139
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,...
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)
bool jacobi_quartic_point_is_neutral(ec_point_srcptr P, ec_curve_srcptr E)
Test if P is the neutral element.