LWE scheme.
More...
Go to the source code of this file.
|
cfe_error | cfe_ring_lwe_init (cfe_ring_lwe *s, size_t l, size_t n, mpz_t bound, mpz_t p, mpz_t q, mpf_t sigma) |
|
void | cfe_ring_lwe_sec_key_init (cfe_mat *SK, cfe_ring_lwe *s) |
|
void | cfe_ring_lwe_generate_sec_key (cfe_mat *SK, cfe_ring_lwe *s) |
|
void | cfe_ring_lwe_pub_key_init (cfe_mat *PK, cfe_ring_lwe *s) |
|
cfe_error | cfe_ring_lwe_generate_pub_key (cfe_mat *PK, cfe_ring_lwe *s, cfe_mat *SK) |
|
void | cfe_ring_lwe_fe_key_init (cfe_vec *sk_y, cfe_ring_lwe *s) |
|
cfe_error | cfe_ring_lwe_derive_fe_key (cfe_vec *sk_y, cfe_ring_lwe *s, cfe_mat *SK, cfe_vec *y) |
|
void | cfe_ring_lwe_ciphertext_init (cfe_mat *CT, cfe_ring_lwe *s) |
|
cfe_error | cfe_ring_lwe_encrypt (cfe_mat *CT, cfe_ring_lwe *s, cfe_mat *x, cfe_mat *PK) |
|
void | cfe_ring_lwe_decrypted_init (cfe_vec *res, cfe_ring_lwe *s) |
|
cfe_error | cfe_ring_lwe_decrypt (cfe_vec *res, cfe_ring_lwe *s, cfe_mat *ct, cfe_vec *sk_y, cfe_vec *y) |
|
void | cfe_ring_lwe_free (cfe_ring_lwe *s) |
|
◆ cfe_ring_lwe
◆ cfe_ring_lwe_init()
cfe_error cfe_ring_lwe_init |
( |
cfe_ring_lwe * |
s, |
|
|
size_t |
l, |
|
|
size_t |
n, |
|
|
mpz_t |
bound, |
|
|
mpz_t |
p, |
|
|
mpz_t |
q, |
|
|
mpf_t |
sigma |
|
) |
| |
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 | The bound by which coordinates of the input vectors are bounded |
p | Modulus for the inner product |
q | Modulus for ciphertext and keys vectors are bounded |
sigma | Standard deviation |
- Returns
- Error code
◆ cfe_ring_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_ring_lwe struct) |
◆ cfe_ring_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_ring_lwe struct) |
◆ cfe_ring_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_ring_lwe struct) |
◆ cfe_ring_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_ring_lwe struct) |
SK | A pointer to an initialized matrix representing the secret key. |
- Returns
- Error code
◆ cfe_ring_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_ring_lwe struct) |
◆ cfe_ring_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) |
s | A pointer to an instance of the scheme (initialized cfe_ring_lwe struct) |
SK | A pointer to the master secret key |
y | A pointer to the inner product vector |
- Returns
- Error code
◆ cfe_ring_lwe_ciphertext_init()
Initializes the matrix which represents the ciphertext.
- Parameters
-
CT | A pointer to an uninitialized matrix |
s | A pointer to an instance of the scheme (initialized cfe_ring_lwe struct) |
◆ cfe_ring_lwe_encrypt()
Encrypts input matrix x with the provided master public key.
- Parameters
-
CT | A pointer to a matrix (the resulting ciphertext will be stored here) |
s | A pointer to an instance of the scheme (initialized cfe_ring_lwe struct) |
x | A pointer to the input matrix |
PK | A pointer to the matrix representing the public key. |
- Returns
- Error code
◆ cfe_ring_lwe_decrypted_init()
Initialized the vector which represents the result of the decryption.
- Parameters
-
res | A pointer to an uninitialized vector |
s | A pointer to an instance of the scheme (initialized cfe_ring_lwe struct) |
◆ cfe_ring_lwe_decrypt()
Accepts the encrypted matrix X, functional encryption key, and an inner product vector y. It returns the product y^T * X. If decryption failed, an error is returned.
- Parameters
-
res | A pointer to a vector (result of the decryption will be stored here) |
s | A pointer to an instance of the scheme (initialized cfe_ring_lwe struct) |
ct | A pointer to the ciphertext matrix |
sk_y | The functional encryption key |
y | A pointer to the inner product vector |
- Returns
- Error code
◆ cfe_ring_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_ring_lwe struct) |