CiFEr
Data Structures | Typedefs | Functions
vec_curve.h File Reference

Vectors of elements of an elliptic curve struct and operations on it. More...

Go to the source code of this file.

Data Structures

struct  cfe_vec_G1
 
struct  cfe_vec_G2
 
struct  cfe_vec_GT
 
struct  cfe_vec_octet
 

Typedefs

typedef struct cfe_vec_G1 cfe_vec_G1
 
typedef struct cfe_vec_G2 cfe_vec_G2
 
typedef struct cfe_vec_GT cfe_vec_GT
 
typedef struct cfe_vec_octet cfe_vec_octet
 

Functions

void cfe_vec_G1_init (cfe_vec_G1 *v, size_t size)
 
void cfe_vec_G1_inf (cfe_vec_G1 *v)
 
void cfe_vec_mul_G1 (cfe_vec_G1 *v, cfe_vec *u)
 
void cfe_vec_mul_vec_G1 (cfe_vec_G1 *res, cfe_vec *u, cfe_vec_G1 *v)
 
void cfe_vec_G2_init (cfe_vec_G2 *v, size_t size)
 
void cfe_vec_G2_inf (cfe_vec_G2 *v)
 
void cfe_vec_mul_G2 (cfe_vec_G2 *v, cfe_vec *u)
 
void cfe_vec_mul_vec_G2 (cfe_vec_G2 *res, cfe_vec *u, cfe_vec_G2 *v)
 
void cfe_vec_GT_init (cfe_vec_GT *v, size_t size)
 
void cfe_vec_GT_inf (cfe_vec_GT *v)
 
void cfe_vec_mul_GT (cfe_vec_GT *v, cfe_vec *u)
 
void cfe_vec_G1_free (cfe_vec_G1 *v)
 
void cfe_vec_G2_free (cfe_vec_G2 *v)
 
void cfe_vec_GT_free (cfe_vec_GT *v)
 
void cfe_vec_octet_init (cfe_vec_octet *v, size_t size)
 
void cfe_vec_octet_free (cfe_vec_octet *v)
 

Detailed Description

Vectors of elements of an elliptic curve struct and operations on it.

Typedef Documentation

◆ cfe_vec_G1

typedef struct cfe_vec_G1 cfe_vec_G1

Vector of ECP_BN254 elements.

◆ cfe_vec_G2

typedef struct cfe_vec_G2 cfe_vec_G2

Vector of ECP2_BN254 elements.

◆ cfe_vec_GT

typedef struct cfe_vec_GT cfe_vec_GT

Vector of FP12_BN254 elements.

◆ cfe_vec_octet

typedef struct cfe_vec_octet cfe_vec_octet

Vector of octets elements.

Function Documentation

◆ cfe_vec_G1_init()

void cfe_vec_G1_init ( cfe_vec_G1 v,
size_t  size 
)

Initializes a vector of ECP_BN254 elements of given size.

Parameters
vA pointer to an uninitialized cfe_vec_G1 vector
sizeSize of the vector

◆ cfe_vec_G1_inf()

void cfe_vec_G1_inf ( cfe_vec_G1 v)

Sets all the values of a vector to the identity element.

Parameters
vA pointer to an initialized cfe_vec_G1 vector

◆ cfe_vec_mul_G1()

void cfe_vec_mul_G1 ( cfe_vec_G1 v,
cfe_vec u 
)

Creates a vector whose i-th element equals u[i] * g, where g is the generator of ECP_BN254. The sizes of v and u must match.

Parameters
vA pointer to an initialized cfe_vec_G1 vector
uA pointer to vector of integers

◆ cfe_vec_mul_vec_G1()

void cfe_vec_mul_vec_G1 ( cfe_vec_G1 res,
cfe_vec u,
cfe_vec_G1 v 
)

Creates a vector whose i-th element equals u[i] * v[i], where v[i] is an element in ECP_BN254. The sizes of res, v and u must match.

Parameters
resA pointer to an initialized cfe_vec_G1 vector, the result will be saved here
uA pointer to vector of integers
vA pointer to a cfe_vec_G1 vector

◆ cfe_vec_G2_init()

void cfe_vec_G2_init ( cfe_vec_G2 v,
size_t  size 
)

Initializes a vector of ECP2_BN254 elements of given size.

Parameters
vA pointer to an uninitialized cfe_vec_G2 vector
sizeSize of the vector

◆ cfe_vec_G2_inf()

void cfe_vec_G2_inf ( cfe_vec_G2 v)

Sets all the values of a vector to the identity element.

Parameters
vA pointer to an initialized cfe_vec_G2 vector

◆ cfe_vec_mul_G2()

void cfe_vec_mul_G2 ( cfe_vec_G2 v,
cfe_vec u 
)

Creates a vector whose i-th element equals u[i] * g, where g is the generator of ECP2_BN254. The sizes of v and u must match.

Parameters
vA pointer to an initialized cfe_vec_G2 vector
uA pointer to vector of integers.

◆ cfe_vec_mul_vec_G2()

void cfe_vec_mul_vec_G2 ( cfe_vec_G2 res,
cfe_vec u,
cfe_vec_G2 v 
)

Creates a vector whose i-th element equals u[i] * v[i], where v[i] is an element in ECP2_BN254. The sizes of res, v and u must match.

Parameters
resA pointer to an initialized cfe_vec_G2 vector, the result will be saved here
uA pointer to vector of integers
vA pointer to a cfe_vec_G2 vector

◆ cfe_vec_GT_init()

void cfe_vec_GT_init ( cfe_vec_GT v,
size_t  size 
)

Initializes a vector of FP12_BN254 elements of given size.

Parameters
vA pointer to an uninitialized cfe_vec_GT vector
sizeSize of the vector

◆ cfe_vec_GT_inf()

void cfe_vec_GT_inf ( cfe_vec_GT v)

Sets all the values of a vector to the identity element.

Parameters
vA pointer to an initialized cfe_vec_GT vector

◆ cfe_vec_mul_GT()

void cfe_vec_mul_GT ( cfe_vec_GT v,
cfe_vec u 
)

Creates a vector whose i-th element equals u[i] * g, where g is the generator of FP12_BN254. The sizes of v and u must match.

Parameters
vA pointer to an initialized cfe_vec_GT vector
uA pointer to vector of integers.

◆ cfe_vec_G1_free()

void cfe_vec_G1_free ( cfe_vec_G1 v)

Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.

Parameters
vA pointer to a vector (initialized cfe_vec_G1 struct)

◆ cfe_vec_G2_free()

void cfe_vec_G2_free ( cfe_vec_G2 v)

Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.

Parameters
vA pointer to a vector (initialized cfe_vec_G2 struct)

◆ cfe_vec_GT_free()

void cfe_vec_GT_free ( cfe_vec_GT v)

Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.

Parameters
vA pointer to a vector (initialized cfe_vec_GT struct)

◆ cfe_vec_octet_init()

void cfe_vec_octet_init ( cfe_vec_octet v,
size_t  size 
)

Initializes a vector of octet elements of given size.

Parameters
vA pointer to an uninitialized cfe_vec_G1 vector
sizeSize of the vector

◆ cfe_vec_octet_free()

void cfe_vec_octet_free ( cfe_vec_octet v)

Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.

Parameters
vA pointer to a vector (initialized cfe_vec_octet struct)