![]() |
GNUnet
0.11.x
|
implementation of the paillier crypto system with libgcrypt More...
Go to the source code of this file.
Functions | |
void | GNUNET_CRYPTO_paillier_create (struct GNUNET_CRYPTO_PaillierPublicKey *public_key, struct GNUNET_CRYPTO_PaillierPrivateKey *private_key) |
Create a freshly generated paillier public key. More... | |
int | GNUNET_CRYPTO_paillier_encrypt1 (const struct GNUNET_CRYPTO_PaillierPublicKey *public_key, const gcry_mpi_t m, int desired_ops, struct GNUNET_CRYPTO_PaillierCiphertext *ciphertext) |
Encrypt a plaintext with a paillier public key. More... | |
int | GNUNET_CRYPTO_paillier_encrypt (const struct GNUNET_CRYPTO_PaillierPublicKey *public_key, const gcry_mpi_t m, int desired_ops, struct GNUNET_CRYPTO_PaillierCiphertext *ciphertext) |
Encrypt a plaintext with a paillier public key. More... | |
void | GNUNET_CRYPTO_paillier_decrypt (const struct GNUNET_CRYPTO_PaillierPrivateKey *private_key, const struct GNUNET_CRYPTO_PaillierPublicKey *public_key, const struct GNUNET_CRYPTO_PaillierCiphertext *ciphertext, gcry_mpi_t m) |
Decrypt a paillier ciphertext with a private key. More... | |
int | GNUNET_CRYPTO_paillier_hom_add (const struct GNUNET_CRYPTO_PaillierPublicKey *public_key, const struct GNUNET_CRYPTO_PaillierCiphertext *c1, const struct GNUNET_CRYPTO_PaillierCiphertext *c2, struct GNUNET_CRYPTO_PaillierCiphertext *result) |
Compute a ciphertext that represents the sum of the plaintext in c1 and c2. More... | |
int | GNUNET_CRYPTO_paillier_hom_get_remaining (const struct GNUNET_CRYPTO_PaillierCiphertext *c) |
Get the number of remaining supported homomorphic operations. More... | |
implementation of the paillier crypto system with libgcrypt
Definition in file crypto_paillier.c.
void GNUNET_CRYPTO_paillier_create | ( | struct GNUNET_CRYPTO_PaillierPublicKey * | public_key, |
struct GNUNET_CRYPTO_PaillierPrivateKey * | private_key | ||
) |
Create a freshly generated paillier public key.
[out] | public_key | Where to store the public key? |
[out] | private_key | Where to store the private key? |
Definition at line 39 of file crypto_paillier.c.
References GNUNET_assert, GNUNET_CRYPTO_mpi_print_unsigned(), GNUNET_CRYPTO_PAILLIER_BITS, GNUNET_CRYPTO_PaillierPrivateKey::lambda, GNUNET_CRYPTO_PaillierPrivateKey::mu, p, and q.
Referenced by handle_client_keygen(), and run().
int GNUNET_CRYPTO_paillier_encrypt1 | ( | const struct GNUNET_CRYPTO_PaillierPublicKey * | public_key, |
const gcry_mpi_t | m, | ||
int | desired_ops, | ||
struct GNUNET_CRYPTO_PaillierCiphertext * | ciphertext | ||
) |
Encrypt a plaintext with a paillier public key.
public_key | Public key to use. | |
m | Plaintext to encrypt. | |
desired_ops | How many homomorphic ops the caller intends to use | |
[out] | ciphertext | Encryption of plaintext with public_key. |
Definition at line 120 of file crypto_paillier.c.
References GNUNET_CRYPTO_PaillierCiphertext::bits, GNUNET_assert, GNUNET_break_op, GNUNET_CRYPTO_mpi_print_unsigned(), GNUNET_CRYPTO_mpi_scan_unsigned(), GNUNET_CRYPTO_PAILLIER_BITS, GNUNET_SYSERR, and GNUNET_CRYPTO_PaillierCiphertext::remaining_ops.
int GNUNET_CRYPTO_paillier_encrypt | ( | const struct GNUNET_CRYPTO_PaillierPublicKey * | public_key, |
const gcry_mpi_t | m, | ||
int | desired_ops, | ||
struct GNUNET_CRYPTO_PaillierCiphertext * | ciphertext | ||
) |
Encrypt a plaintext with a paillier public key.
public_key | Public key to use. | |
m | Plaintext to encrypt. | |
desired_ops | How many homomorphic ops the caller intends to use | |
[out] | ciphertext | Encryption of plaintext with public_key. |
Definition at line 220 of file crypto_paillier.c.
References GNUNET_CRYPTO_PaillierCiphertext::bits, GNUNET_assert, GNUNET_break_op, GNUNET_CRYPTO_mpi_print_unsigned(), GNUNET_CRYPTO_mpi_scan_unsigned(), GNUNET_CRYPTO_PAILLIER_BITS, GNUNET_MIN, GNUNET_SYSERR, and GNUNET_CRYPTO_PaillierCiphertext::remaining_ops.
Referenced by compute_service_response(), and send_alices_cryptodata_message().
void GNUNET_CRYPTO_paillier_decrypt | ( | const struct GNUNET_CRYPTO_PaillierPrivateKey * | private_key, |
const struct GNUNET_CRYPTO_PaillierPublicKey * | public_key, | ||
const struct GNUNET_CRYPTO_PaillierCiphertext * | ciphertext, | ||
gcry_mpi_t | m | ||
) |
Decrypt a paillier ciphertext with a private key.
private_key | Private key to use for decryption. | |
public_key | Public key to use for encryption. | |
ciphertext | Ciphertext to decrypt. | |
[out] | m | Decryption of ciphertext with . |
Definition at line 335 of file crypto_paillier.c.
References GNUNET_CRYPTO_PaillierCiphertext::bits, GNUNET_assert, GNUNET_CRYPTO_mpi_scan_unsigned(), GNUNET_CRYPTO_PaillierPrivateKey::lambda, and GNUNET_CRYPTO_PaillierPrivateKey::mu.
Referenced by compute_scalar_product(), and keygen_round2_new_element().
int GNUNET_CRYPTO_paillier_hom_add | ( | const struct GNUNET_CRYPTO_PaillierPublicKey * | public_key, |
const struct GNUNET_CRYPTO_PaillierCiphertext * | c1, | ||
const struct GNUNET_CRYPTO_PaillierCiphertext * | c2, | ||
struct GNUNET_CRYPTO_PaillierCiphertext * | result | ||
) |
Compute a ciphertext that represents the sum of the plaintext in c1 and c2.
Compute a ciphertext that represents the sum of the plaintext in x1 and x2.
Note that this operation can only be done a finite number of times before an overflow occurs.
public_key | Public key to use for encryption. | |
c1 | Paillier cipher text. | |
c2 | Paillier cipher text. | |
[out] | result | Result of the homomorphic operation. |
Definition at line 413 of file crypto_paillier.c.
References testconfigure::b, GNUNET_CRYPTO_PaillierCiphertext::bits, GNUNET_assert, GNUNET_break_op, GNUNET_CRYPTO_mpi_print_unsigned(), GNUNET_CRYPTO_mpi_scan_unsigned(), GNUNET_MIN, GNUNET_SYSERR, and GNUNET_CRYPTO_PaillierCiphertext::remaining_ops.
Referenced by compute_service_response().
int GNUNET_CRYPTO_paillier_hom_get_remaining | ( | const struct GNUNET_CRYPTO_PaillierCiphertext * | c | ) |
Get the number of remaining supported homomorphic operations.
c | Paillier cipher text. |
Definition at line 476 of file crypto_paillier.c.
References GNUNET_assert, and GNUNET_CRYPTO_PaillierCiphertext::remaining_ops.