MPHELL
4.0.0
|
Declaration of cubic field (finite field constructed with an irreducible polynomial of degree 3) functions. More...
#include "mphell-fp.h"
Go to the source code of this file.
Data Structures | |
struct | fp3_elt_t |
Cubic extension field element structure. More... | |
struct | fp3_param_t |
Cubic extension field structure. More... | |
Typedefs | |
typedef fp3_elt_t | fp3_elt |
Cubic extension field element structure. | |
typedef fp3_elt_t * | fp3_elt_ptr |
Define fp3_elt_ptr, use in all functions. | |
typedef const fp3_elt_t * | fp3_elt_srcptr |
Define fp3_elt_srcptr, use in all functions where the parameter is const. | |
typedef fp3_param_t * | fp3_param |
Address of a cubic extension field structure. | |
Functions | |
void | fp3_elt_get_pool_elt (fp3_elt *dst, const fp3_param param, uint8_t stack) |
Allocate and initialise space for a temporary cubic extension field element. More... | |
void | fp3_elt_relax_pool_elt (fp3_elt *dst, const fp3_param param, uint8_t stack) |
Free space of a temporary cubic extension field element. More... | |
void | fp3_alloc (fp3_param param, const fp_param base) |
Allocate space for the cubic extension field informations structure. More... | |
void | fp3_create (fp3_param param, const fp_param base, fp_elt_srcptr non_residue, uint8_t stack) |
Create a cubic extension of the field base. More... | |
void | fp3_copy (fp3_param param_res, const fp3_param param) |
Copy the cubic extension field structure param into param_res. More... | |
void | fp3_free (fp3_param param) |
Free the space of the cubic extension field informations structure. More... | |
void | fp3_get_characteristic (number_ptr c, const fp3_param param) |
Get the characteristic of the cubic extension field "param". More... | |
void | fp3_get_size (number_ptr c, const fp3_param param) |
Get the size of the cubic extension field "param". More... | |
void | fp3_elt_alloc (fp3_elt *dst, const fp3_param param) |
Allocate space for a cubic extension field element. More... | |
void | fp3_elt_init (fp3_elt_ptr dst, const fp3_param param) |
Initialise a cubic extension field element. More... | |
void | fp3_elt_copy (fp3_elt_ptr dst, fp3_elt_srcptr src, const fp3_param param) |
Copy src into dst, src and dst must belong to the same FP3. More... | |
void | fp3_elt_clear (fp3_elt *src) |
Clear space used by src (remove the action of fp3_elt_init but let the one of fp3_elt_alloc) More... | |
void | fp3_elt_free (fp3_elt *src) |
Free space used by src. More... | |
void | fp3_elt_set_one (fp3_elt_ptr dst, const fp3_param param) |
Set dst to one (or its Montgomery form if Montgomery arithmetic is used) More... | |
void | fp3_elt_set_ui (fp3_elt_ptr dst, const uint64_t src, const bool isreduced, const fp3_param param, uint8_t stack) |
Set dst to src, if Montgomery arithmetic is used, is_reduced == false -> transform dst into its Montgomery form. More... | |
void | fp3_elt_set_number (fp3_elt_ptr dst, number_srcptr src, const bool isreduced, const fp3_param param, uint8_t stack) |
Set dst to src, if Montgomery arithmetic is used, is_reduced == false -> transform dst into its Montgomery form. More... | |
void | fp3_elt_set_fp_elt (fp3_elt_ptr dst, fp_elt_srcptr src, const fp3_param param) |
Set dst to src. More... | |
void | fp3_elt_set (fp3_elt_ptr dst, number_srcptr src1, number_srcptr src2, number_srcptr src3, const bool isreduced, const fp3_param param, uint8_t stack) |
Set dst to src1 + src2*x + src3*x^2, if Montgomery arithmetic is used, is_reduced == false -> transform dst into its Montgomery form. More... | |
void | fp3_elt_set_fp_elts (fp3_elt_ptr dst, fp_elt_srcptr src1, fp_elt_srcptr src2, fp_elt_srcptr src3, const fp3_param param) |
Set dst to src1 + src2*x + src3*x^2. More... | |
void | fp3_elt_set_str (fp3_elt_ptr dst, const char *str, const uint8_t base, const bool isreduced, const fp3_param param, uint8_t stack) |
Set dst to str, if Montgomery arithmetic is used, is_reduced == false -> transform dst into its Montgomery form. More... | |
void | fp3_elt_random (fp3_elt_ptr dst, const fp3_param param, uint8_t stack) |
Set dst to a random element of FP3, the random process is chosen at the MHELL initialisation. More... | |
void | fp3_elt_lift (fp3_elt_ptr dst, fp3_elt_srcptr src, const fp3_param param, uint8_t stack) |
If Montgomery arithmetic is used, lift src (which is into Montgomery form) to classical FP3. More... | |
void | fp3_str (char **str, const fp3_param param, const uint8_t base, uint8_t stack) |
Converts fp2_param param to string format in base specified by base. More... | |
void | fp3_elt_str (char **str, fp3_elt_srcptr src, const uint8_t base, const bool lift, const fp3_param param, uint8_t stack) |
Converts src to string format in base specified by base. More... | |
int8_t | fp3_elt_cmp_fp_elt (fp3_elt_srcptr src1, fp_elt_srcptr src2, const fp3_param param) |
Compare src1 and src2 in FP3. More... | |
int8_t | fp3_elt_cmp (fp3_elt_srcptr src1, fp3_elt_srcptr src2, const fp3_param param) |
Compare src1 and src2 in FP3. More... | |
bool | fp3_elt_isone (fp3_elt_srcptr src, const fp3_param param) |
Test if src is one. More... | |
bool | fp3_elt_iszero (fp3_elt_srcptr src, const fp3_param param) |
Test if src is zero. More... | |
void | fp3_elt_inc (fp3_elt_ptr dst, fp3_elt_srcptr src, const fp3_param param) |
Set dst <- src + 1. More... | |
void | fp3_elt_add_fp_elt (fp3_elt_ptr dst, fp3_elt_srcptr src1, fp_elt_srcptr src2, const fp3_param param) |
Set dst <- src1 + src2. More... | |
void | fp3_elt_add (fp3_elt_ptr dst, fp3_elt_srcptr src1, fp3_elt_srcptr src2, const fp3_param param) |
Set dst <- src1 + src2. More... | |
void | fp3_elt_dec (fp3_elt_ptr dst, fp3_elt_srcptr src, const fp3_param param) |
Set dst <- src - 1. More... | |
void | fp3_elt_sub_fp_elt (fp3_elt_ptr dst, fp3_elt_srcptr src1, fp_elt_srcptr src2, const fp3_param param) |
Set dst <- src1 - src2. More... | |
void | fp3_elt_sub (fp3_elt_ptr dst, fp3_elt_srcptr src1, fp3_elt_srcptr src2, const fp3_param param) |
Set dst <- src1 - src2. More... | |
void | fp3_elt_neg_fp_elt (fp3_elt_ptr dst, fp_elt_srcptr src, const fp3_param param) |
Set dst <- (-src) More... | |
void | fp3_elt_neg (fp3_elt_ptr dst, fp3_elt_srcptr src, const fp3_param param) |
Set dst <- (-src) More... | |
void | fp3_elt_mul_fp_elt (fp3_elt_ptr dst, fp3_elt_srcptr src1, fp_elt_srcptr src2, const fp3_param param, uint8_t stack) |
Set dst <- src1 * src2, if Montgomery arithmetic is used, the Montgomery multiplication will be used ! More... | |
void | fp3_elt_mul2 (fp3_elt_ptr dst, fp3_elt_srcptr src, const fp3_param param) |
Set dst <- 2 * src. More... | |
void | fp3_elt_mul4 (fp3_elt_ptr dst, fp3_elt_srcptr src, const fp3_param param) |
Set dst <- 4 * src. More... | |
void | fp3_elt_mul8 (fp3_elt_ptr dst, fp3_elt_srcptr src, const fp3_param param) |
Set dst <- 8 * src. More... | |
void | fp3_elt_mul3 (fp3_elt_ptr dst, fp3_elt_srcptr src, const fp3_param param, uint8_t stack) |
Set dst <- 3 * src. More... | |
void | fp3_elt_mul (fp3_elt_ptr dst, fp3_elt_srcptr src1, fp3_elt_srcptr src2, const fp3_param param, uint8_t stack) |
Set dst <- src1 * src2, if Montgomery arithmetic is used, the Montgomery multiplication will be used ! More... | |
void | fp3_elt_sqr_fp_elt (fp3_elt_ptr dst, fp_elt_srcptr src, const fp3_param param, uint8_t stack) |
Set dst <- src^2. More... | |
void | fp3_elt_sqr (fp3_elt_ptr dst, fp3_elt_srcptr src, const fp3_param param, uint8_t stack) |
Set dst <- src^2. More... | |
void | fp3_elt_inv_fp_elt (fp3_elt_ptr dst, fp_elt_srcptr src, const fp3_param param, uint8_t stack) |
Set dst <- src^(-1) More... | |
void | fp3_elt_inv (fp3_elt_ptr dst, fp3_elt_srcptr src, const fp3_param param, uint8_t stack) |
Set dst <- src^(-1) More... | |
void | fp3_elt_div_fp_elt (fp3_elt_ptr dst, fp3_elt_srcptr src1, fp_elt_srcptr src2, const fp3_param param, uint8_t stack) |
Set dst <- src1 / src2. More... | |
void | fp3_elt_div (fp3_elt_ptr dst, fp3_elt_srcptr src1, fp3_elt_srcptr src2, const fp3_param param, uint8_t stack) |
Set dst <- src1 / src2. More... | |
void | fp3_elt_pow_ui (fp3_elt_ptr dst, fp3_elt_srcptr src, const block n, const fp3_param param, uint8_t stack) |
Set dst <- src^n. More... | |
void | fp3_elt_pow_number (fp3_elt_ptr dst, fp3_elt_srcptr src, number_srcptr n, const fp3_param param, uint8_t stack) |
Set dst <- src^n. More... | |
bool | fp3_elt_issquare (fp3_elt_srcptr src, const fp3_param param, uint8_t stack) |
Test if src is a square, using A NOTE ON POWERS IN FINITE FIELDS from ANDREAS AABRANDT AND VAGN LUNDSGAARD HANSEN. More... | |
int8_t | fp3_elt_ispower_ui (fp3_elt_srcptr src, const block n, const fp3_param param, uint8_t stack) |
Test if src is a n-power in FP3, using A NOTE ON POWERS IN FINITE FIELDS from ANDREAS AABRANDT AND VAGN LUNDSGAARD HANSEN. More... | |
int8_t | fp3_elt_ispower_number (fp3_elt_srcptr src, number_srcptr n, const fp3_param param, uint8_t stack) |
Test if src is a n-power in FP3, using A NOTE ON POWERS IN FINITE FIELDS from ANDREAS AABRANDT AND VAGN LUNDSGAARD HANSEN. More... | |
void | fp3_elt_sqrt (fp3_elt_ptr dst, fp3_elt_srcptr src, const fp3_param param, uint8_t stack) |
Set dst <- src^(1/2), using Tonelli–Shanks algorithm. More... | |
void | fp3_elt_cube_root (fp3_elt_ptr dst, fp3_elt_srcptr src, const fp3_param param, uint8_t stack) |
Set dst <- src^(1/3) More... | |
void | fp3_elt_unity_nth_root (fp3_elt_ptr dst, const block n, const fp3_param param, uint8_t stack) |
Set dst to a non trivial n-th root of unity if it exists (ie n divides q-1), 1 otherwise. More... | |
Declaration of cubic field (finite field constructed with an irreducible polynomial of degree 3) functions.
Definition in file mphell-fp3.h.
Allocate space for the cubic extension field informations structure.
param | Structure for the cubic extension field informations to allocate |
base | Base prime field |
Definition at line 69 of file mphell-fp3.c.
Copy the cubic extension field structure param into param_res.
param_res | Destination cubic extension field |
param | Source cubic extension field |
Definition at line 131 of file mphell-fp3.c.
Create a cubic extension of the field base.
param | Informations structure on cubic extension field to fill (must be allocated) |
base | Base prime field |
non_residue | Non cubic residue |
stack | Temporary memory stack to use |
Definition at line 108 of file mphell-fp3.c.
void fp3_elt_add | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src1, | ||
fp3_elt_srcptr | src2, | ||
const fp3_param | param | ||
) |
Set dst <- src1 + src2.
dst | To store the result |
src1 | Source field element |
src2 | Source field element |
param | Information on the cubic extension field |
Definition at line 403 of file mphell-fp3.c.
void fp3_elt_add_fp_elt | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src1, | ||
fp_elt_srcptr | src2, | ||
const fp3_param | param | ||
) |
Set dst <- src1 + src2.
dst | To store the result |
src1 | Source field element |
src2 | Source field element in the prime field |
param | Information on the cubic extension field |
Definition at line 394 of file mphell-fp3.c.
Allocate space for a cubic extension field element.
dst | Cubic extension field element to allocate |
param | Information on cubic extension field |
Definition at line 174 of file mphell-fp3.c.
void fp3_elt_clear | ( | fp3_elt * | src | ) |
Clear space used by src (remove the action of fp3_elt_init but let the one of fp3_elt_alloc)
src | cubic extension field element to clear |
Definition at line 198 of file mphell-fp3.c.
int8_t fp3_elt_cmp | ( | fp3_elt_srcptr | src1, |
fp3_elt_srcptr | src2, | ||
const fp3_param | param | ||
) |
Compare src1 and src2 in FP3.
src1 | Source field element in FP3 |
src2 | Source field element in FP3 |
param | Information on the cubic extension field |
Definition at line 348 of file mphell-fp3.c.
int8_t fp3_elt_cmp_fp_elt | ( | fp3_elt_srcptr | src1, |
fp_elt_srcptr | src2, | ||
const fp3_param | param | ||
) |
Compare src1 and src2 in FP3.
src1 | Source field element in FP3 |
src2 | Source number in FP |
param | Information on the cubic extension field |
Definition at line 338 of file mphell-fp3.c.
void fp3_elt_copy | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src, | ||
const fp3_param | param | ||
) |
Copy src into dst, src and dst must belong to the same FP3.
dst | Destination cubic extension field element |
src | Source cubic extension field element |
param | Information on cubic extension field |
Definition at line 190 of file mphell-fp3.c.
void fp3_elt_cube_root | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst <- src^(1/3)
dst | To store the result |
src | Source field element |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 910 of file mphell-fp3.c.
void fp3_elt_dec | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src, | ||
const fp3_param | param | ||
) |
Set dst <- src - 1.
dst | To store the result |
src | Source field element |
param | Information on the cubic extension field |
Definition at line 412 of file mphell-fp3.c.
void fp3_elt_div | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src1, | ||
fp3_elt_srcptr | src2, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst <- src1 / src2.
dst | To store the result |
src1 | Source field element |
src2 | Source field element |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 635 of file mphell-fp3.c.
void fp3_elt_div_fp_elt | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src1, | ||
fp_elt_srcptr | src2, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst <- src1 / src2.
dst | To store the result |
src1 | Source field element |
src2 | Source field element in the prime field |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 624 of file mphell-fp3.c.
void fp3_elt_free | ( | fp3_elt * | src | ) |
Free space used by src.
src | cubic extension field element to free |
Definition at line 206 of file mphell-fp3.c.
Allocate and initialise space for a temporary cubic extension field element.
dst | Temporary element to allocate |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 51 of file mphell-fp3.c.
void fp3_elt_inc | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src, | ||
const fp3_param | param | ||
) |
Set dst <- src + 1.
dst | To store the result |
src | Source field element |
param | Information on the cubic extension field |
Definition at line 386 of file mphell-fp3.c.
void fp3_elt_init | ( | fp3_elt_ptr | dst, |
const fp3_param | param | ||
) |
Initialise a cubic extension field element.
dst | Cubic extension field element to initialise |
param | Information on cubic extension field |
Definition at line 182 of file mphell-fp3.c.
void fp3_elt_inv | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst <- src^(-1)
dst | To store the result |
src | Source field element |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 580 of file mphell-fp3.c.
void fp3_elt_inv_fp_elt | ( | fp3_elt_ptr | dst, |
fp_elt_srcptr | src, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst <- src^(-1)
dst | To store the result |
src | Source field element in the prime field |
param | Information on the cubic extension field |
Definition at line 572 of file mphell-fp3.c.
bool fp3_elt_isone | ( | fp3_elt_srcptr | src, |
const fp3_param | param | ||
) |
Test if src is one.
src | Source field element |
param | Information on the cubic extension field |
Definition at line 370 of file mphell-fp3.c.
int8_t fp3_elt_ispower_number | ( | fp3_elt_srcptr | src, |
number_srcptr | n, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Test if src is a n-power in FP3, using A NOTE ON POWERS IN FINITE FIELDS from ANDREAS AABRANDT AND VAGN LUNDSGAARD HANSEN.
src | Source field element |
n | Source number |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 767 of file mphell-fp3.c.
int8_t fp3_elt_ispower_ui | ( | fp3_elt_srcptr | src, |
const block | n, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Test if src is a n-power in FP3, using A NOTE ON POWERS IN FINITE FIELDS from ANDREAS AABRANDT AND VAGN LUNDSGAARD HANSEN.
src | Source field element |
n | Source block |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 726 of file mphell-fp3.c.
bool fp3_elt_issquare | ( | fp3_elt_srcptr | src, |
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Test if src is a square, using A NOTE ON POWERS IN FINITE FIELDS from ANDREAS AABRANDT AND VAGN LUNDSGAARD HANSEN.
src | Source field element |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 708 of file mphell-fp3.c.
bool fp3_elt_iszero | ( | fp3_elt_srcptr | src, |
const fp3_param | param | ||
) |
Test if src is zero.
src | Source field element |
param | Information on the cubic extension field |
Definition at line 377 of file mphell-fp3.c.
void fp3_elt_lift | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
If Montgomery arithmetic is used, lift src (which is into Montgomery form) to classical FP3.
dst | Destination primary field element (in FP) |
src | Source cubic extension field element (under Montgomery form) |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 293 of file mphell-fp3.c.
void fp3_elt_mul | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src1, | ||
fp3_elt_srcptr | src2, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst <- src1 * src2, if Montgomery arithmetic is used, the Montgomery multiplication will be used !
dst | To store the result |
src1 | Source field element |
src2 | Source field element |
param | Information the cubic extension prime field |
stack | Temporary memory stack to use |
Definition at line 501 of file mphell-fp3.c.
void fp3_elt_mul2 | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src, | ||
const fp3_param | param | ||
) |
Set dst <- 2 * src.
dst | To store the result |
src | Source field element |
param | Information the cubic extension prime field |
Definition at line 465 of file mphell-fp3.c.
void fp3_elt_mul3 | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst <- 3 * src.
dst | To store the result |
src | Source field element |
param | Information the cubic extension prime field |
stack | Temporary memory stack to use |
Definition at line 492 of file mphell-fp3.c.
void fp3_elt_mul4 | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src, | ||
const fp3_param | param | ||
) |
Set dst <- 4 * src.
dst | To store the result |
src | Source field element |
param | Information the cubic extension prime field |
Definition at line 474 of file mphell-fp3.c.
void fp3_elt_mul8 | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src, | ||
const fp3_param | param | ||
) |
Set dst <- 8 * src.
dst | To store the result |
src | Source field element |
param | Information the cubic extension prime field |
Definition at line 483 of file mphell-fp3.c.
void fp3_elt_mul_fp_elt | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src1, | ||
fp_elt_srcptr | src2, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst <- src1 * src2, if Montgomery arithmetic is used, the Montgomery multiplication will be used !
dst | To store the result |
src1 | Source field element |
src2 | Source field element in the prime field |
param | Information the cubic extension prime field |
stack | Temporary memory stack to use |
Definition at line 456 of file mphell-fp3.c.
void fp3_elt_neg | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src, | ||
const fp3_param | param | ||
) |
Set dst <- (-src)
dst | To store the result |
src | Source field element |
param | Information on the cubic extension field |
Definition at line 446 of file mphell-fp3.c.
void fp3_elt_neg_fp_elt | ( | fp3_elt_ptr | dst, |
fp_elt_srcptr | src, | ||
const fp3_param | param | ||
) |
Set dst <- (-src)
dst | To store the result |
src | Source field element in the prime fields |
param | Information on the cubic extension field |
Definition at line 438 of file mphell-fp3.c.
void fp3_elt_pow_number | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src, | ||
number_srcptr | n, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst <- src^n.
dst | To store the result |
src | Source field element |
n | Source number |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 669 of file mphell-fp3.c.
void fp3_elt_pow_ui | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src, | ||
const block | n, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst <- src^n.
dst | To store the result |
src | Source field element |
n | Source block |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 646 of file mphell-fp3.c.
void fp3_elt_random | ( | fp3_elt_ptr | dst, |
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst to a random element of FP3, the random process is chosen at the MHELL initialisation.
dst | Destination cubic extension field element |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 285 of file mphell-fp3.c.
Free space of a temporary cubic extension field element.
dst | Temporary element to free |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 59 of file mphell-fp3.c.
void fp3_elt_set | ( | fp3_elt_ptr | dst, |
number_srcptr | src1, | ||
number_srcptr | src2, | ||
number_srcptr | src3, | ||
const bool | isreduced, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst to src1 + src2*x + src3*x^2, if Montgomery arithmetic is used, is_reduced == false -> transform dst into its Montgomery form.
dst | Destination cubic extension field element |
src1 | Source number |
src2 | Source number |
src3 | Source number |
isreduced | If Montgomery arithmetic is used, is_reduced == false -> transform dst into its Montgomery form, is_reduced == true -> simple copy |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 248 of file mphell-fp3.c.
void fp3_elt_set_fp_elt | ( | fp3_elt_ptr | dst, |
fp_elt_srcptr | src, | ||
const fp3_param | param | ||
) |
Set dst to src.
dst | Destination cubic extension field element |
src | Source fp_elt |
param | Information on the cubic extension field |
Definition at line 240 of file mphell-fp3.c.
void fp3_elt_set_fp_elts | ( | fp3_elt_ptr | dst, |
fp_elt_srcptr | src1, | ||
fp_elt_srcptr | src2, | ||
fp_elt_srcptr | src3, | ||
const fp3_param | param | ||
) |
Set dst to src1 + src2*x + src3*x^2.
dst | Destination cubic extension field element |
src1 | Source fp_elt |
src2 | Source fp_elt |
src3 | Source fp_elt |
param | Information on the cubic extension field |
Definition at line 257 of file mphell-fp3.c.
void fp3_elt_set_number | ( | fp3_elt_ptr | dst, |
number_srcptr | src, | ||
const bool | isreduced, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst to src, if Montgomery arithmetic is used, is_reduced == false -> transform dst into its Montgomery form.
dst | Destination cubic extension field element |
src | Source number |
isreduced | If Montgomery arithmetic is used, is_reduced == false -> transform dst into its Montgomery form, is_reduced == true -> simple copy |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 231 of file mphell-fp3.c.
void fp3_elt_set_one | ( | fp3_elt_ptr | dst, |
const fp3_param | param | ||
) |
Set dst to one (or its Montgomery form if Montgomery arithmetic is used)
dst | Destination cubic extension field element (must be allocated) |
param | Information on the cubic extension field |
Definition at line 214 of file mphell-fp3.c.
void fp3_elt_set_str | ( | fp3_elt_ptr | dst, |
const char * | str, | ||
const uint8_t | base, | ||
const bool | isreduced, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst to str, if Montgomery arithmetic is used, is_reduced == false -> transform dst into its Montgomery form.
dst | Destination cubic extension field element |
str | Source polynomial coefficient under string format in base "base", separated by a "," without space. ex: "123,456,789" will create the polynomial 123 + 456.X + 789.X^2 |
base | Base used to write str, can be 2, 10 or 16 |
isreduced | If Montgomery arithmetic is used, is_reduced == false -> transform dst into its Montgomery form, is_reduced == true -> simple copy |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 265 of file mphell-fp3.c.
void fp3_elt_set_ui | ( | fp3_elt_ptr | dst, |
const uint64_t | src, | ||
const bool | isreduced, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst to src, if Montgomery arithmetic is used, is_reduced == false -> transform dst into its Montgomery form.
dst | Destination cubic extension field element |
src | Source block |
isreduced | If Montgomery arithmetic is used, is_reduced == false -> transform dst into its Montgomery form, is_reduced == true -> simple copy |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 222 of file mphell-fp3.c.
void fp3_elt_sqr | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst <- src^2.
dst | To store the result |
src | Source field element |
param | Information on the cubic extension field |
Definition at line 566 of file mphell-fp3.c.
void fp3_elt_sqr_fp_elt | ( | fp3_elt_ptr | dst, |
fp_elt_srcptr | src, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst <- src^2.
dst | To store the result |
src | Source field element in the prime field |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 558 of file mphell-fp3.c.
void fp3_elt_sqrt | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst <- src^(1/2), using Tonelli–Shanks algorithm.
dst | To store the result |
src | Source field element |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 833 of file mphell-fp3.c.
void fp3_elt_str | ( | char ** | str, |
fp3_elt_srcptr | src, | ||
const uint8_t | base, | ||
const bool | lift, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Converts src to string format in base specified by base.
str | Destination string, allocated by the function, must be free by the user. Polynomial coefficient are written separated by ",". ex: 123 + 456.X + 789.X^2 will be written as "123,456,789" |
src | Source cubic extension field element (under Montgomery form if Montgomery arithmetic is used) |
base | Base to use to write str, can be 2, 10 or 16 |
lift | If Montgomery arithmetic is used, lift == true -> lift src into Fp2 before conversion |
param | Information on the cubic extension field |
stack | Temporary memory stack to use |
Definition at line 321 of file mphell-fp3.c.
void fp3_elt_sub | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src1, | ||
fp3_elt_srcptr | src2, | ||
const fp3_param | param | ||
) |
Set dst <- src1 - src2.
dst | To store the result |
src1 | Source field element |
src2 | Source field element |
param | Information on the cubic extension field |
Definition at line 429 of file mphell-fp3.c.
void fp3_elt_sub_fp_elt | ( | fp3_elt_ptr | dst, |
fp3_elt_srcptr | src1, | ||
fp_elt_srcptr | src2, | ||
const fp3_param | param | ||
) |
Set dst <- src1 - src2.
dst | To store the result |
src1 | Source field element |
src2 | Source field element in the prime field |
param | Information on the cubic extension field |
Definition at line 420 of file mphell-fp3.c.
void fp3_elt_unity_nth_root | ( | fp3_elt_ptr | dst, |
const block | n, | ||
const fp3_param | param, | ||
uint8_t | stack | ||
) |
Set dst to a non trivial n-th root of unity if it exists (ie n divides q-1), 1 otherwise.
dst | To store the result |
n | Source block |
param | Information on prime field |
stack | Temporary memory stack to use |
Definition at line 1099 of file mphell-fp3.c.
void fp3_free | ( | fp3_param | param | ) |
Free the space of the cubic extension field informations structure.
param | cubic extension field informations structure |
Definition at line 143 of file mphell-fp3.c.
void fp3_get_characteristic | ( | number_ptr | c, |
const fp3_param | param | ||
) |
Get the characteristic of the cubic extension field "param".
c | Destination number (to store the characteristic) |
param | Information on cubic extension field |
Definition at line 156 of file mphell-fp3.c.
void fp3_get_size | ( | number_ptr | c, |
const fp3_param | param | ||
) |
Get the size of the cubic extension field "param".
c | Destination number (to store the characteristic) |
param | Information on cubic extension field |
Definition at line 162 of file mphell-fp3.c.
void fp3_str | ( | char ** | str, |
const fp3_param | param, | ||
const uint8_t | base, | ||
uint8_t | stack | ||
) |
Converts fp2_param param to string format in base specified by base.
str | Destination string, allocated by the function, must be free by the user. |
param | Information on the cubic extension field |
base | Base to use to write str, can be 2, 10 or 16 |
stack | Temporary memory stack to use |
Definition at line 301 of file mphell-fp3.c.