150 "testbed connect emsg: %s\n",
158 "dkg: session connect complete\n");
163 "dkg: all peers connected\n");
186 "testbed connect emsg: %s\n",
194 "decrypt: session connect complete\n");
199 "decrypt: all peers connected\n");
226 if (NULL == plaintext)
233 "decrypt got correct result for peer %u\n", n);
236 "decrypt got wrong result for peer %u\n", n);
266 "decrypt connect adapter, %d peers\n",
307 unsigned int num_ready_peers,
312 char pubkey_str[1024];
318 if (NULL == my_share)
330 "key generation successful for peer #%u, pubkey %s\n", n,
341 "generated public keys do not match\n");
372 "connect adapter, %d peers\n",
535 unsigned int links_succeeded,
536 unsigned int links_failed)
546 peers = started_peers;
570 run (
void *cls,
char *
const *
args,
const char *cfgfile,
573 static char *session_str =
"gnunet-secretsharing/test";
575 int topology_cmp_result;
585 "'OVERLAY_TOPOLOGY' not found in 'testbed' config section, "
586 "seems like you passed the wrong configuration file\n");
590 topology_cmp_result = strcasecmp (
topology,
"NONE");
593 if (0 == topology_cmp_result)
596 "'OVERLAY_TOPOLOGY' set to 'NONE', "
597 "seems like you passed the wrong configuration file\n");
602 "running gnunet-secretsharing-profiler\n");
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
struct GNUNET_GETOPT_CommandLineOption options[]
enum GNUNET_TESTBED_TopologyOption topology
The topology to generate.
#define gettext_noop(String)
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
static int ret
Return value of the commandline.
static struct GNUNET_ARM_Operation * op
Current operation.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
static unsigned int verbose
static unsigned int threshold
What should the threshold for then key be?
static void * session_connect_adapter(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
Adapter function called to establish a connection to a service.
static unsigned int num_connected_decrypt
static void session_connect_complete(void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg)
Callback to be called when a service connect operation is completed.
static struct GNUNET_TESTBED_Peer ** peers
Handles to the running peers.
static void secret_ready_cb(void *cls, struct GNUNET_SECRETSHARING_Share *my_share, struct GNUNET_SECRETSHARING_PublicKey *public_key, unsigned int num_ready_peers, const struct GNUNET_PeerIdentity *ready_peers)
static struct GNUNET_SECRETSHARING_Session ** session_handles
Handles for secretsharing sessions.
static struct GNUNET_SECRETSHARING_Share ** shares
Shares we got from the distributed key generation.
int main(int argc, char **argv)
static struct GNUNET_TIME_Absolute dkg_deadline
static struct GNUNET_SECRETSHARING_DecryptionHandle ** decrypt_handles
static struct GNUNET_HashCode session_id
static unsigned int num_decrypted
static int in_shutdown
Are we performing a shutdown right now?
static struct GNUNET_TIME_Absolute decrypt_start
static void peer_info_cb(void *cb_cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_TESTBED_PeerInformation *pinfo, const char *emsg)
Callback to be called when the requested peer information is available.
static struct GNUNET_TIME_Absolute dkg_start
static unsigned int num_retrieved_peer_ids
static void test_master(void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **started_peers, unsigned int links_succeeded, unsigned int links_failed)
Signature of a main function for a testcase.
static struct GNUNET_TIME_Absolute decrypt_deadline
static void session_disconnect_adapter(void *cls, void *op_result)
Adapter function called to destroy a connection to a service.
static struct GNUNET_SECRETSHARING_PublicKey common_pubkey
static void decrypt_disconnect_adapter(void *cls, void *op_result)
Adapter function called to destroy a connection to a service.
static struct GNUNET_TIME_Relative timeout
When would we like to see the operation finished?
static struct GNUNET_SECRETSHARING_Plaintext reference_plaintext
static unsigned int num_generated
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
static struct GNUNET_SECRETSHARING_Ciphertext ciphertext
static struct GNUNET_TESTBED_Operation ** connect_ops
Connect operations, one for every peer.
static int decrypt
Should we try to decrypt a value after the key generation?
static struct GNUNET_PeerIdentity * peer_ids
static void * decrypt_connect_adapter(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
Adapter function called to establish a connection to a service.
static void decrypt_connect_complete(void *cls, struct GNUNET_TESTBED_Operation *op, void *ca_result, const char *emsg)
Callback to be called when a service connect operation is completed.
static struct GNUNET_TIME_Relative delay
When should dkg communication start?
static void controller_cb(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
Signature of the event handler function called by the respective event controller.
static unsigned int num_peers
How many peers should participate in the key generation?
static void decrypt_cb(void *cls, const struct GNUNET_SECRETSHARING_Plaintext *plaintext)
Called when a decryption has succeeded.
static unsigned int num_connected_sessions
static void handle_shutdown(void *cls)
Signature of the main function of a task.
static struct GNUNET_OS_Process * p
Helper process we started.
API for writing tests and creating large-scale emulation testbeds for GNUnet.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_uint(char shortName, const char *name, const char *argumentHelp, const char *description, unsigned int *val)
Allow user to specify an unsigned int.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_relative_time(char shortName, const char *name, const char *argumentHelp, const char *description, struct GNUNET_TIME_Relative *val)
Allow user to specify a struct GNUNET_TIME_Relative (using human-readable "fancy" time).
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_verbose(unsigned int *level)
Define the '-V' verbosity option.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
#define GNUNET_log(kind,...)
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
int GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
@ GNUNET_ERROR_TYPE_ERROR
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run2(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls, int run_without_scheduler)
Run a standard GNUnet command startup sequence (initialize loggers and configuration,...
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received,...
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.
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.
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.
void GNUNET_SECRETSHARING_decrypt_cancel(struct GNUNET_SECRETSHARING_DecryptionHandle *dh)
Cancel a decryption.
int GNUNET_SECRETSHARING_plaintext_generate_i(struct GNUNET_SECRETSHARING_Plaintext *plaintext, int64_t exponent)
void GNUNET_SECRETSHARING_session_destroy(struct GNUNET_SECRETSHARING_Session *s)
Destroy a secret sharing session.
char * GNUNET_STRINGS_data_to_string(const void *data, size_t size, char *out, size_t out_size)
Convert binary data to ASCII encoding using CrockfordBase32.
void GNUNET_TESTBED_operation_done(struct GNUNET_TESTBED_Operation *operation)
This function is used to signal that the event information (struct GNUNET_TESTBED_EventInformation) f...
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_peer_get_information(struct GNUNET_TESTBED_Peer *peer, enum GNUNET_TESTBED_PeerInformationType pit, GNUNET_TESTBED_PeerInfoCallback cb, void *cb_cls)
Request information about a peer.
int GNUNET_TESTBED_test_run(const char *testname, const char *cfg_filename, unsigned int num_peers, uint64_t event_mask, GNUNET_TESTBED_ControllerCallback cc, void *cc_cls, GNUNET_TESTBED_TestMaster test_master, void *test_master_cls)
Convenience method for running a "simple" test on the local system with a single call from 'main'.
struct GNUNET_TESTBED_Operation * GNUNET_TESTBED_service_connect(void *op_cls, struct GNUNET_TESTBED_Peer *peer, const char *service_name, GNUNET_TESTBED_ServiceConnectCompletionCallback cb, void *cb_cls, GNUNET_TESTBED_ConnectAdapter ca, GNUNET_TESTBED_DisconnectAdapter da, void *cada_cls)
Connect to a service offered by the given peer.
@ GNUNET_TESTBED_PIT_IDENTITY
What is the identity of the peer? Returns a 'const struct GNUNET_PeerIdentity *'.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
#define GNUNET_TIME_UNIT_MINUTES
One minute.
#define GNUNET_TIME_UNIT_ZERO
Relative time zero.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_add(struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Relative duration)
Add a given relative duration to the given start time.
static int op_result(struct GNUNET_OP_Handle *h, uint64_t op_id, int64_t result_code, const void *data, uint16_t data_size, void **ctx, uint8_t cancel)
Remove an operation, and call its result callback (unless it was cancelled).
Definition of a command line option.
The identity of the host (wraps the signing key of the peer).
Handle to cancel a cooperative decryption operation.
Plain, unencrypted message that can be encrypted with a group public key.
Public key of a group sharing a secret.
Session that will eventually establish a shared secred between the involved peers and allow encryptio...
A share, with all values in in host byte order.
Opaque handle to an abstract operation to be executed by the testing framework.
A peer controlled by the testing framework.
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.