finitefield.h File Reference

Finite field interface. More...

Typedefs

typedef struct FiniteField FiniteField
 A finite field.
 
typedef struct FfElement FfElement
 An element in a finite field.
 

Functions

EpidStatus NewFiniteField (BigNumStr const *prime, FiniteField **ff)
 Creates new finite field. More...
 
EpidStatus NewFiniteFieldViaBinomalExtension (FiniteField const *ground_field, FfElement const *ground_element, int degree, FiniteField **ff)
 Creates a new finite field using binomial extension. More...
 
void DeleteFiniteField (FiniteField **ff)
 Frees a previously allocated FiniteField. More...
 
EpidStatus NewFfElement (FiniteField const *ff, FfElement **new_ff_elem)
 Creates a new finite field element. More...
 
void DeleteFfElement (FfElement **ff_elem)
 Frees a previously allocated FfElement. More...
 
EpidStatus ReadFfElement (FiniteField *ff, void const *ff_elem_str, size_t strlen, FfElement *ff_elem)
 Deserializes a FfElement from a string. More...
 
EpidStatus WriteFfElement (FiniteField *ff, FfElement const *ff_elem, void *ff_elem_str, size_t strlen)
 Serializes a finite field element to a string. More...
 
EpidStatus FfNeg (FiniteField *ff, FfElement const *a, FfElement *r)
 Calculates the additive inverse of a finite field element. More...
 
EpidStatus FfInv (FiniteField *ff, FfElement const *a, FfElement *r)
 Calculates the multiplicative inverse of a finite field element. More...
 
EpidStatus FfAdd (FiniteField *ff, FfElement const *a, FfElement const *b, FfElement *r)
 Adds two finite field elements. More...
 
EpidStatus FfMul (FiniteField *ff, FfElement const *a, FfElement const *b, FfElement *r)
 Multiplies two finite field elements. More...
 
EpidStatus FfIsZero (FiniteField *ff, FfElement const *a, bool *is_zero)
 Checks if given finite field element is the additive identity (zero). More...
 
EpidStatus FfExp (FiniteField *ff, FfElement const *a, BigNum const *b, FfElement *r)
 Raises an element of a finite field to a power. More...
 
EpidStatus FfMultiExp (FiniteField *ff, FfElement const **a, BigNumStr const **b, size_t m, FfElement *r)
 Multi-exponentiates finite field elements. More...
 
EpidStatus FfSscmMultiExp (FiniteField *ff, FfElement const **a, BigNumStr const **b, size_t m, FfElement *r)
 Software side-channel mitigated implementation of FfMultiExp. More...
 
EpidStatus FfIsEqual (FiniteField *ff, FfElement const *a, FfElement const *b, bool *is_equal)
 Checks if two finite field elements are equal. More...
 
EpidStatus FfHash (FiniteField *ff, void const *msg, size_t msg_len, HashAlg hash_alg, FfElement *r)
 Hashes an arbitrary message to an element in a finite field. More...
 
EpidStatus FfGetRandom (FiniteField *ff, BigNumStr const *low_bound, BitSupplier rnd_func, void *rnd_param, FfElement *r)
 Generate random finite field element. More...
 

Detailed Description

Finite field interface.