#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_secretsharing_service.h"
#include "secretsharing.h"
#include <gcrypt.h>
Go to the source code of this file.
Data Structures | |
struct | GNUNET_SECRETSHARING_Session |
Session that will eventually establish a shared secred between the involved peers and allow encryption and cooperative decryption. More... | |
struct | GNUNET_SECRETSHARING_DecryptionHandle |
Handle to cancel a cooperative decryption operation. More... | |
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "secretsharing-api", __VA_ARGS__) |
Functions | |
static void | ensure_elgamal_initialized (void) |
Function to initialize elgamal_q, elgamal_p and elgamal_g. More... | |
static void | handle_session_client_error (void *cls, enum GNUNET_MQ_Error error) |
Callback invoked when there is an error communicating with the service. More... | |
static void | handle_decrypt_client_error (void *cls, enum GNUNET_MQ_Error error) |
Callback invoked when there is an error communicating with the service. More... | |
static int | check_secret_ready (void *cls, const struct GNUNET_SECRETSHARING_SecretReadyMessage *m) |
Handler invoked with the final result message from secret sharing. More... | |
static void | handle_secret_ready (void *cls, const struct GNUNET_SECRETSHARING_SecretReadyMessage *m) |
Handler invoked with the final result message from secret sharing. More... | |
void | GNUNET_SECRETSHARING_session_destroy (struct GNUNET_SECRETSHARING_Session *s) |
Destroy a secret sharing session. More... | |
struct GNUNET_SECRETSHARING_Session * | GNUNET_SECRETSHARING_create_session (const struct GNUNET_CONFIGURATION_Handle *cfg, unsigned int num_peers, const struct GNUNET_PeerIdentity *peers, const struct GNUNET_HashCode *session_id, struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Absolute deadline, unsigned int threshold, GNUNET_SECRETSHARING_SecretReadyCallback cb, void *cls) |
Create a session that will eventually establish a shared secret with the other peers. More... | |
static void | handle_decrypt_done (void *cls, const struct GNUNET_SECRETSHARING_DecryptResponseMessage *m) |
struct GNUNET_SECRETSHARING_DecryptionHandle * | GNUNET_SECRETSHARING_decrypt (const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_SECRETSHARING_Share *share, const struct GNUNET_SECRETSHARING_Ciphertext *ciphertext, struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Absolute deadline, GNUNET_SECRETSHARING_DecryptCallback decrypt_cb, void *decrypt_cb_cls) |
Publish the given ciphertext for decryption. More... | |
int | GNUNET_SECRETSHARING_plaintext_generate_i (struct GNUNET_SECRETSHARING_Plaintext *plaintext, int64_t exponent) |
int | GNUNET_SECRETSHARING_encrypt (const struct GNUNET_SECRETSHARING_PublicKey *public_key, const struct GNUNET_SECRETSHARING_Plaintext *plaintext, struct GNUNET_SECRETSHARING_Ciphertext *result_ciphertext) |
Encrypt a value. More... | |
void | GNUNET_SECRETSHARING_decrypt_cancel (struct GNUNET_SECRETSHARING_DecryptionHandle *dh) |
Cancel a decryption. More... | |
Variables | |
static gcry_mpi_t | elgamal_q |
The ElGamal prime field order as libgcrypt mpi. More... | |
static gcry_mpi_t | elgamal_p |
Modulus of the prime field used for ElGamal. More... | |
static gcry_mpi_t | elgamal_g |
Generator for prime field of order 'elgamal_q'. More... | |
Definition in file secretsharing_api.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "secretsharing-api", __VA_ARGS__) |
Definition at line 33 of file secretsharing_api.c.
|
static |
Function to initialize elgamal_q, elgamal_p and elgamal_g.
Definition at line 103 of file secretsharing_api.c.
References elgamal_g, elgamal_p, elgamal_q, GNUNET_assert, GNUNET_SECRETSHARING_ELGAMAL_G_HEX, GNUNET_SECRETSHARING_ELGAMAL_P_HEX, and GNUNET_SECRETSHARING_ELGAMAL_Q_HEX.
Referenced by GNUNET_SECRETSHARING_encrypt(), and GNUNET_SECRETSHARING_plaintext_generate_i().
|
static |
Callback invoked when there is an error communicating with the service.
Notifies the application about the error.
cls | the struct GNUNET_SECRETSHARING_Session |
error | error code |
Definition at line 128 of file secretsharing_api.c.
References GNUNET_SECRETSHARING_session_destroy(), GNUNET_SECRETSHARING_Session::secret_ready_cb, and GNUNET_SECRETSHARING_Session::secret_ready_cls.
Referenced by GNUNET_SECRETSHARING_create_session().
|
static |
Callback invoked when there is an error communicating with the service.
Notifies the application about the error.
cls | the struct GNUNET_SECRETSHARING_DecryptionHandle |
error | error code |
Definition at line 146 of file secretsharing_api.c.
References GNUNET_SECRETSHARING_DecryptionHandle::decrypt_cb, GNUNET_SECRETSHARING_DecryptionHandle::decrypt_cls, and GNUNET_SECRETSHARING_decrypt_cancel().
Referenced by GNUNET_SECRETSHARING_decrypt().
|
static |
Handler invoked with the final result message from secret sharing.
Decodes the message and passes the result to the application.
cls | the struct GNUNET_SECRETSHARING_Session |
m | message with the result |
Definition at line 165 of file secretsharing_api.c.
References GNUNET_OK.
|
static |
Handler invoked with the final result message from secret sharing.
Decodes the message and passes the result to the application.
cls | the struct GNUNET_SECRETSHARING_Session |
m | message with the result |
Definition at line 182 of file secretsharing_api.c.
References GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_SECRETSHARING_session_destroy(), GNUNET_SECRETSHARING_share_read(), LOG, m, GNUNET_SECRETSHARING_Share::num_peers, GNUNET_SECRETSHARING_Share::public_key, GNUNET_SECRETSHARING_Session::secret_ready_cb, and GNUNET_SECRETSHARING_Session::secret_ready_cls.
|
static |
Definition at line 303 of file secretsharing_api.c.
References GNUNET_SECRETSHARING_DecryptionHandle::decrypt_cb, GNUNET_SECRETSHARING_DecryptionHandle::decrypt_cls, GNUNET_SECRETSHARING_decrypt_cancel(), and m.
|
static |
The ElGamal prime field order as libgcrypt mpi.
Initialized in init_crypto_constants.
Definition at line 84 of file secretsharing_api.c.
Referenced by ensure_elgamal_initialized(), and GNUNET_SECRETSHARING_encrypt().
|
static |
Modulus of the prime field used for ElGamal.
Initialized in init_crypto_constants.
Definition at line 90 of file secretsharing_api.c.
Referenced by ensure_elgamal_initialized(), GNUNET_SECRETSHARING_encrypt(), and GNUNET_SECRETSHARING_plaintext_generate_i().
|
static |
Generator for prime field of order 'elgamal_q'.
Initialized in init_crypto_constants.
Definition at line 96 of file secretsharing_api.c.
Referenced by ensure_elgamal_initialized(), GNUNET_SECRETSHARING_encrypt(), and GNUNET_SECRETSHARING_plaintext_generate_i().