efq.h File Reference

Definition of EFq math. More...

#include <stddef.h>
#include "epid/common/bitsupplier.h"
#include "epid/common/types.h"

Functions

void EFqMulSSCM (EccPointJacobiFq *result, EccPointJacobiFq const *base, FpElem const *exp)
 Multiply two points in EFq. More...
 
int EFqAffineExp (EccPointFq *result, EccPointFq const *base, FpElem const *exp)
 Exponentiate a point in EFq by an element of Fp. More...
 
int EFqAffineMultiExp (EccPointFq *result, EccPointFq const *base0, FpElem const *exp0, EccPointFq const *base1, FpElem const *exp1)
 Sum the results of exponentiating two points in EFq by elements of Fp. More...
 
void EFqMultiExp (EccPointJacobiFq *result, EccPointJacobiFq const *base0, FpElem const *exp0, EccPointJacobiFq const *base1, FpElem const *exp1)
 Sum the results of exponentiating two points in EFq by elements of Fp. More...
 
int EFqAffineAdd (EccPointFq *result, EccPointFq const *left, EccPointFq const *right)
 Add two points in EFq. More...
 
int EFqAffineDbl (EccPointFq *result, EccPointFq const *in)
 Double a point in EFq. More...
 
void EFqDbl (EccPointJacobiFq *result, EccPointJacobiFq const *in)
 Double a point in EFq. More...
 
void EFqAdd (EccPointJacobiFq *result, EccPointJacobiFq const *left, EccPointJacobiFq const *right)
 Add two points in EFq. More...
 
int EFqRand (EccPointFq *result, BitSupplier rnd_func, void *rnd_param)
 Generate a random point in EFq. More...
 
void EFqSet (EccPointJacobiFq *result, FqElem const *x, FqElem const *y)
 Set a point's value. More...
 
int EFqIsInf (EccPointJacobiFq const *in)
 Test if a point is infinity. More...
 
void EFqFromAffine (EccPointJacobiFq *result, EccPointFq const *in)
 Convert a point from Affine to Jacobi representation. More...
 
int EFqToAffine (EccPointFq *result, EccPointJacobiFq const *in)
 Convert a point from Jacobi to Affine representation. More...
 
void EFqNeg (EccPointJacobiFq *result, EccPointJacobiFq const *in)
 Negate a point on EFq. More...
 
int EFqEq (EccPointJacobiFq const *left, EccPointJacobiFq const *right)
 Test if two points on EFq are equal. More...
 
int EFqHash (EccPointFq *result, unsigned char const *msg, size_t len, HashAlg hashalg)
 Hashes an arbitrary message to a point on EFq. More...
 
void EFqCp (EccPointFq *result, EccPointFq const *in)
 Copy a point's value. More...
 
int EFqEqAffine (EccPointFq const *left, EccPointFq const *right)
 Test if two points on EFq are equal. More...
 
void EFqCondSet (EccPointJacobiFq *result, EccPointJacobiFq const *true_val, EccPointJacobiFq const *false_val, int truth_val)
 Conditionally Set a point's value to one of two values. More...
 
void EFqJCp (EccPointJacobiFq *result, EccPointJacobiFq const *in)
 Copy a point's value. More...
 
void EFqInf (EccPointJacobiFq *result)
 Set an element's value to infinity. More...
 
int EFqOnCurve (EccPointFq const *in)
 Test if a point is on EFq. More...
 
int EFqJOnCurve (EccPointJacobiFq const *in)
 Test if a point is on EFq. More...
 
int EFqJRand (EccPointJacobiFq *result, BitSupplier rnd_func, void *rnd_param)
 Generate a random point in EFq. More...
 

Detailed Description

Definition of EFq math.

Function Documentation

◆ EFqAdd()

void EFqAdd ( EccPointJacobiFq result,
EccPointJacobiFq const *  left,
EccPointJacobiFq const *  right 
)

Add two points in EFq.

Parameters
[out]resultof adding left and right.
[in]leftThe first operand to be added.
[in]rightThe second operand to be added.

◆ EFqAffineAdd()

int EFqAffineAdd ( EccPointFq result,
EccPointFq const *  left,
EccPointFq const *  right 
)

Add two points in EFq.

Parameters
[out]resultof adding left and right.
[in]leftThe first operand to be added.
[in]rightThe second operand to be added.
Returns
A value different from zero (i.e., true) if on success. Zero (i.e., false) otherwise.

◆ EFqAffineDbl()

int EFqAffineDbl ( EccPointFq result,
EccPointFq const *  in 
)

Double a point in EFq.

Parameters
[out]resulttarget.
[in]inthe value to double.
Returns
A value different from zero (i.e., true) if on success. Zero (i.e., false) otherwise.

◆ EFqAffineExp()

int EFqAffineExp ( EccPointFq result,
EccPointFq const *  base,
FpElem const *  exp 
)

Exponentiate a point in EFq by an element of Fp.

Parameters
[out]resulttarget.
[in]basethe base.
[in]expthe exponent.
Returns
A value different from zero (i.e., true) if on success. Zero (i.e., false) otherwise.
1 on success, 0 on failure

◆ EFqAffineMultiExp()

int EFqAffineMultiExp ( EccPointFq result,
EccPointFq const *  base0,
FpElem const *  exp0,
EccPointFq const *  base1,
FpElem const *  exp1 
)

Sum the results of exponentiating two points in EFq by elements of Fp.

Parameters
[out]resulttarget.
[in]base0the first base.
[in]exp0the first exponent.
[in]base1the second base.
[in]exp1the second exponent.
Returns
A value different from zero (i.e., true) if on success. Zero (i.e., false) otherwise.

◆ EFqCondSet()

void EFqCondSet ( EccPointJacobiFq result,
EccPointJacobiFq const *  true_val,
EccPointJacobiFq const *  false_val,
int  truth_val 
)

Conditionally Set a point's value to one of two values.

Parameters
[out]resulttarget.
[in]true_valvalue to set if condition is true.
[in]false_valvalue to set if condition is false.
[in]truth_valvalue of condition.

◆ EFqCp()

void EFqCp ( EccPointFq result,
EccPointFq const *  in 
)

Copy a point's value.

Parameters
[out]resultcopy target.
[in]incopy source.

◆ EFqDbl()

void EFqDbl ( EccPointJacobiFq result,
EccPointJacobiFq const *  in 
)

Double a point in EFq.

Parameters
[out]resulttarget.
[in]inthe value to double.

◆ EFqEq()

int EFqEq ( EccPointJacobiFq const *  left,
EccPointJacobiFq const *  right 
)

Test if two points on EFq are equal.

Parameters
[in]leftThe first operand to be tested.
[in]rightThe second operand to be tested.
Returns
A value different from zero (i.e., true) if indeed the values are equal. Zero (i.e., false) otherwise.

◆ EFqEqAffine()

int EFqEqAffine ( EccPointFq const *  left,
EccPointFq const *  right 
)

Test if two points on EFq are equal.

Parameters
[in]leftThe first operand to be tested.
[in]rightThe second operand to be tested.
Returns
A value different from zero (i.e., true) if indeed the values are equal. Zero (i.e., false) otherwise.

◆ EFqFromAffine()

void EFqFromAffine ( EccPointJacobiFq result,
EccPointFq const *  in 
)

Convert a point from Affine to Jacobi representation.

Parameters
[out]resulttarget.
[in]invalue to set.

◆ EFqHash()

int EFqHash ( EccPointFq result,
unsigned char const *  msg,
size_t  len,
HashAlg  hashalg 
)

Hashes an arbitrary message to a point on EFq.

Parameters
[out]resulttarget.
[in]msgbuffer to reinterpret.
[in]lenlength of msg in bytes.
[in]hashalghash algorithm to use.
Returns
A value different from zero (i.e., true) if on success. Zero (i.e., false) otherwise.

◆ EFqInf()

void EFqInf ( EccPointJacobiFq result)

Set an element's value to infinity.

Parameters
[out]resultelement to set.

◆ EFqIsInf()

int EFqIsInf ( EccPointJacobiFq const *  in)

Test if a point is infinity.

Parameters
[in]inthe point to test.
Returns
A value different from zero (i.e., true) indeed the value is infinity. Zero (i.e., false) otherwise.

◆ EFqJCp()

void EFqJCp ( EccPointJacobiFq result,
EccPointJacobiFq const *  in 
)

Copy a point's value.

Parameters
[out]resultcopy target.
[in]incopy source.

◆ EFqJOnCurve()

int EFqJOnCurve ( EccPointJacobiFq const *  in)

Test if a point is on EFq.

Parameters
[in]inthe point to test.
Returns
A value different from zero (i.e., true) indeed the point is on the curve. Zero (i.e., false) otherwise.

◆ EFqJRand()

int EFqJRand ( EccPointJacobiFq result,
BitSupplier  rnd_func,
void *  rnd_param 
)

Generate a random point in EFq.

Parameters
[in]resultthe random value.
[in]rnd_funcRandom number generator.
[in]rnd_paramPass through context data for rnd_func.
Returns
A value different from zero (i.e., true) if on success. Zero (i.e., false) otherwise.

◆ EFqMulSSCM()

void EFqMulSSCM ( EccPointJacobiFq result,
EccPointJacobiFq const *  base,
FpElem const *  exp 
)

Multiply two points in EFq.

This function is mitigated against software side-channel attacks.

Parameters
[out]resultof multiplying left and right.
[in]baseThe first operand to be multiplied.
[in]expThe second operand to be multiplied.

◆ EFqMultiExp()

void EFqMultiExp ( EccPointJacobiFq result,
EccPointJacobiFq const *  base0,
FpElem const *  exp0,
EccPointJacobiFq const *  base1,
FpElem const *  exp1 
)

Sum the results of exponentiating two points in EFq by elements of Fp.

Parameters
[out]resulttarget.
[in]base0the first base.
[in]exp0the first exponent.
[in]base1the second base.
[in]exp1the second exponent.
Returns
1 on success, 0 on failure

◆ EFqNeg()

void EFqNeg ( EccPointJacobiFq result,
EccPointJacobiFq const *  in 
)

Negate a point on EFq.

Parameters
[out]resultthe negative of the element.
[in]inthe element to negate.

◆ EFqOnCurve()

int EFqOnCurve ( EccPointFq const *  in)

Test if a point is on EFq.

Parameters
[in]inthe point to test.
Returns
A value different from zero (i.e., true) indeed the point is on the curve. Zero (i.e., false) otherwise.

◆ EFqRand()

int EFqRand ( EccPointFq result,
BitSupplier  rnd_func,
void *  rnd_param 
)

Generate a random point in EFq.

Parameters
[in]resultthe random value.
[in]rnd_funcRandom number generator.
[in]rnd_paramPass through context data for rnd_func.
Returns
A value different from zero (i.e., true) if on success. Zero (i.e., false) otherwise.

◆ EFqSet()

void EFqSet ( EccPointJacobiFq result,
FqElem const *  x,
FqElem const *  y 
)

Set a point's value.

Parameters
[out]resulttarget.
[in]xvalue to set.
[in]yvalue to set.

◆ EFqToAffine()

int EFqToAffine ( EccPointFq result,
EccPointJacobiFq const *  in 
)

Convert a point from Jacobi to Affine representation.

Parameters
[out]resulttarget.
[in]invalue to set.
Returns
A value different from zero (i.e., true) if on success. Zero (i.e., false) otherwise.