Damgard scheme.
More...
Go to the source code of this file.
|
cfe_error | cfe_damgard_init (cfe_damgard *s, size_t l, size_t modulus_len, mpz_t bound) |
|
cfe_error | cfe_damgard_precomp_init (cfe_damgard *s, size_t l, size_t modulus_len, mpz_t bound) |
|
void | cfe_damgard_free (cfe_damgard *s) |
|
void | cfe_damgard_copy (cfe_damgard *res, cfe_damgard *s) |
|
void | cfe_damgard_sec_key_free (cfe_damgard_sec_key *key) |
|
void | cfe_damgard_fe_key_free (cfe_damgard_fe_key *key) |
|
void | cfe_damgard_sec_key_init (cfe_damgard_sec_key *msk, cfe_damgard *s) |
|
void | cfe_damgard_pub_key_init (cfe_vec *mpk, cfe_damgard *s) |
|
void | cfe_damgard_generate_master_keys (cfe_damgard_sec_key *msk, cfe_vec *mpk, cfe_damgard *s) |
|
void | cfe_damgard_fe_key_init (cfe_damgard_fe_key *fe_key) |
|
cfe_error | cfe_damgard_derive_fe_key (cfe_damgard_fe_key *fe_key, cfe_damgard *s, cfe_damgard_sec_key *msk, cfe_vec *y) |
|
void | cfe_damgard_ciphertext_init (cfe_vec *ciphertext, cfe_damgard *s) |
|
cfe_error | cfe_damgard_encrypt (cfe_vec *ciphertext, cfe_damgard *s, cfe_vec *x, cfe_vec *mpk) |
|
cfe_error | cfe_damgard_decrypt (mpz_t res, cfe_damgard *s, cfe_vec *ciphertext, cfe_damgard_fe_key *key, cfe_vec *y) |
|
◆ cfe_damgard
cfe_damgard represents a scheme instantiated from the DDH assumption.
◆ cfe_damgard_sec_key
◆ cfe_damgard_fe_key
◆ cfe_damgard_init()
cfe_error cfe_damgard_init |
( |
cfe_damgard * |
s, |
|
|
size_t |
l, |
|
|
size_t |
modulus_len, |
|
|
mpz_t |
bound |
|
) |
| |
Configures a new instance of the scheme. It returns an error in case the scheme could not be properly configured, or if precondition 2 * l * bound² is >= order of the cyclic group.
- Parameters
-
s | A pointer to an uninitialized struct representing the scheme |
l | The length of input vectors |
modulus_len | The bit length of the modulus |
bound | The bound by which coordinates of input vectors are bounded |
- Returns
- Error code
◆ cfe_damgard_precomp_init()
cfe_error cfe_damgard_precomp_init |
( |
cfe_damgard * |
s, |
|
|
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 returns an error in case the scheme could not be properly configured, or if precondition 2 * l * bound² is >= order of the cyclic group.
- Parameters
-
s | A pointer to an uninitialized struct representing the scheme |
l | The length of input vectors |
modulus_len | The bit length of the modulus |
bound | The bound by which coordinates of input vectors are bounded |
- Returns
- Error code
◆ cfe_damgard_free()
Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.
- Parameters
-
s | A pointer to an instance of the scheme (initialized cfe_damgard struct) |
◆ cfe_damgard_copy()
Reconstructs the scheme with the same configuration parameters from an already existing Damgard scheme instance.
- Parameters
-
res | A pointer to an uninitialized cfe_damgard struct |
s | A pointer to an instance of the scheme (initialized cfe_damgard struct) |
◆ cfe_damgard_sec_key_free()
Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.
- Parameters
-
◆ cfe_damgard_fe_key_free()
Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.
- Parameters
-
◆ cfe_damgard_sec_key_init()
Initializes the struct which represents the master secret key.
- Parameters
-
◆ cfe_damgard_pub_key_init()
Initializes the vector which represents the master public key.
- Parameters
-
mpk | A pointer to an uninitialized vector |
s | A pointer to an instance of the scheme (initialized cfe_damgard struct) |
◆ cfe_damgard_generate_master_keys()
Generates a master secret key and master public key for the scheme.
- Parameters
-
msk | A pointer to a cfe_damgard_sec_key struct (master secret key will be stored here) |
mpk | A pointer to a vector (master public key will be stored here) |
s | A pointer to an instance of the scheme (initialized cfe_damgard struct) |
◆ cfe_damgard_fe_key_init()
Initializes the struct which represents the functional encryption key.
- Parameters
-
◆ cfe_damgard_derive_fe_key()
Takes master secret key and input vector y, and returns the functional encryption key. In case the key could not be derived, it returns an error.
- Parameters
-
fe_key | A pointer to a cfe_damgard_fe_key struct (the functional encryption key will be stored here) |
s | A pointer to an instance of the scheme (initialized cfe_damgard struct) |
msk | A pointer to the master secret key |
y | A pointer to the inner product vector |
- Returns
- Error code
◆ cfe_damgard_ciphertext_init()
Initializes the vector which represents the ciphertext.
- Parameters
-
ciphertext | A pointer to an uninitialized vector |
s | A pointer to an instance of the scheme (initialized cfe_damgard struct) |
◆ cfe_damgard_encrypt()
Encrypts input vector x with the provided master public key. It returns a ciphertext vector. If encryption failed, an error is returned.
- Parameters
-
ciphertext | A pointer to a vector (the resulting ciphertext will be stored here) |
s | A pointer to an instance of the scheme (initialized cfe_damgard struct) |
x | A pointer to the input vector |
mpk | A pointer to the master public key |
- Returns
- Error code
◆ cfe_damgard_decrypt()
Accepts the encrypted vector, functional encryption key, and a plaintext vector y. It returns the inner product of x and y. If decryption failed, an error is returned.
- Parameters
-
res | The result of the decryption (the value will be stored here) |
s | A pointer to an instance of the scheme (initialized cfe_damgard struct) |
ciphertext | A pointer to the ciphertext vector |
key | The functional encryption key |
y | A pointer to the inner product vector |
- Returns
- Error code