| 1 | #ifndef FE25519_H |
| 2 | #define FE25519_H |
| 3 | |
| 4 | #define fe25519 crypto_sign_ed25519_amd64_51_30k_batch_fe25519 |
| 5 | #define fe25519_freeze crypto_sign_ed25519_amd64_51_30k_batch_fe25519_freeze |
| 6 | #define fe25519_unpack crypto_sign_ed25519_amd64_51_30k_batch_fe25519_unpack |
| 7 | #define fe25519_pack crypto_sign_ed25519_amd64_51_30k_batch_fe25519_pack |
| 8 | #define fe25519_iszero_vartime crypto_sign_ed25519_amd64_51_30k_batch_fe25519_iszero_vartime |
| 9 | #define fe25519_iseq_vartime crypto_sign_ed25519_amd64_51_30k_batch_fe25519_iseq_vartime |
| 10 | #define fe25519_cmov crypto_sign_ed25519_amd64_51_30k_batch_fe25519_cmov |
| 11 | #define fe25519_setint crypto_sign_ed25519_amd64_51_30k_batch_fe25519_setint |
| 12 | #define fe25519_neg crypto_sign_ed25519_amd64_51_30k_batch_fe25519_neg |
| 13 | #define fe25519_getparity crypto_sign_ed25519_amd64_51_30k_batch_fe25519_getparity |
| 14 | #define fe25519_add crypto_sign_ed25519_amd64_51_30k_batch_fe25519_add |
| 15 | #define fe25519_sub crypto_sign_ed25519_amd64_51_30k_batch_fe25519_sub |
| 16 | #define fe25519_mul crypto_sign_ed25519_amd64_51_30k_batch_fe25519_mul |
| 17 | #define fe25519_mul121666 crypto_sign_ed25519_amd64_51_30k_batch_fe25519_mul121666 |
| 18 | #define fe25519_square crypto_sign_ed25519_amd64_51_30k_batch_fe25519_square |
| 19 | #define fe25519_nsquare crypto_sign_ed25519_amd64_51_30k_batch_fe25519_nsquare |
| 20 | #define fe25519_invert crypto_sign_ed25519_amd64_51_30k_batch_fe25519_invert |
| 21 | #define fe25519_pow2523 crypto_sign_ed25519_amd64_51_30k_batch_fe25519_pow2523 |
| 22 | |
| 23 | typedef struct |
| 24 | { |
| 25 | unsigned long long v[5]; |
| 26 | } |
| 27 | fe25519; |
| 28 | |
| 29 | void fe25519_freeze(fe25519 *r); |
| 30 | |
| 31 | void fe25519_unpack(fe25519 *r, const unsigned char x[32]); |
| 32 | |
| 33 | void fe25519_pack(unsigned char r[32], const fe25519 *x); |
| 34 | |
| 35 | void fe25519_cmov(fe25519 *r, const fe25519 *x, unsigned char b); |
| 36 | |
| 37 | void fe25519_cswap(fe25519 *r, fe25519 *x, unsigned char b); |
| 38 | |
| 39 | void fe25519_setint(fe25519 *r, unsigned int v); |
| 40 | |
| 41 | void fe25519_neg(fe25519 *r, const fe25519 *x); |
| 42 | |
| 43 | unsigned char fe25519_getparity(const fe25519 *x); |
| 44 | |
| 45 | int fe25519_iszero_vartime(const fe25519 *x); |
| 46 | |
| 47 | int fe25519_iseq_vartime(const fe25519 *x, const fe25519 *y); |
| 48 | |
| 49 | void fe25519_add(fe25519 *r, const fe25519 *x, const fe25519 *y); |
| 50 | |
| 51 | void fe25519_sub(fe25519 *r, const fe25519 *x, const fe25519 *y); |
| 52 | |
| 53 | void fe25519_mul(fe25519 *r, const fe25519 *x, const fe25519 *y); |
| 54 | |
| 55 | void fe25519_mul121666(fe25519 *r, const fe25519 *x); |
| 56 | |
| 57 | void fe25519_square(fe25519 *r, const fe25519 *x); |
| 58 | |
| 59 | void fe25519_nsquare(fe25519 *r, unsigned long long n); |
| 60 | |
| 61 | void fe25519_invert(fe25519 *r, const fe25519 *x); |
| 62 | |
| 63 | void fe25519_pow2523(fe25519 *r, const fe25519 *x); |
| 64 | |
| 65 | #endif |