LWE scheme.
More...
Go to the source code of this file.
|
cfe_error | cfe_lwe_fs_init (cfe_lwe_fs *s, size_t l, size_t n, mpz_t bound_x, mpz_t bound_y) |
|
void | cfe_lwe_fs_sec_key_init (cfe_mat *SK, cfe_lwe_fs *s) |
|
void | cfe_lwe_fs_generate_sec_key (cfe_mat *SK, cfe_lwe_fs *s) |
|
void | cfe_lwe_fs_pub_key_init (cfe_mat *PK, cfe_lwe_fs *s) |
|
cfe_error | cfe_lwe_fs_generate_pub_key (cfe_mat *PK, cfe_lwe_fs *s, cfe_mat *SK) |
|
void | cfe_lwe_fs_fe_key_init (cfe_vec *z_y, cfe_lwe_fs *s) |
|
cfe_error | cfe_lwe_fs_derive_fe_key (cfe_vec *z_y, cfe_lwe_fs *s, cfe_vec *y, cfe_mat *SK) |
|
void | cfe_lwe_fs_ciphertext_init (cfe_vec *ct, cfe_lwe_fs *s) |
|
cfe_error | cfe_lwe_fs_encrypt (cfe_vec *ct, cfe_lwe_fs *s, cfe_vec *x, cfe_mat *PK) |
|
cfe_error | cfe_lwe_fs_decrypt (mpz_t res, cfe_lwe_fs *s, cfe_vec *ct, cfe_vec *z_y, cfe_vec *y) |
|
void | cfe_lwe_fs_free (cfe_lwe_fs *s) |
|
◆ cfe_lwe_fs
lwe_fs represents common properties of the scheme.
◆ cfe_lwe_fs_init()
cfe_error cfe_lwe_fs_init |
( |
cfe_lwe_fs * |
s, |
|
|
size_t |
l, |
|
|
size_t |
n, |
|
|
mpz_t |
bound_x, |
|
|
mpz_t |
bound_y |
|
) |
| |
Configures a new instance of the scheme.
- Parameters
-
s | A pointer to an uninitialized struct representing the scheme |
l | The length of input vectors |
n | The security parameter of the scheme |
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 |
- Returns
- Error code
◆ cfe_lwe_fs_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_fs struct) |
◆ cfe_lwe_fs_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_fs struct) |
◆ cfe_lwe_fs_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_fs struct) |
◆ cfe_lwe_fs_generate_pub_key()
Generates a public key for the scheme.
- Parameters
-
PK | A pointer to a matrix (master public key will be stored here) |
s | A pointer to an instance of the scheme (initialized cfe_lwe_fs struct) |
SK | A pointer to an initialized matrix representing the secret key. |
- Returns
- Error code
◆ cfe_lwe_fs_fe_key_init()
Initializes the vector which represents the functional encryption key.
- Parameters
-
z_y | A pointer to an uninitialized vector |
s | A pointer to an instance of the scheme (initialized cfe_lwe_fs struct) |
◆ cfe_lwe_fs_derive_fe_key()
Takes master secret key and inner product vector, and returns the functional encryption key.
- Parameters
-
z_y | A pointer to an initialized functional encryption key, which will be stored here |
s | A pointer to an instance of the scheme (initialized cfe_lwe_fs struct) |
y | A pointer to the input vector |
SK | A pointer to the master secret key |
- Returns
- Error code
◆ cfe_lwe_fs_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_fs struct) |
◆ cfe_lwe_fs_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_fs struct) |
x | A pointer to the input vector |
PK | A pointer to a matrix - master public key. |
- Returns
- Error code
◆ cfe_lwe_fs_decrypt()
Accepts the encrypted vector, 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_fs struct) |
ct | A pointer to the vector representing the ciphertext |
z_y | A pointer to the functional encryption key vector |
y | A pointer to the inner product vector |
- Returns
- Error code
◆ cfe_lwe_fs_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_fs struct) |