LWE scheme.
More...
Go to the source code of this file.
|
| cfe_error | cfe_lwe_init (cfe_lwe *s, size_t l, mpz_t bound_x, mpz_t bound_y, size_t n) |
| |
| void | cfe_lwe_sec_key_init (cfe_mat *SK, cfe_lwe *s) |
| |
| void | cfe_lwe_generate_sec_key (cfe_mat *SK, cfe_lwe *s) |
| |
| void | cfe_lwe_pub_key_init (cfe_mat *PK, cfe_lwe *s) |
| |
| cfe_error | cfe_lwe_generate_pub_key (cfe_mat *PK, cfe_lwe *s, cfe_mat *SK) |
| |
| void | cfe_lwe_fe_key_init (cfe_vec *sk_y, cfe_lwe *s) |
| |
| cfe_error | cfe_lwe_derive_fe_key (cfe_vec *sk_y, cfe_lwe *s, cfe_mat *SK, cfe_vec *y) |
| |
| void | cfe_lwe_ciphertext_init (cfe_vec *ct, cfe_lwe *s) |
| |
| cfe_error | cfe_lwe_encrypt (cfe_vec *ct, cfe_lwe *s, cfe_vec *x, cfe_mat *PK) |
| |
| cfe_error | cfe_lwe_decrypt (mpz_t res, cfe_lwe *s, cfe_vec *c, cfe_vec *sk_y, cfe_vec *y) |
| |
| void | cfe_lwe_free (cfe_lwe *s) |
| |
◆ cfe_lwe
cfe_lwe represents common properties of the scheme.
◆ cfe_lwe_init()
| cfe_error cfe_lwe_init |
( |
cfe_lwe * |
s, |
|
|
size_t |
l, |
|
|
mpz_t |
bound_x, |
|
|
mpz_t |
bound_y, |
|
|
size_t |
n |
|
) |
| |
Configures a new instance of the scheme. Security parameters are generated so that they satisfy theoretical bounds provided in the phd thesis Functional Encryption for Inner-Product Evaluations, see Section 8.3.1 in https://www.di.ens.fr/~fbourse/publications/Thesis.pdf
- Parameters
-
| s | A pointer to an uninitialized struct representing the scheme |
| l | The length of input vectors |
| bound_x | The bound by which coordinates of the encrypted vectors are bounded |
| bound_y | The bound by which coordinates of the inner product vectors are bounded |
| n | The security parameter of the scheme |
- Returns
- Error code
◆ cfe_lwe_sec_key_init()
Initializes the matrix which represents the secret key.
- Parameters
-
| SK | A pointer to an uninitialized matrix |
| s | A pointer to an instance of the scheme (initialized cfe_lwe struct) |
◆ cfe_lwe_generate_sec_key()
Generates a private secret key for the scheme.
- Parameters
-
| SK | A pointer to a matrix (master secret key will be stored here) |
| s | A pointer to an instance of the scheme (initialized cfe_lwe struct) |
◆ cfe_lwe_pub_key_init()
Initializes the matrix which represents the public key.
- Parameters
-
| PK | A pointer to an uninitialized matrix |
| s | A pointer to an instance of the scheme (initialized cfe_lwe struct) |
◆ cfe_lwe_generate_pub_key()
Generates a public key for the scheme.
- Parameters
-
| PK | A pointer to a matrix (public key will be stored here) |
| s | A pointer to an instance of the scheme (initialized cfe_lwe struct) |
| SK | A pointer to an initialized matrix representing the secret key. |
- Returns
- Error code
◆ cfe_lwe_fe_key_init()
Initializes the vector which represents the functional encryption key.
- Parameters
-
| sk_y | A pointer to an uninitialized vector |
| s | A pointer to an instance of the scheme (initialized cfe_lwe struct) |
◆ cfe_lwe_derive_fe_key()
Takes master secret key and inner product vector, and returns the functional encryption key.
- Parameters
-
| sk_y | A pointer to a vector (the functional encryption key will be stored here) |
| SK | A pointer to the master secret key |
| s | A pointer to an instance of the scheme (initialized cfe_lwe struct) |
| y | A pointer to the inner product vector |
- Returns
- Error code
◆ cfe_lwe_ciphertext_init()
Initializes the vector which represents the ciphertext.
- Parameters
-
| ct | A pointer to an uninitialized vector |
| s | A pointer to an instance of the scheme (initialized cfe_lwe struct) |
◆ cfe_lwe_encrypt()
Encrypts input vector x with the provided master public key.
- Parameters
-
| ct | A pointer to a vector (the resulting ciphertext will be stored here) |
| s | A pointer to an instance of the scheme (initialized cfe_lwe struct) |
| x | A pointer to the input vector |
| PK | A pointer to the matrix representing the public key. |
- Returns
- Error code
◆ cfe_lwe_decrypt()
Accepts the encrypted vector x, functional encryption key, and a plaintext vector. It returns the inner product. 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_lwe struct) |
| c | A pointer to the ciphertext vector |
| sk_y | The functional encryption key |
| y | A pointer to the inner product vector |
- Returns
- Error code
◆ cfe_lwe_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_lwe struct) |