SGP scheme.
More...
Go to the source code of this file.
|
cfe_error | cfe_sgp_init (cfe_sgp *s, size_t l, mpz_t bound) |
|
void | cfe_sgp_free (cfe_sgp *s) |
|
void | cfe_sgp_sec_key_init (cfe_sgp_sec_key *msk, cfe_sgp *sgp) |
|
void | cfe_sgp_sec_key_free (cfe_sgp_sec_key *msk) |
|
void | cfe_sgp_generate_sec_key (cfe_sgp_sec_key *msk, cfe_sgp *s) |
|
cfe_error | cfe_sgp_derive_fe_key (ECP2_BN254 *key, cfe_sgp *sgp, cfe_sgp_sec_key *msk, cfe_mat *f) |
|
void | cfe_sgp_cipher_init (cfe_sgp_cipher *cipher, cfe_sgp *s) |
|
void | cfe_sgp_cipher_free (cfe_sgp_cipher *cipher) |
|
cfe_error | cfe_sgp_encrypt (cfe_sgp_cipher *cipher, cfe_sgp *s, cfe_vec *x, cfe_vec *y, cfe_sgp_sec_key *msk) |
|
cfe_error | cfe_sgp_decrypt (mpz_t res, cfe_sgp *s, cfe_sgp_cipher *cipher, ECP2_BN254 *key, cfe_mat *f) |
|
◆ cfe_sgp
cfe_sgp represents a scheme for quadratic multi-variate polynomials based on Sans, Gay and Pointcheval: "Reading in the Dark: Classifying Encrypted Digits with
Functional Encryption", see https://eprint.iacr.org/2018/206.pdf.
◆ cfe_sgp_sec_key
◆ cfe_sgp_cipher
◆ cfe_sgp_init()
cfe_error cfe_sgp_init |
( |
cfe_sgp * |
s, |
|
|
size_t |
l, |
|
|
mpz_t |
bound |
|
) |
| |
Configures a new instance of the scheme.
- Parameters
-
s | A pointer to an uninitialized struct representing the scheme |
l | The length of input vectors |
bound | The bound by which coordinates of the encryption vectors and matrix for quadratic polynomial are bounded |
- Returns
- Error code
◆ cfe_sgp_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_sgp struct) |
◆ cfe_sgp_sec_key_init()
Initializes the struct which represents the master secret key.
- Parameters
-
msk | A pointer to an uninitialized secret key |
sgp | A pointer to an instance of the scheme (initialized cfe_sgp struct) |
◆ cfe_sgp_sec_key_free()
Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.
- Parameters
-
msk | A pointer to an instance of the secret key (initialized cfe_sgp_sec_key struct) |
◆ cfe_sgp_generate_sec_key()
Generates a private secret key for the scheme.
- Parameters
-
msk | A pointer to a secret key (master secret key will be stored here) |
s | A pointer to an instance of the scheme (initialized cfe_sgp struct) |
- Returns
- Error code
◆ cfe_sgp_derive_fe_key()
Takes master secret key and a matrix, and returns the corresponding functional encryption key.
- Parameters
-
key | A pointer to a ECP2_BN254 struct (the functional encryption key will be stored here) |
sgp | A pointer to an instance of the scheme (initialized cfe_sgp struct) |
msk | A pointer to the master secret key |
f | A pointer to the matrix for the quadratic polynomial |
- Returns
- Error code
◆ cfe_sgp_cipher_init()
Initializes the struct which represents the ciphertext.
- Parameters
-
cipher | A pointer to an uninitialized ciphertext struct |
s | A pointer to an instance of the scheme (initialized cfe_sgp struct) |
◆ cfe_sgp_cipher_free()
Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.
- Parameters
-
cipher | A pointer to an instance of the ciphertext (initialized cfe_sgp_cipher struct) |
◆ cfe_sgp_encrypt()
Encrypts input vectors x and y with the provided master secret key.
- Parameters
-
cipher | A pointer to a vector (the resulting ciphertext will be stored here) |
s | A pointer to an instance of the scheme (initialized cfe_sgp struct) |
x | A pointer to the input vector |
y | A pointer to the input vector |
msk | A pointer to a master secret key. |
- Returns
- Error code
◆ cfe_sgp_decrypt()
Based on the encryption, functional encryption key, and a matrix, it returns the value of the quadratic polynomial. 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_sgp struct) |
cipher | A pointer to the ciphertext |
key | A pointer to the functional encryption key |
f | A pointer to the matrix of the quadratic polynomial |
- Returns
- Error code