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

Functions for policy conversion needed for ABE schemes. More...

Go to the source code of this file.

Data Structures

struct  cfe_msp
 

Typedefs

typedef struct cfe_msp cfe_msp
 

Functions

cfe_error cfe_boolean_to_msp (cfe_msp *msp, char *bool_exp, size_t bool_exp_len, bool convert_to_ones)
 
cfe_error cfe_boolean_to_msp_iterative (cfe_msp *msp, cfe_string *bool_exp, cfe_vec *vec, size_t c)
 
void cfe_init_set_vecs_and (cfe_vec *vec1, cfe_vec *vec2, cfe_vec *vec, size_t c)
 
void cfe_msp_free (cfe_msp *msp)
 

Detailed Description

Functions for policy conversion needed for ABE schemes.

Typedef Documentation

◆ cfe_msp

typedef struct cfe_msp cfe_msp

cfe_msp represents a monotone span program (MSP) describing a policy defining which attributes are needed to decrypt the ciphertext. It includes a matrix and a mapping from the rows of the matrix to attributes. A MSP policy allows decryption of an entity with a set of attributes A if an only if all the rows of the matrix mapped to an element of A span the vector 1, 0,..., 0.

Function Documentation

◆ cfe_boolean_to_msp()

cfe_error cfe_boolean_to_msp ( cfe_msp msp,
char *  bool_exp,
size_t  bool_exp_len,
bool  convert_to_ones 
)

cfe_boolean_to_msp takes as an input a boolean expression (without a NOT gate) and outputs a msp structure representing the expression, i.e. a matrix whose rows correspond to attributes used in the expression and with the property that a boolean expression assigning 1 to some attributes is satisfied iff the corresponding rows span a vector [1, 1,..., 1] or vector [1, 0,..., 0] depending if parameter convert_to_ones is set to true or false. Additionally a vector is produced whose i-th entry indicates to which attribute the i-th row corresponds. The boolean expression is a string where attributes are written as integers (hence they must not be greater than what int can hold) separated with AND and OR gates, with brackets defining the order of the gates.

Parameters
mspA pointer to an uninitialized cfe_msp struct representing the MSP structure; the result will be saved here
bool_expA string with the boolean expression
bool_exp_lenLength of the string with the boolean expression
convert_to_onesA boolean value defining which vector must the MSP matrix span, a vector [1, 1,..., 1] if set to true or vector [1, 0,..., 0] if set to false
Returns
Returns an error if the boolean expression is not in the proper form and cannot be transformed.

◆ cfe_boolean_to_msp_iterative()

cfe_error cfe_boolean_to_msp_iterative ( cfe_msp msp,
cfe_string bool_exp,
cfe_vec vec,
size_t  c 
)

A helping function used in boolean_to_msp.

◆ cfe_init_set_vecs_and()

void cfe_init_set_vecs_and ( cfe_vec vec1,
cfe_vec vec2,
cfe_vec vec,
size_t  c 
)

A helping function used in boolean_to_msp_iterative.

◆ cfe_msp_free()

void cfe_msp_free ( cfe_msp msp)

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

Parameters
mspA pointer to a MSP (initialized cfe_msp struct)