DDH multi input scheme.
More...
Go to the source code of this file.
|
cfe_error | cfe_ddh_multi_init (cfe_ddh_multi *m, size_t slots, size_t l, size_t modulus_len, mpz_t bound) |
|
cfe_error | cfe_ddh_multi_precomp_init (cfe_ddh_multi *m, size_t slots, size_t l, size_t modulus_len, mpz_t bound) |
|
void | cfe_ddh_multi_free (cfe_ddh_multi *m) |
|
void | cfe_ddh_multi_copy (cfe_ddh_multi *res, cfe_ddh_multi *m) |
|
void | cfe_ddh_multi_enc_init (cfe_ddh_multi_enc *e, cfe_ddh_multi *m) |
|
void | cfe_ddh_multi_enc_free (cfe_ddh_multi_enc *e) |
|
void | cfe_ddh_multi_sec_key_free (cfe_ddh_multi_sec_key *key) |
|
void | cfe_ddh_multi_fe_key_free (cfe_ddh_multi_fe_key *key) |
|
void | cfe_ddh_multi_master_keys_init (cfe_mat *mpk, cfe_ddh_multi_sec_key *msk, cfe_ddh_multi *m) |
|
void | cfe_ddh_multi_fe_key_init (cfe_ddh_multi_fe_key *key, cfe_ddh_multi *m) |
|
void | cfe_ddh_multi_ciphertext_init (cfe_vec *ciphertext, cfe_ddh_multi_enc *e) |
|
void | cfe_ddh_multi_generate_master_keys (cfe_mat *mpk, cfe_ddh_multi_sec_key *msk, cfe_ddh_multi *m) |
|
cfe_error | cfe_ddh_multi_derive_fe_key (cfe_ddh_multi_fe_key *res, cfe_ddh_multi *m, cfe_ddh_multi_sec_key *msk, cfe_mat *y) |
|
cfe_error | cfe_ddh_multi_encrypt (cfe_vec *ciphertext, cfe_ddh_multi_enc *e, cfe_vec *x, cfe_vec *pub_key, cfe_vec *otp) |
|
cfe_error | cfe_ddh_multi_decrypt (mpz_t res, cfe_ddh_multi *m, cfe_mat *ciphertext, cfe_ddh_multi_fe_key *key, cfe_mat *y) |
|
◆ cfe_ddh_multi
cfe_ddh_multi represents a multi input variant of the underlying DDH scheme.
◆ cfe_ddh_multi_sec_key
◆ cfe_ddh_multi_fe_key
◆ cfe_ddh_multi_enc
◆ cfe_ddh_multi_init()
cfe_error cfe_ddh_multi_init |
( |
cfe_ddh_multi * |
m, |
|
|
size_t |
slots, |
|
|
size_t |
l, |
|
|
size_t |
modulus_len, |
|
|
mpz_t |
bound |
|
) |
| |
Configures a new instance of the scheme. It accepts the number of slots (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.
- Parameters
-
m | A pointer to an uninitialized struct representing the scheme |
slots | The number of slots (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. |
- Returns
- Error code
◆ cfe_ddh_multi_precomp_init()
cfe_error cfe_ddh_multi_precomp_init |
( |
cfe_ddh_multi * |
m, |
|
|
size_t |
slots, |
|
|
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 slots (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.
- Parameters
-
m | A pointer to an uninitialized struct representing the scheme |
slots | The number of slots (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. |
- Returns
- Error code
◆ cfe_ddh_multi_free()
Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.
- Parameters
-
m | A pointer to an instance of the scheme (initialized cfe_ddh_multi struct) |
◆ cfe_ddh_multi_copy()
Reconstructs the scheme with the same configuration parameters from an already existing DDH multi input scheme instance.
- Parameters
-
◆ cfe_ddh_multi_enc_init()
Takes configuration parameters of a scheme instance, and instantiates a new ddh_multi_enc.
- Parameters
-
e | A pointer to an uninitialized struct representing the encryptor for the scheme. |
m | A pointer to an instance of the scheme (initialized cfe_ddh_multi struct) |
◆ cfe_ddh_multi_enc_free()
Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.
- Parameters
-
◆ cfe_ddh_multi_sec_key_free()
Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.
- Parameters
-
◆ cfe_ddh_multi_fe_key_free()
Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.
- Parameters
-
◆ cfe_ddh_multi_master_keys_init()
Initializes the structs which represent the master secret key and master public key.
- Parameters
-
msk | A pointer to an uninitialized matrix |
mpk | A pointer to an uninitialized cfe_dhh_multi_sec_key struct |
m | A pointer to an instance of the scheme (initialized cfe_ddh_multi struct) |
◆ cfe_ddh_multi_fe_key_init()
Initializes the struct which represents the functional encryption key.
- Parameters
-
key | A pointer to an uninitialized cfe_dhh_multi_fe_key struct |
m | A pointer to an instance of the scheme (initialized cfe_ddh_multi struct) |
◆ cfe_ddh_multi_ciphertext_init()
Initializes the vector which represents the ciphertext.
- Parameters
-
ciphertext | A pointer to an uninitialized vector |
e | A pointer to an instance of the encryptor (initialized cfe_ddh_multi_enc struct) |
◆ cfe_ddh_multi_generate_master_keys()
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.
- Parameters
-
mpk | A pointer to a matrix (master public key will be stored here) |
msk | A pointer to a cfe_ddh_multi_sec_key struct (master secret key will be stored here) |
m | A pointer to an instance of the scheme (initialized cfe_ddh_multi struct) |
◆ cfe_ddh_multi_derive_fe_key()
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.
- Parameters
-
res | A pointer to a cfe_ddh_multi_fe_key struct (the functional encryption key will be stored here) |
m | A pointer to an instance of the scheme (initialized cfe_ddh_multi struct) |
msk | A pointer to the master secret key |
y | A pointer to the matrix comprised of input vectors |
- Returns
- Error code
◆ cfe_ddh_multi_encrypt()
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.
- Parameters
-
ciphertext | A pointer to a vector (the resulting ciphertext will be stored here) |
e | A pointer to an instance of the encryptor (initialized cfe_ddh_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 |
- Returns
- Error code
◆ cfe_ddh_multi_decrypt()
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.
- Parameters
-
res | The result of the decryption (the value will be stored here) |
m | A pointer to an instance of the scheme (initialized cfe_ddh_multi struct) |
ciphertext | A pointer to the matrix comprised of encrypted vectors |
key | A pointer to the functional encryption key |
y | A pointer to the matrix comprised of plaintext vectors |
- Returns
- Error code