| 1 |
root |
1.1 |
#ifndef FE_H |
| 2 |
|
|
#define FE_H |
| 3 |
|
|
|
| 4 |
|
|
#include "fixedint.h" |
| 5 |
|
|
|
| 6 |
|
|
|
| 7 |
|
|
/* |
| 8 |
|
|
fe means field element. |
| 9 |
|
|
Here the field is \Z/(2^255-19). |
| 10 |
|
|
An element t, entries t[0]...t[9], represents the integer |
| 11 |
|
|
t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9]. |
| 12 |
|
|
Bounds on each t[i] vary depending on context. |
| 13 |
|
|
*/ |
| 14 |
|
|
|
| 15 |
|
|
|
| 16 |
|
|
typedef int32_t fe[10]; |
| 17 |
|
|
|
| 18 |
|
|
|
| 19 |
root |
1.2 |
static |
| 20 |
root |
1.1 |
void fe_0(fe h); |
| 21 |
root |
1.2 |
static |
| 22 |
root |
1.1 |
void fe_1(fe h); |
| 23 |
|
|
|
| 24 |
root |
1.2 |
static |
| 25 |
root |
1.1 |
void fe_frombytes(fe h, const unsigned char *s); |
| 26 |
root |
1.2 |
static |
| 27 |
root |
1.1 |
void fe_tobytes(unsigned char *s, const fe h); |
| 28 |
|
|
|
| 29 |
root |
1.2 |
static |
| 30 |
root |
1.1 |
void fe_copy(fe h, const fe f); |
| 31 |
root |
1.2 |
static |
| 32 |
root |
1.1 |
int fe_isnegative(const fe f); |
| 33 |
root |
1.2 |
static |
| 34 |
root |
1.1 |
int fe_isnonzero(const fe f); |
| 35 |
root |
1.2 |
static |
| 36 |
root |
1.1 |
void fe_cmov(fe f, const fe g, unsigned int b); |
| 37 |
root |
1.2 |
static |
| 38 |
root |
1.1 |
void fe_cswap(fe f, fe g, unsigned int b); |
| 39 |
|
|
|
| 40 |
root |
1.2 |
static |
| 41 |
root |
1.1 |
void fe_neg(fe h, const fe f); |
| 42 |
root |
1.2 |
static |
| 43 |
root |
1.1 |
void fe_add(fe h, const fe f, const fe g); |
| 44 |
root |
1.2 |
static |
| 45 |
root |
1.1 |
void fe_invert(fe out, const fe z); |
| 46 |
root |
1.2 |
static |
| 47 |
root |
1.1 |
void fe_sq(fe h, const fe f); |
| 48 |
root |
1.2 |
static |
| 49 |
root |
1.1 |
void fe_sq2(fe h, const fe f); |
| 50 |
root |
1.2 |
static |
| 51 |
root |
1.1 |
void fe_mul(fe h, const fe f, const fe g); |
| 52 |
root |
1.2 |
static |
| 53 |
root |
1.1 |
void fe_mul121666(fe h, fe f); |
| 54 |
root |
1.2 |
static |
| 55 |
root |
1.1 |
void fe_pow22523(fe out, const fe z); |
| 56 |
root |
1.2 |
static |
| 57 |
root |
1.1 |
void fe_sub(fe h, const fe f, const fe g); |
| 58 |
|
|
|
| 59 |
|
|
#endif |