libdecaf
Loading...
Searching...
No Matches
f_field.h File Reference

Field-specific code for 2^255 - 19. More...

Go to the source code of this file.

Classes

struct  gf_25519_s

Macros

#define __DECAF_25519_GF_DEFINED__   1
#define NLIMBS   (40/sizeof(word_t))
#define SER_BYTES   32
#define GF_LIT_LIMB_BITS   51
#define GF_BITS   255
#define ZERO   gf_25519_ZERO
#define ONE   gf_25519_ONE
#define MODULUS   gf_25519_MODULUS
#define gf   gf_25519_t
#define gf_s   gf_25519_s
#define gf_eq   gf_25519_eq
#define gf_lobit   gf_25519_lobit
#define gf_copy   gf_25519_copy
#define gf_add   gf_25519_add
#define gf_sub   gf_25519_sub
#define gf_add_RAW   gf_25519_add_RAW
#define gf_sub_RAW   gf_25519_sub_RAW
#define gf_bias   gf_25519_bias
#define gf_weak_reduce   gf_25519_weak_reduce
#define gf_strong_reduce   gf_25519_strong_reduce
#define gf_mul   gf_25519_mul
#define gf_sqr   gf_25519_sqr
#define gf_mulw_unsigned   gf_25519_mulw_unsigned
#define gf_isr   gf_25519_isr
#define gf_serialize   gf_25519_serialize
#define gf_deserialize   gf_25519_deserialize
#define X_PUBLIC_BYTES   SER_BYTES
#define X_PRIVATE_BYTES   X_PUBLIC_BYTES
#define X_PRIVATE_BITS   255
#define SQRT_MINUS_ONE   P25519_SQRT_MINUS_ONE /* might not be defined */
#define INLINE_UNUSED   __inline__ __attribute__((unused,always_inline))
#define P_MOD_8   5
#define LIMBPERM(i)
#define LIMB_MASK(i)

Typedefs

typedef struct gf_25519_s gf_25519_s
typedef struct gf_25519_s gf_25519_t[1]

Functions

void gf_strong_reduce (gf inout)
 Reduce to canonical form.
void gf_add (gf out, const gf a, const gf b)
 Add two field elements d = a+b.
void gf_sub (gf out, const gf a, const gf b)
 Subtract two gf elements d=a-b.
void gf_mul (gf_s *__restrict__ out, const gf a, const gf b)
void gf_mulw_unsigned (gf_s *__restrict__ out, const gf a, uint32_t b)
void gf_sqr (gf_s *__restrict__ out, const gf a)
mask_t gf_isr (gf a, const gf x)
mask_t gf_eq (const gf x, const gf y)
 a^2 x = 1, QNR, or 0 if x=0.
mask_t gf_lobit (const gf x)
 Return high bit of x = low bit of 2x mod p.
void gf_serialize (uint8_t serial[SER_BYTES], const gf x)
 Serialize to wire format.
mask_t gf_deserialize (gf x, const uint8_t serial[SER_BYTES], uint8_t hi_nmask)
 Deserialize from wire format; return -1 on success and 0 on failure.

Detailed Description

Field-specific code for 2^255 - 19.

Author
Mike Hamburg
Warning
This file was automatically generated in Python. Please do not edit it.

Macro Definition Documentation

◆ LIMB_MASK

#define LIMB_MASK ( i)
Value:
(((1ull)<<LIMB_PLACE_VALUE(i))-1)

◆ LIMBPERM

#define LIMBPERM ( i)
Value:
(i)

Function Documentation

◆ gf_eq()

mask_t gf_eq ( const gf a,
const gf b )

a^2 x = 1, QNR, or 0 if x=0.

Return true if successful

a^2 x = 1, QNR, or 0 if x=0.