CiFEr
paillier.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 XLAB d.o.o.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef CIFER_PAILLIER_H
18 #define CIFER_PAILLIER_H
19 
20 #include "cifer/data/vec.h"
21 #include "cifer/internal/errors.h"
22 
32 typedef struct cfe_paillier {
33  size_t l;
34  mpz_t n;
35  mpz_t n_square;
36  mpz_t bound_x;
37  mpz_t bound_y;
38  mpf_t sigma;
39  mpz_t k_sigma;
40  size_t lambda;
41  mpz_t g;
42 } cfe_paillier;
43 
63 cfe_error cfe_paillier_init(cfe_paillier *s, size_t l, size_t lambda, size_t bit_len, mpz_t bound_x, mpz_t bound_y);
64 
73 
83 
94 
105 
118 cfe_error cfe_paillier_derive_fe_key(mpz_t fe_key, cfe_paillier *s, cfe_vec *msk, cfe_vec *y);
119 
128 
141 cfe_error cfe_paillier_encrypt(cfe_vec *ciphertext, cfe_paillier *s, cfe_vec *x, cfe_vec *mpk);
142 
156 cfe_error cfe_paillier_decrypt(mpz_t res, cfe_paillier *s, cfe_vec *ciphertext, mpz_t key, cfe_vec *y);
157 
158 #endif
cfe_vec
Definition: vec.h:41
cfe_paillier_free
void cfe_paillier_free(cfe_paillier *s)
cfe_paillier
Definition: paillier.h:32
cfe_paillier_derive_fe_key
cfe_error cfe_paillier_derive_fe_key(mpz_t fe_key, cfe_paillier *s, cfe_vec *msk, cfe_vec *y)
errors.h
Error definitions.
cfe_paillier_init
cfe_error cfe_paillier_init(cfe_paillier *s, size_t l, size_t lambda, size_t bit_len, mpz_t bound_x, mpz_t bound_y)
cfe_paillier_master_keys_init
void cfe_paillier_master_keys_init(cfe_vec *msk, cfe_vec *mpk, cfe_paillier *s)
cfe_paillier
struct cfe_paillier cfe_paillier
cfe_paillier_encrypt
cfe_error cfe_paillier_encrypt(cfe_vec *ciphertext, cfe_paillier *s, cfe_vec *x, cfe_vec *mpk)
cfe_paillier_ciphertext_init
void cfe_paillier_ciphertext_init(cfe_vec *ciphertext, cfe_paillier *s)
vec.h
Vector struct and operations.
cfe_paillier_copy
void cfe_paillier_copy(cfe_paillier *res, cfe_paillier *s)
cfe_paillier_decrypt
cfe_error cfe_paillier_decrypt(mpz_t res, cfe_paillier *s, cfe_vec *ciphertext, mpz_t key, cfe_vec *y)
cfe_paillier_generate_master_keys
cfe_error cfe_paillier_generate_master_keys(cfe_vec *msk, cfe_vec *mpk, cfe_paillier *s)