CiFEr
|
Damgard multi input scheme. More...
Go to the source code of this file.
Data Structures | |
struct | cfe_damgard_multi |
struct | cfe_damgard_multi_sec_key |
struct | cfe_damgard_multi_fe_key |
struct | cfe_damgard_multi_client |
Typedefs | |
typedef struct cfe_damgard_multi | cfe_damgard_multi |
typedef struct cfe_damgard_multi_sec_key | cfe_damgard_multi_sec_key |
typedef struct cfe_damgard_multi_fe_key | cfe_damgard_multi_fe_key |
typedef struct cfe_damgard_multi_client | cfe_damgard_multi_client |
Damgard multi input scheme.
typedef struct cfe_damgard_multi cfe_damgard_multi |
cfe_damgard_multi represents a multi input variant of the underlying Damgard scheme.
typedef struct cfe_damgard_multi_sec_key cfe_damgard_multi_sec_key |
cfe_damgard_multi_sec_key is a secret key for Damgard multi input scheme.
typedef struct cfe_damgard_multi_fe_key cfe_damgard_multi_fe_key |
cfe_damgard_multi_fe_key is a functional encryption key for Damgard multi input scheme.
typedef struct cfe_damgard_multi_client cfe_damgard_multi_client |
cfe_damgard_multi_client represents a single encryptor for the damgard_multi scheme.
cfe_error cfe_damgard_multi_init | ( | cfe_damgard_multi * | m, |
size_t | num_clients, | ||
size_t | l, | ||
size_t | modulus_len, | ||
mpz_t | bound | ||
) |
Configures a new instance of the scheme. It accepts the number of clients (encryptors), the length of input vectors l, the bit length of the modulus (we are operating in the Z_p group), and a bound by which coordinates of input vectors are bounded.
m | A pointer to an uninitialized struct representing the scheme |
num_clients | The number of clients (encryptors) |
l | The length of input vectors |
modulus_len | The bit length of the modulus (we are operating in the Z_p group) |
bound | The bound by which coordinates of input vectors are bounded. |
cfe_error cfe_damgard_multi_precomp_init | ( | cfe_damgard_multi * | m, |
size_t | num_clients, | ||
size_t | l, | ||
size_t | modulus_len, | ||
mpz_t | bound | ||
) |
Configures a new instance of the scheme based on precomputed prime numbers and generators. It accepts the number of clients (encryptors), the length of input vectors l, the bit length of the modulus (we are operating in the Z_p group), and a bound by which coordinates of input vectors are bounded.
m | A pointer to an uninitialized struct representing the scheme |
num_clients | The number of clients (encryptors) |
l | The length of input vectors |
modulus_len | The bit length of the modulus (we are operating in the Z_p group) |
bound | The bound by which coordinates of input vectors are bounded. |
void cfe_damgard_multi_free | ( | cfe_damgard_multi * | m | ) |
Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.
m | A pointer to an instance of the scheme (initialized cfe_damgard_multi struct) |
void cfe_damgard_multi_copy | ( | cfe_damgard_multi * | res, |
cfe_damgard_multi * | m | ||
) |
Reconstructs the scheme with the same configuration parameters from an already existing Damgard multi input scheme instance.
res | A pointer to an uninitialized damgard_multi struct |
m | A pointer to an instance of the scheme (initialized cfe_damgard_multi struct) |
void cfe_damgard_multi_client_init | ( | cfe_damgard_multi_client * | e, |
cfe_damgard_multi * | m | ||
) |
Takes configuration parameters of a scheme instance, and instantiates a new cfe_damgard_multi_client.
e | A pointer to an uninitialized struct representing a client for the scheme. |
m | A pointer to an instance of the scheme (initialized cfe_damgard_multi struct) |
void cfe_damgard_multi_client_free | ( | cfe_damgard_multi_client * | e | ) |
Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.
e | A pointer to an instance of the encryptor (initialized cfe_damgard_multi_client struct) |
void cfe_damgard_multi_sec_key_free | ( | cfe_damgard_multi_sec_key * | key | ) |
Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.
key | A pointer to an initialized cfe_damgard_multi_sec_key struct |
void cfe_damgard_multi_fe_key_free | ( | cfe_damgard_multi_fe_key * | key | ) |
Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.
key | A pointer to an initialized cfe_damgard_multi_fe_key struct |
void cfe_damgard_multi_master_keys_init | ( | cfe_mat * | mpk, |
cfe_damgard_multi_sec_key * | msk, | ||
cfe_damgard_multi * | m | ||
) |
Initializes the structs which represent the master public key and master secret key.
mpk | A pointer to an uninitialized matrix |
msk | A pointer to an uninitialized cfe_damgard_multi_sec_key struct |
m | A pointer to an instance of the scheme (initialized cfe_damgard_multi struct) |
void cfe_damgard_multi_generate_master_keys | ( | cfe_mat * | mpk, |
cfe_damgard_multi_sec_key * | msk, | ||
cfe_damgard_multi * | m | ||
) |
Generates a matrix comprised of master public keys and a struct encapsulating master secret keys for the scheme. It returns an error in case master keys could not be generated.
mpk | A pointer to a matrix (master public key will be stored here) |
msk | A pointer to a cfe_damgard_multi_sec_key struct (master secret key will be stored here) |
m | A pointer to an instance of the scheme (initialized cfe_damgard_multi struct) |
void cfe_damgard_multi_fe_key_init | ( | cfe_damgard_multi_fe_key * | fe_key, |
cfe_damgard_multi * | m | ||
) |
Initializes the struct which represents the functional encryption key.
fe_key | A pointer to an uninitialized cfe_damgard_multi_fe_key struct |
m | A pointer to an instance of the scheme (initialized cfe_damgard_multi struct) |
cfe_error cfe_damgard_multi_derive_fe_key | ( | cfe_damgard_multi_fe_key * | fe_key, |
cfe_damgard_multi * | m, | ||
cfe_damgard_multi_sec_key * | msk, | ||
cfe_mat * | y | ||
) |
Takes master secret key and a matrix y comprised of input vectors, and returns the functional encryption key. In case the key could not be derived, it returns an error.
fe_key | A pointer to a cfe_damgard_multi_fe_key struct (the functional encryption key will be stored here) |
m | A pointer to an instance of the scheme (initialized cfe_damgard_multi struct) |
msk | A pointer to the master secret key |
y | A pointer to the matrix comprised of input vectors |
void cfe_damgard_multi_ciphertext_init | ( | cfe_vec * | ciphertext, |
cfe_damgard_multi_client * | e | ||
) |
Initializes the vector which represents the ciphertext.
ciphertext | A pointer to an uninitialized vector |
e | A pointer to an instance of the encryptor (initialized cfe_damgard_multi_enc struct) |
cfe_error cfe_damgard_multi_encrypt | ( | cfe_vec * | ciphertext, |
cfe_damgard_multi_client * | e, | ||
cfe_vec * | x, | ||
cfe_vec * | pub_key, | ||
cfe_vec * | otp | ||
) |
Generates a ciphertext from the input vector x with the provided public key and one-time pad otp (which is a part of the secret key). It returns the ciphertext vector. If encryption failed, an error is returned.
ciphertext | A pointer to a vector (the resulting ciphertext will be stored here) |
e | A pointer to an instance of the encryptor (initialized cfe_damgard_multi_enc struct) |
x | A pointer to the input vector |
pub_key | A pointer to the public key vector |
otp | A pointer to the one-time pad vector |
cfe_error cfe_damgard_multi_decrypt | ( | mpz_t | res, |
cfe_damgard_multi * | m, | ||
cfe_vec * | ciphertext, | ||
cfe_damgard_multi_fe_key * | fe_key, | ||
cfe_mat * | y | ||
) |
Accepts the matrix cipher comprised of encrypted vectors, functional encryption key, and a matrix y comprised of plaintext vectors. It returns the sum of inner products. If decryption failed, an error is returned.
res | The result of the decryption (the value will be stored here) |
m | A pointer to an instance of the scheme (initialized cfe_damgard_multi struct) |
ciphertext | An array comprised of encrypted vectors |
fe_key | An functional encryption key represented as an array of the parts of functional encryption keys. |
y | A pointer to the matrix comprised of plaintext inner product vectors |