43 #include "gnunet_signatures.h"
54 #define DEFAULT_REKEY_TIME_INTERVAL GNUNET_TIME_UNIT_DAYS
59 #define PROTO_QUEUE_TIMEOUT GNUNET_TIME_UNIT_MINUTES
64 #define BROADCAST_FREQUENCY GNUNET_TIME_UNIT_MINUTES
69 #define INTERFACE_SCAN_FREQUENCY \
70 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
76 #define ADDRESS_VALIDITY_PERIOD GNUNET_TIME_UNIT_HOURS
78 #define WORKING_QUEUE_INTERVALL \
79 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS,1)
84 #define AES_KEY_SIZE (256 / 8)
89 #define AES_IV_SIZE (96 / 8)
94 #define GCM_TAG_SIZE (128 / 8)
96 #define GENERATE_AT_ONCE 2
107 #define KCN_THRESHOLD 92
115 #define KCN_TARGET 128
126 #define MAX_SQN_DELTA 160
137 #define MAX_SECRETS 128000
143 #define DEFAULT_REKEY_MAX_BYTES (1024LLU * 1024 * 1024 * 4LLU)
149 #define COMMUNICATOR_ADDRESS_PREFIX "udp"
154 #define COMMUNICATOR_CONFIG_SECTION "communicator-udp"
765 struct ipv6_mreq
mcreq;
906 if (AF_INET6 == bi->
sa->sa_family)
938 "Disconnecting receiver for peer `%s'\n",
967 "# receivers active",
1008 uint32_t sid = htonl (serial);
1073 "secret %s destroy %u %u\n",
1089 "%u receiver->acks_available 3\n",
1142 uint32_t sid = htonl (serial);
1154 strlen (
"UDP-IV-KEY"),
1216 "Receiver timed out\n");
1226 if (0 !=
st.rel_value_us)
1254 strlen (
"UDP-CMAC"),
1270 const void *plaintext,
1271 size_t plaintext_len)
1274 const char *pos = plaintext;
1276 while (ntohs (hdr->
size) <= plaintext_len)
1279 "# bytes given to core",
1283 "Giving %u bytes to TNG\n", ntohs (hdr->
size));
1293 plaintext_len -= ntohs (hdr->
size);
1294 if (plaintext_len <
sizeof(*hdr))
1296 pos += ntohs (hdr->
size);
1303 "# bytes padding discarded",
1320 gcry_cipher_hd_t *cipher)
1327 gcry_cipher_open (cipher,
1328 GCRY_CIPHER_AES256 ,
1329 GCRY_CIPHER_MODE_GCM,
1332 rc = gcry_cipher_setkey (*cipher,
key,
sizeof(
key));
1333 GNUNET_assert ((0 == rc) || ((
char) rc == GPG_ERR_WEAK_KEY));
1334 rc = gcry_cipher_setiv (*cipher, iv,
sizeof(iv));
1335 GNUNET_assert ((0 == rc) || ((
char) rc == GPG_ERR_WEAK_KEY));
1359 gcry_cipher_hd_t cipher;
1364 gcry_cipher_decrypt (cipher, out_buf, in_buf_size, in_buf, in_buf_size));
1365 if (0 != gcry_cipher_checktag (cipher, tag,
GCM_TAG_SIZE))
1367 gcry_cipher_close (cipher);
1369 "# AEAD authentication failures",
1374 gcry_cipher_close (cipher);
1449 "Starting destroy all withoutKce: %u.\n",
1463 "Shared secret has no sender or receiver!\n");
1470 ss_to_destroy = pos;
1473 if (ss != ss_to_destroy)
1474 at_least_one_destroyed =
secret_destroy (ss_to_destroy, withoutKce);
1477 if ((ss != ss_start) && ! at_least_one_destroyed)
1480 "Really destroying all.\n");
1485 "Finished destroy all.\n");
1520 "Tell transport we have %u more acks!\n",
1523 "%u kce for rekeying.\n",
1538 uint32_t acks_to_add)
1540 int needed_for_rekeying;
1543 "%u kce for rekeying and %u acks_to_add\n",
1547 needed_for_rekeying = (3 -
receiver->number_rekeying_kce);
1548 if (acks_to_add <= needed_for_rekeying)
1550 receiver->number_rekeying_kce += acks_to_add;
1555 acks_to_add -= (3 -
receiver->number_rekeying_kce);
1560 "%u kce for rekeying and %u acks_to_add\n",
1570 uint32_t acks_to_add =
receiver->ss_rekey->sequence_allowed;
1572 if (
receiver->number_rekeying_kce < 3)
1576 "%u receiver->acks_available 4\n",
1579 if (0 != acks_to_add)
1585 "# rekeying successful\n");
1587 "# rekeying successful",
1606 const struct UDPAck *ack = cls;
1608 uint32_t acks_to_add;
1613 "in handle ack with cmac %s\n",
1618 "We have rekey secret with cmac %s \n",
1621 if ((NULL !=
receiver->ss_rekey) && (0 == memcmp (&ack->
cmac,
1628 if (allowed >
receiver->ss_rekey->sequence_allowed)
1631 "%u > %u (%u %u) for rekey secrect %s\n", allowed,
1632 receiver->ss_rekey->sequence_allowed,
1637 receiver->ss_rekey->sequence_allowed = allowed;
1653 "Found matching mac\n");
1657 if (allowed > ss->sequence_allowed)
1660 "%u > %u (%u %u) for secrect %s\n", allowed,
1661 ss->sequence_allowed,
1666 acks_to_add = (allowed - ss->sequence_allowed);
1668 (
receiver->number_rekeying_kce < 3) )
1692 receiver->acks_available += (allowed - ss->sequence_allowed);
1693 ss->sequence_allowed = allowed;
1695 "%u receiver->acks_available 5\n",
1726 "try_handle_plaintext of size %lu (%u %lu) and type %u\n",
1731 if (
sizeof(*hdr) > buf_size)
1733 if (ntohs (hdr->
size) > buf_size)
1746 buf_size -= ntohs (hdr->
size);
1774 "Precomputing keys for master %s\n",
1790 "We have enough keys.\n");
1812 "Precomputing keys for rekey master %s\n",
1848 int kce_task_finished;
1856 "Considering SS UDPAck %s\n",
1860 "We have %u acks available.\n",
1880 if (NULL != kce_task)
1882 "kce_task is not NULL\n");
1883 if (kce_task_finished)
1885 "kce_task_finished: GNUNET_YES\n");
1888 "initial: GNUNET_YES\n");
1890 if ( kce_task_finished || (
GNUNET_NO == initial))
1906 "Notifying transport of UDPAck %s with initial %u and master %s\n",
1935 else if ((NULL == kce_task_rekey) && (
GNUNET_YES ==
1958 char out_buf[box_len -
sizeof(*box)];
1964 (
const char *) &box[1],
1969 "# Decryption failures with valid KCE",
1977 "# bytes decrypted with BOX",
1981 "# messages decrypted with BOX",
1985 "decrypted UDPBox with kid %s\n",
1994 "Receiver stopped rekeying.\n");
2002 "Got Box: Receiver doing rekeying.\n");
2022 char out_buf[rekey_len -
sizeof(*rekey)];
2027 "decrypt_rekey.\n");
2033 (
const char *) &rekey[1],
2038 "# Decryption failures with valid KCE",
2042 "Decryption with kid %s failed\n",
2049 "# bytes decrypted with Rekey",
2053 "decrypted UDPRekey with kid %s\n",
2062 ss_rekey->
master = *master;
2064 ss_rekey->
sender = sender;
2076 "Received secret with cmac %s\n",
2079 "Received secret with master %s.\n",
2082 "We have %u sequence_allowed.\n",
2085 "We have a sender %p\n",
2088 "We have %u acks available.\n",
2136 sc->sender = sender;
2156 const struct sockaddr *
address,
2168 if (NULL !=
sc.sender)
2222 &
uc->sender.public_key);
2236 socklen_t address_len)
2271 struct sockaddr_storage sa;
2272 struct sockaddr_in *addr_verify;
2273 socklen_t salen =
sizeof(sa);
2274 char buf[UINT16_MAX];
2285 (
struct sockaddr *) &sa,
2293 "Read %lu bytes\n", rcvd);
2295 if (rcvd >
sizeof(
struct UDPRekey))
2298 const struct UDPBox *box;
2309 "UDPRekey has rekeying %u\n",
2319 "UDPRekey with kid %s\n",
2333 if (rcvd >
sizeof(
struct UDPBox))
2335 const struct UDPBox *box;
2355 addr_verify->sin_port = 0;
2357 "received UDPBroadcast from %s\n",
2358 GNUNET_a2s ((
const struct sockaddr *) addr_verify, salen));
2369 "Received our own broadcast\n");
2374 "checking UDPBroadcastSignature for %s\n",
2394 "validating address %s received from UDPBroadcast\n",
2404 "VerifyingPeer %s is verifying UDPBroadcast\n",
2407 "Verifying UDPBroadcast from %s failed\n",
2419 "# messages dropped (no kid, too small for KX)",
2429 char pbuf[rcvd -
sizeof(
struct InitialKX)];
2446 "Unable to decrypt tag, dropping...\n");
2450 "# messages dropped (no kid, AEAD decryption failed)",
2464 "# messages dropped (sender signature invalid)",
2470 "Before SETUP_SENDER\n");
2479 "# messages decrypted without BOX",
2489 "Receiver stopped rekeying.\n");
2497 "Got KX: Receiver doing rekeying.\n");
2512 static struct sockaddr *
2515 struct sockaddr *in;
2521 if (1 == sscanf (bindto,
"%u%1s", &
port,
dummy))
2524 if (
port > UINT16_MAX)
2527 "BINDTO specification `%s' invalid: value too large for port\n",
2537 struct sockaddr_in *i4;
2540 i4->sin_family = AF_INET;
2541 i4->sin_port = htons ((uint16_t)
port);
2542 *sock_len =
sizeof(
struct sockaddr_in);
2543 in = (
struct sockaddr *) i4;
2547 struct sockaddr_in6 *i6;
2550 i6->sin6_family = AF_INET6;
2551 i6->sin6_port = htons ((uint16_t)
port);
2552 *sock_len =
sizeof(
struct sockaddr_in6);
2553 in = (
struct sockaddr *) i6;
2558 colon = strrchr (cp,
':');
2564 if (1 == sscanf (colon,
"%u%1s", &
port,
dummy))
2567 if (
port > UINT16_MAX)
2570 "BINDTO specification `%s' invalid: value too large for port\n",
2580 "BINDTO specification `%s' invalid: last ':' not followed by number\n",
2593 struct sockaddr_in v4;
2595 memset (&v4, 0,
sizeof(v4));
2596 if (1 == inet_pton (AF_INET, cp, &v4.sin_addr))
2598 v4.sin_family = AF_INET;
2599 v4.sin_port = htons ((uint16_t)
port);
2600 #if HAVE_SOCKADDR_IN_SIN_LEN
2601 v4.sin_len =
sizeof(
struct sockaddr_in);
2604 *sock_len =
sizeof(
struct sockaddr_in);
2611 struct sockaddr_in6 v6;
2614 memset (&v6, 0,
sizeof(v6));
2616 if ((
'[' == *cp) && (
']' == cp[strlen (cp) - 1]))
2619 cp[strlen (cp) - 1] =
'\0';
2621 if (1 == inet_pton (AF_INET6,
start, &v6.sin6_addr))
2623 v6.sin6_family = AF_INET6;
2624 v6.sin6_port = htons ((uint16_t)
port);
2625 #if HAVE_SOCKADDR_IN_SIN_LEN
2626 v6.sin6_len =
sizeof(
sizeof(
struct sockaddr_in6));
2629 *sock_len =
sizeof(v6);
2648 do_pad (gcry_cipher_hd_t out_cipher,
char *dgram,
size_t pad_size)
2656 { .
size = htons (
sizeof(pad)),
2659 memcpy (pad, &hdr,
sizeof(hdr));
2663 gcry_cipher_encrypt (out_cipher, dgram,
sizeof(pad), pad,
sizeof(pad)));
2681 uint16_t msize = ntohs (
msg->
size);
2686 char dgram[
receiver->kx_mtu +
sizeof(
uc) +
sizeof(kx)];
2688 gcry_cipher_hd_t out_cipher;
2737 0 == gcry_cipher_encrypt (out_cipher, &dgram[dpos], msize,
msg, msize));
2739 do_pad (out_cipher, &dgram[dpos],
sizeof(dgram) - dpos);
2743 0 == gcry_cipher_gettag (out_cipher, kx.
gcm_tag,
sizeof(kx.
gcm_tag)));
2744 gcry_cipher_close (out_cipher);
2749 memcpy (dgram, &kx,
sizeof(kx));
2757 "Sending KX with payload size %u to %s\n",
2772 "Timeout is %llu\n.",
2773 (
unsigned long long)
receiver->rekey_timeout.abs_value_us);
2775 if (0 ==
receiver->rekey_timeout.abs_value_us)
2784 "Relative time is %llu and timeout is %llu\n.",
2786 (
unsigned long long)
receiver->rekey_timeout.abs_value_us);
2792 "Bytes send %llu greater than %llu max bytes\n.",
2793 (
unsigned long long)
receiver->rekey_send_bytes,
2796 "Relative time is %llu and timeout is %llu\n.",
2798 (
unsigned long long)
receiver->rekey_timeout.abs_value_us);
2800 receiver->rekey_timeout.abs_value_us = 0;
2808 "Sender started rekeying.\n");
2811 "Sending rekeying with kid %s\n",
2821 uint8_t is_ss_rekey_sequence_allowed_zero =
GNUNET_NO;
2822 uint8_t is_acks_available_below =
GNUNET_NO;
2833 not_below = (
receiver->rekey_acks_available
2834 - (
receiver->rekey_acks_available % 3)) / 3;
2835 is_ss_rekey_sequence_allowed_zero = (0 ==
2836 receiver->ss_rekey->sequence_allowed);
2837 is_acks_available_below = (
receiver->acks_available >= not_below);
2838 send_rekey = (0 == (
receiver->acks_available - not_below) % not_below) &&
2839 is_acks_available_below && is_ss_rekey_sequence_allowed_zero;
2841 "send_rekey: %u, %u, %u\n",
2846 else if (NULL ==
receiver->ss_rekey)
2852 receiver->ss_rekey->sequence_allowed = 0;
2854 "Setup secret with cmac %s\n",
2857 "Setup secret with master %s.\n",
2864 gcry_cipher_hd_t rekey_out_cipher;
2873 rekey = (
struct UDPRekey *) rekey_dgram;
2883 0 == gcry_cipher_encrypt (rekey_out_cipher, &rekey_dgram[dpos],
2884 sizeof(
receiver->ss_rekey->master),
2886 sizeof(
receiver->ss_rekey->master)));
2887 dpos +=
sizeof(
receiver->ss_rekey->master);
2898 do_pad (rekey_out_cipher, &rekey_dgram[dpos],
sizeof(rekey_dgram)
2903 gcry_cipher_close (rekey_out_cipher);
2906 "Sending rekey with kid %s and master %s\n",
2910 "Sending rekey with cmac %s\n",
2913 "%u rekey kces left.\n",
2918 sizeof(rekey_dgram),
2925 "%u receiver->acks_available 1\n",
2950 uint16_t msize = ntohs (
msg->
size);
2957 "msize: %u, mtu: %lu, acks: %u\n",
2972 if (0 < ss->sequence_used)
2974 "Trying to send UDPBox with shared secrect %s sequence_used %u and ss->sequence_allowed %u\n",
2977 ss->sequence_allowed);
2979 if (ss->sequence_used >= ss->sequence_allowed)
2989 gcry_cipher_hd_t out_cipher;
2992 box = (
struct UDPBox *) dgram;
2993 ss->sequence_used++;
2994 get_kid (&ss->master, ss->sequence_used, &box->
kid);
2995 setup_cipher (&ss->master, ss->sequence_used, &out_cipher);
2997 dpos =
sizeof(
struct UDPBox);
2999 0 == gcry_cipher_encrypt (out_cipher, &dgram[dpos], msize,
msg, msize));
3001 do_pad (out_cipher, &dgram[dpos],
sizeof(dgram) - dpos);
3005 gcry_cipher_close (out_cipher);
3021 "Sending UDPBox with payload size %u, %u acks left\n",
3027 "%u receiver->acks_available 2\n",
3039 "Sender stopped rekeying\n");
3041 if ((NULL !=
receiver->ss_rekey) && (0 <
3070 "Default MQ destroyed\n");
3093 "KX MQ destroyed\n");
3132 "MQ error in queue to %s: %d\n",
3162 switch (
receiver->address->sa_family)
3187 "Setting up MQs and QHs\n");
3243 struct sockaddr *in;
3267 "Added %s to receivers\n",
3275 "# receivers active",
3423 "do_shutdown finished\n");
3441 const struct UDPAck *ack;
3445 "Storing UDPAck received from backchannel from %s\n",
3479 const struct sockaddr *addr,
3528 switch (bi->
sa->sa_family)
3544 "creating UDPBroadcast from %s\n",
3547 "sending UDPBroadcast to add %s\n",
3569 struct sockaddr_in6 dst;
3571 dst.sin6_family = AF_INET6;
3572 dst.sin6_port = htons (
my_port);
3573 dst.sin6_addr = bi->
mcreq.ipv6mr_multiaddr;
3574 dst.sin6_scope_id = ((
struct sockaddr_in6 *) bi->
ba)->sin6_scope_id;
3577 "sending UDPBroadcast\n");
3581 (
const struct sockaddr *) &dst,
3613 const struct sockaddr *addr,
3614 const struct sockaddr *broadcast_addr,
3615 const struct sockaddr *netmask,
3634 if ((bi->
salen == addrlen) && (0 == memcmp (addr, bi->
sa, addrlen)))
3641 if ((AF_INET6 == addr->sa_family) && (NULL == broadcast_addr))
3649 if ( (NULL != broadcast_addr) &&
3650 (addrlen ==
sizeof (
struct sockaddr_in)) )
3652 struct sockaddr_in *ba;
3656 ba->sin_port = htons (2086);
3657 bi->
ba = (
struct sockaddr *) ba;
3659 bi->
salen = addrlen;
3667 "creating UDPBroadcastSignature for %s\n",
3678 if ((AF_INET6 == addr->sa_family) && (NULL != broadcast_addr))
3681 const struct sockaddr_in6 *s6 =
3682 (
const struct sockaddr_in6 *) broadcast_addr;
3685 1 == inet_pton (AF_INET6,
"FF05::13B", &bi->
mcreq.ipv6mr_multiaddr));
3697 bi->
mcreq.ipv6mr_interface = s6->sin6_scope_id;
3740 const struct sockaddr *addr,
3757 const char *cfgfile,
3761 struct sockaddr *in;
3763 struct sockaddr_storage in_sto;
3798 "Failed to setup UDP socket address with path `%s'\n",
3814 if (AF_INET6 == in->sa_family)
3833 sto_len =
sizeof(in_sto);
3835 (
struct sockaddr *) &in_sto,
3838 memcpy (&in_sto, in, in_len);
3843 in = (
struct sockaddr *) &in_sto;
3848 GNUNET_a2s ((
const struct sockaddr *) &in_sto,
3850 switch (in->sa_family)
3853 my_port = ntohs (((
struct sockaddr_in *) in)->sin_port);
3857 my_port = ntohs (((
struct sockaddr_in6 *) in)->sin6_port);
3879 "Transport service is lacking key configuration settings. Exiting.\n"));
3914 "DISABLE_BROADCAST"))
3922 (
const struct sockaddr **) &in,
3947 "Starting udp communicator\n");
3953 "gnunet-communicator-udp",
3954 _ (
"GNUnet UDP communicator"),
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
struct GNUNET_GETOPT_CommandLineOption options[]
struct GNUNET_MQ_Handle * mq
struct GNUNET_MessageHeader * msg
#define GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_UDP_BROADCAST
Signature used by UDP broadcasts.
#define GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_UDP_HANDSHAKE
Signature used by UDP communicator handshake.
static int ret
Return value of the commandline.
static int start
Set if we are to start default services (including ARM).
static uint16_t port
Port number.
#define AES_KEY_SIZE
AES key size.
static struct BroadcastInterface * bi_tail
Broadcast interface tasks.
#define DEFAULT_REKEY_TIME_INTERVAL
How often do we rekey based on time (at least)
#define WORKING_QUEUE_INTERVALL
static void kce_destroy(struct KeyCacheEntry *kce)
Free memory used by key cache entry.
static void destroy_all_secrets(struct SharedSecret *ss, int withoutKce)
Destroying all secrets.
static void mq_destroy_d(struct GNUNET_MQ_Handle *mq, void *impl_state)
Signature of functions implementing the destruction of a message queue.
static void get_iv_key(const struct GNUNET_HashCode *msec, uint32_t serial, char key[(256/8)], char iv[(96/8)])
Compute key and iv.
static uint32_t reset_rekey_kces(struct ReceiverAddress *receiver, uint32_t acks_to_add)
static int secret_destroy(struct SharedSecret *ss, int withoutKce)
Destroy ss and associated key cache entries.
static void setup_cipher(const struct GNUNET_HashCode *msec, uint32_t serial, gcry_cipher_hd_t *cipher)
Setup cipher based on shared secret msec and serial number serial.
#define GCM_TAG_SIZE
Size of the GCM tag.
static struct GNUNET_PeerIdentity my_identity
Our public key.
static void mq_send_kx(struct GNUNET_MQ_Handle *mq, const struct GNUNET_MessageHeader *msg, void *impl_state)
Signature of functions implementing the sending functionality of a message queue.
#define COMMUNICATOR_ADDRESS_PREFIX
Address prefix used by the communicator.
static void kce_generate(struct SharedSecret *ss, uint32_t seq)
Setup key cache entry for sequence number seq and shared secret ss.
static void add_acks(struct SharedSecret *ss, int acks_to_add)
#define ADDRESS_VALIDITY_PERIOD
How long do we believe our addresses to remain up (before the other peer should revalidate).
static void consider_ss_ack(struct SharedSecret *ss, int initial)
We established a shared secret with a sender.
static void mq_destroy_kx(struct GNUNET_MQ_Handle *mq, void *impl_state)
Signature of functions implementing the destruction of a message queue.
static struct GNUNET_CONTAINER_MultiPeerMap * receivers
Receivers (map from peer identity to struct ReceiverAddress)
static void kce_generate_rekey_cb(void *cls)
static int find_sender_by_address(void *cls, const struct GNUNET_PeerIdentity *key, void *value)
Find existing struct SenderAddress by matching addresses.
static void try_connection_reversal(void *cls, const struct sockaddr *addr, socklen_t addrlen)
static struct GNUNET_SCHEDULER_Task * broadcast_task
ID of master broadcast task.
static struct GNUNET_NT_InterfaceScanner * is
Network scanner to determine network types.
static struct GNUNET_STATISTICS_Handle * stats
For logging statistics.
static void add_acks_rekey(struct ReceiverAddress *receiver)
static const struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
static void enc_notify_cb(void *cls, const struct GNUNET_PeerIdentity *sender, const struct GNUNET_MessageHeader *msg)
Function called when the transport service has received a backchannel message for this communicator (...
static struct GNUNET_TIME_Relative rekey_interval
The rekey interval.
static void reschedule_receiver_timeout(struct ReceiverAddress *receiver)
Increment receiver timeout due to activity.
static struct GNUNET_NETWORK_Handle * udp_sock
Our socket.
static void do_pad(gcry_cipher_hd_t out_cipher, char *dgram, size_t pad_size)
Pad dgram by pad_size using out_cipher.
static void mq_send_d(struct GNUNET_MQ_Handle *mq, const struct GNUNET_MessageHeader *msg, void *impl_state)
Signature of functions implementing the sending functionality of a message queue.
static void sock_read(void *cls)
Socket read task.
static void reschedule_sender_timeout(struct SenderAddress *sender)
Increment sender timeout due to activity.
static struct GNUNET_CONTAINER_Heap * senders_heap
Expiration heap for senders (contains struct SenderAddress)
static void do_shutdown(void *cls)
Shutdown the UNIX communicator.
#define COMMUNICATOR_CONFIG_SECTION
Configuration section used by the communicator.
static void nat_address_cb(void *cls, void **app_ctx, int add_remove, enum GNUNET_NAT_AddressClass ac, const struct sockaddr *addr, socklen_t addrlen)
Signature of the callback passed to GNUNET_NAT_register() for a function to call whenever our set of ...
static struct GNUNET_TRANSPORT_CommunicatorHandle * ch
Our environment.
struct SharedSecret * ss_finished
Shared secret we finished the last kce working queue for.
static void sender_destroy(struct SenderAddress *sender)
Functions with this signature are called whenever we need to close a sender's state due to timeout.
static void setup_receiver_mq(struct ReceiverAddress *receiver)
Setup the MQ for the receiver.
static struct SharedSecret * setup_shared_secret_enc(const struct GNUNET_CRYPTO_EcdhePrivateKey *ephemeral, struct ReceiverAddress *receiver, int add_to_receiver)
Setup shared secret for encryption.
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
Setup communicator and launch network interactions.
#define DEFAULT_REKEY_MAX_BYTES
Default value for how often we do rekey based on number of bytes transmitted? (additionally randomize...
static struct GNUNET_NAT_Handle * nat
Connection to NAT service.
static struct SenderAddress * setup_sender(const struct GNUNET_PeerIdentity *target, const struct sockaddr *address, socklen_t address_len)
Create sender address for target.
static void kce_generate_cb(void *cls)
static struct GNUNET_SCHEDULER_Task * read_task
ID of read task.
static void try_handle_plaintext(struct SenderAddress *sender, const void *buf, size_t buf_size)
Test if we have received a valid message in plaintext.
static struct sockaddr * udp_address_to_sockaddr(const char *bindto, socklen_t *sock_len)
Convert UDP bind specification to a struct sockaddr *
static void receiver_destroy(struct ReceiverAddress *receiver)
Destroys a receiving state due to timeout or shutdown.
static void check_for_rekeying(struct ReceiverAddress *receiver, struct UDPBox *box)
static struct GNUNET_CONTAINER_MultiShortmap * key_cache
Cache of pre-generated key IDs.
static int handle_ack(void *cls, const struct GNUNET_PeerIdentity *pid, void *value)
We received an ACK for pid.
#define KCN_TARGET
How many KCNs do we keep around after we hit the KCN_THRESHOLD? Should be larger than KCN_THRESHOLD s...
static void mq_cancel(struct GNUNET_MQ_Handle *mq, void *impl_state)
Implementation function that cancels the currently sent message.
static struct GNUNET_TRANSPORT_ApplicationHandle * ah
Our handle to report addresses for validation to TRANSPORT.
static void bi_destroy(struct BroadcastInterface *bi)
An interface went away, stop broadcasting on it.
static int have_v6_socket
GNUNET_YES if udp_sock supports IPv6.
static int try_decrypt(const struct SharedSecret *ss, const char tag[(128/8)], uint32_t serial, const char *in_buf, size_t in_buf_size, char *out_buf)
Try to decrypt buf using shared secret ss and key/iv derived using serial.
static void pass_plaintext_to_core(struct SenderAddress *sender, const void *plaintext, size_t plaintext_len)
We received plaintext_len bytes of plaintext from a sender.
static int mq_init(void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
Function called by the transport service to initialize a message queue given address information abou...
static void do_broadcast(void *cls)
Scan interfaces to broadcast our presence on the LAN.
#define INTERFACE_SCAN_FREQUENCY
How often do we scan for changes to our network interfaces?
static struct GNUNET_CONTAINER_Heap * receivers_heap
Expiration heap for receivers (contains struct ReceiverAddress)
static uint16_t my_port
Port number to which we are actually bound.
static void get_kid(const struct GNUNET_HashCode *msec, uint32_t serial, struct GNUNET_ShortHashCode *kid)
Compute kid.
static void check_timeouts(void *cls)
Task run to check #receiver_heap and #sender_heap for timeouts.
static int get_receiver_delete_it(void *cls, const struct GNUNET_PeerIdentity *target, void *value)
Iterator over all receivers to clean up.
static struct GNUNET_CONTAINER_MultiPeerMap * senders
Senders (map from peer identity to struct SenderAddress)
static void calculate_cmac(struct SharedSecret *ss)
Calculate cmac from master in ss.
static struct GNUNET_SCHEDULER_Task * timeout_task
ID of timeout task.
#define MAX_SQN_DELTA
What is the maximum delta between KCN sequence numbers that we allow.
static void decrypt_rekey(const struct UDPRekey *rekey, size_t rekey_len, struct KeyCacheEntry *kce, struct SenderAddress *sender)
We received a rekey with matching kce.
int main(int argc, char *const *argv)
The main function for the UNIX communicator.
static struct GNUNET_CRYPTO_EddsaPrivateKey * my_private_key
Our private key.
#define KCN_THRESHOLD
If we fall below this number of available KCNs, we generate additional ACKs until we reach KCN_TARGET...
#define MAX_SECRETS
How many shared master secrets do we keep around at most per sender? Should be large enough so that w...
static struct BroadcastInterface * bi_head
Broadcast interface tasks.
static int get_sender_delete_it(void *cls, const struct GNUNET_PeerIdentity *target, void *value)
Iterator over all senders to clean up.
static struct SharedSecret * setup_shared_secret_dec(const struct GNUNET_CRYPTO_EcdhePublicKey *ephemeral)
Setup shared secret for decryption.
static char * sockaddr_to_udpaddr_string(const struct sockaddr *address, socklen_t address_len)
Converts address to the address string format used by this communicator in HELLOs.
static void send_UDPRekey(struct ReceiverAddress *receiver, struct SharedSecret *ss)
static void mq_error(void *cls, enum GNUNET_MQ_Error error)
Generic error handler, called with the appropriate error code and the same closure specified at the c...
static int iface_proc(void *cls, const char *name, int isDefault, const struct sockaddr *addr, const struct sockaddr *broadcast_addr, const struct sockaddr *netmask, socklen_t addrlen)
Callback function invoked for each interface found.
static void ifc_broadcast(void *cls)
Broadcast our presence on one of our interfaces.
static void decrypt_box(const struct UDPBox *box, size_t box_len, struct KeyCacheEntry *kce)
We received a box with matching kce.
static int verify_confirmation(const struct GNUNET_CRYPTO_EcdhePublicKey *ephemeral, const struct UDPConfirmation *uc)
Check signature from uc against ephemeral.
static unsigned long long rekey_max_bytes
How often we do rekey based on number of bytes transmitted.
#define AES_IV_SIZE
AES (GCM) IV size.
#define BROADCAST_FREQUENCY
How often do we broadcast our presence on the LAN?
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
static struct GNUNET_SCHEDULER_Task * st
The shutdown task.
static char * address
GNS address for this phone.
struct GNUNET_HashCode key
The key used in the DHT.
static struct in_addr dummy
Target "dummy" address of the packet we pretend to respond to.
static char * value
Value of the record to add/remove.
static struct GNUNET_NAT_AUTO_Test * nt
Handle to a NAT test operation.
static struct GNUNET_MQ_Envelope * ac
Handle to current GNUNET_PEERINFO_add_peer() operation.
static struct GNUNET_FS_SearchContext * sc
static struct GNUNET_TIME_Relative delay
When should dkg communication start?
static int do_decrypt(struct GSC_KeyExchangeInfo *kx, const struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, const void *in, void *out, size_t size)
Decrypt size bytes from in and write the result to out.
static struct GNUNET_PeerIdentity pid
Identity of the peer we transmit to / connect to.
static struct GNUNET_FS_UnindexContext * uc
Constants for network protocols.
API to create, modify and access statistics.
Bandwidth allocation API for applications to interact with.
API of the transport service towards the communicator processes.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_size(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *size)
Get a configuration value that should be a size in bytes.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_yesno(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option)
Get a configuration value that should be in a set of "YES" or "NO".
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_time(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, struct GNUNET_TIME_Relative *time)
Get a configuration value that should be a relative time.
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.
#define GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT
After how long do we consider a connection to a peer dead if we don't receive messages from the peer?
void GNUNET_CRYPTO_ecdhe_key_create(struct GNUNET_CRYPTO_EcdhePrivateKey *pk)
Create a new private key.
uint64_t GNUNET_CRYPTO_random_u64(enum GNUNET_CRYPTO_Quality mode, uint64_t max)
Generate a random unsigned 64-bit value.
struct GNUNET_CRYPTO_EddsaPrivateKey * GNUNET_CRYPTO_eddsa_key_create_from_configuration(const struct GNUNET_CONFIGURATION_Handle *cfg)
Create a new private key by reading our peer's key from the file specified in the configuration.
void GNUNET_CRYPTO_random_block(enum GNUNET_CRYPTO_Quality mode, void *buffer, size_t length)
Fill block with a random values.
void GNUNET_CRYPTO_eddsa_key_get_public(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, struct GNUNET_CRYPTO_EddsaPublicKey *pub)
Extract the public key for the given private key.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_ecdh(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, const struct GNUNET_CRYPTO_EcdhePublicKey *pub, struct GNUNET_HashCode *key_material)
Derive key material from a ECDH public key and a private EdDSA key.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_ecdh_eddsa(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, const struct GNUNET_CRYPTO_EddsaPublicKey *pub, struct GNUNET_HashCode *key_material)
Derive key material from a EdDSA public key and a private ECDH key.
#define GNUNET_CRYPTO_eddsa_sign(priv, ps, sig)
EdDSA sign a given block.
#define GNUNET_CRYPTO_eddsa_verify(purp, ps, sig, pub)
Verify EdDSA signature.
void GNUNET_CRYPTO_ecdhe_key_get_public(const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, struct GNUNET_CRYPTO_EcdhePublicKey *pub)
Extract the public key for the given private key.
@ GNUNET_CRYPTO_QUALITY_WEAK
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
void GNUNET_CRYPTO_hash(const void *block, size_t size, struct GNUNET_HashCode *ret)
Compute hash of a given block.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hkdf(void *result, size_t out_len, int xtr_algo, int prf_algo, const void *xts, size_t xts_len, const void *skm, size_t skm_len,...)
Derive key.
void GNUNET_CONTAINER_multipeermap_destroy(struct GNUNET_CONTAINER_MultiPeerMap *map)
Destroy a hash map.
int GNUNET_CONTAINER_multipeermap_iterate(struct GNUNET_CONTAINER_MultiPeerMap *map, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multishortmap_put(struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
struct GNUNET_CONTAINER_MultiPeerMap * GNUNET_CONTAINER_multipeermap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
struct GNUNET_CONTAINER_MultiShortmap * GNUNET_CONTAINER_multishortmap_create(unsigned int len, int do_not_copy_keys)
Create a multi peer map (hash map for public keys of peers).
void GNUNET_CONTAINER_multishortmap_destroy(struct GNUNET_CONTAINER_MultiShortmap *map)
Destroy a hash map.
void * GNUNET_CONTAINER_multishortmap_get(const struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key)
Given a key find a value in the map matching the key.
int GNUNET_CONTAINER_multipeermap_get_multiple(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, GNUNET_CONTAINER_PeerMapIterator it, void *it_cls)
Iterate over all entries in the map that match a particular key.
unsigned int GNUNET_CONTAINER_multishortmap_size(const struct GNUNET_CONTAINER_MultiShortmap *map)
Get the number of key-value pairs in the map.
unsigned int GNUNET_CONTAINER_multipeermap_size(const struct GNUNET_CONTAINER_MultiPeerMap *map)
Get the number of key-value pairs in the map.
int GNUNET_CONTAINER_multipeermap_put(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
int GNUNET_CONTAINER_multishortmap_remove(struct GNUNET_CONTAINER_MultiShortmap *map, const struct GNUNET_ShortHashCode *key, const void *value)
Remove the given key-value pair from the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multipeermap_remove(struct GNUNET_CONTAINER_MultiPeerMap *map, const struct GNUNET_PeerIdentity *key, const void *value)
Remove the given key-value pair from the map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
Allow multiple values with the same key.
void * GNUNET_CONTAINER_heap_remove_node(struct GNUNET_CONTAINER_HeapNode *node)
Removes a node from the heap.
void GNUNET_CONTAINER_heap_update_cost(struct GNUNET_CONTAINER_HeapNode *node, GNUNET_CONTAINER_HeapCostType new_cost)
Updates the cost of any node in the tree.
struct GNUNET_CONTAINER_HeapNode * GNUNET_CONTAINER_heap_insert(struct GNUNET_CONTAINER_Heap *heap, void *element, GNUNET_CONTAINER_HeapCostType cost)
Inserts a new element into the heap.
void * GNUNET_CONTAINER_heap_peek(const struct GNUNET_CONTAINER_Heap *heap)
Get element stored at the root of heap.
struct GNUNET_CONTAINER_Heap * GNUNET_CONTAINER_heap_create(enum GNUNET_CONTAINER_HeapOrder order)
Create a new heap.
void GNUNET_CONTAINER_heap_destroy(struct GNUNET_CONTAINER_Heap *heap)
Destroys the heap.
@ GNUNET_CONTAINER_HEAP_ORDER_MIN
Heap with the minimum cost at the root.
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32.
#define GNUNET_log(kind,...)
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;.
#define GNUNET_PACKED
gcc-ism to get packed structs.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
const char * GNUNET_sh2s(const struct GNUNET_ShortHashCode *shc)
Convert a short hash value to a string (for printing debug messages).
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
void GNUNET_log_config_missing(enum GNUNET_ErrorType kind, const char *section, const char *option)
Log error message about missing configuration option.
const char * GNUNET_i2s_full(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_log_strerror(level, cmd)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
void GNUNET_log_from_nocheck(enum GNUNET_ErrorType kind, const char *comp, const char *message,...) __attribute__((format(printf
Log function that specifies an alternative component.
const char * GNUNET_a2s(const struct sockaddr *addr, socklen_t addrlen)
Convert a "struct sockaddr*" (IPv4 or IPv6 address) to a string (for printing debug messages).
#define GNUNET_log_strerror_file(level, cmd, filename)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
#define GNUNET_free_nz(ptr)
Wrapper around free.
#define GNUNET_memdup(buf, size)
Allocate and initialize a block of memory.
GNUNET_MQ_Error
Error codes for the queue.
struct GNUNET_MQ_Handle * GNUNET_MQ_queue_for_callbacks(GNUNET_MQ_SendImpl send, GNUNET_MQ_DestroyImpl destroy, GNUNET_MQ_CancelImpl cancel, void *impl_state, const struct GNUNET_MQ_MessageHandler *handlers, GNUNET_MQ_ErrorHandler error_handler, void *cls)
Create a message queue for the specified handlers.
void GNUNET_MQ_impl_send_continue(struct GNUNET_MQ_Handle *mq)
Call the send implementation for the next queued message, if any.
void GNUNET_NAT_unregister(struct GNUNET_NAT_Handle *nh)
Stop port redirection and public IP address detection for the given handle.
GNUNET_NAT_AddressClass
Some addresses contain sensitive information or are not suitable for global distribution.
struct GNUNET_NAT_Handle * GNUNET_NAT_register(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *config_section, uint8_t proto, unsigned int num_addrs, const struct sockaddr **addrs, const socklen_t *addrlens, GNUNET_NAT_AddressCallback address_callback, GNUNET_NAT_ReversalCallback reversal_callback, void *callback_cls)
Attempt to enable port redirection and detect public IP address contacting UPnP or NAT-PMP routers on...
enum GNUNET_GenericReturnValue GNUNET_NETWORK_socket_close(struct GNUNET_NETWORK_Handle *desc)
Close a socket.
int GNUNET_NETWORK_get_fd(const struct GNUNET_NETWORK_Handle *desc)
Return file descriptor for this network handle.
ssize_t GNUNET_NETWORK_socket_recvfrom(const struct GNUNET_NETWORK_Handle *desc, void *buffer, size_t length, struct sockaddr *src_addr, socklen_t *addrlen)
Read data from a socket (always non-blocking).
struct GNUNET_NETWORK_Handle * GNUNET_NETWORK_socket_create(int domain, int type, int protocol)
Create a new socket.
enum GNUNET_GenericReturnValue GNUNET_NETWORK_test_pf(int pf)
Test if the given protocol family is supported by this system.
enum GNUNET_GenericReturnValue GNUNET_NETWORK_socket_bind(struct GNUNET_NETWORK_Handle *desc, const struct sockaddr *address, socklen_t address_len)
Bind a socket to a particular address.
int GNUNET_NETWORK_socket_setsockopt(struct GNUNET_NETWORK_Handle *fd, int level, int option_name, const void *option_value, socklen_t option_len)
Set socket option.
ssize_t GNUNET_NETWORK_socket_sendto(const struct GNUNET_NETWORK_Handle *desc, const void *message, size_t length, const struct sockaddr *dest_addr, socklen_t dest_len)
Send data to a particular destination (always non-blocking).
GNUNET_NetworkType
Types of networks (with separate quotas) we support.
void GNUNET_NT_scanner_done(struct GNUNET_NT_InterfaceScanner *is)
Terminate interface scanner.
struct GNUNET_NT_InterfaceScanner * GNUNET_NT_scanner_init(void)
Initialize the address characterization client handle.
enum GNUNET_NetworkType GNUNET_NT_scanner_get_type(struct GNUNET_NT_InterfaceScanner *is, const struct sockaddr *addr, socklen_t addrlen)
Returns where the address is located: loopback, LAN or WAN.
@ GNUNET_NT_LOOPBACK
Loopback (same host).
void GNUNET_OS_network_interfaces_list(GNUNET_OS_NetworkInterfaceProcessor proc, void *proc_cls)
Enumerate all network interfaces.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration,...
#define GNUNET_MESSAGE_TYPE_COMMUNICATOR_UDP_PAD
UDP communicator padding.
#define GNUNET_MESSAGE_TYPE_COMMUNICATOR_UDP_ACK
UDP KX acknowledgement.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_read_net(struct GNUNET_TIME_Relative delay, struct GNUNET_NETWORK_Handle *rfd, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay or when the specified file descriptor is ready f...
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,...
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
struct GNUNET_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for the statistics service.
void GNUNET_STATISTICS_set(struct GNUNET_STATISTICS_Handle *handle, const char *name, uint64_t value, int make_persistent)
Set statistic value for the peer.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
enum GNUNET_GenericReturnValue GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_min(struct GNUNET_TIME_Relative t1, struct GNUNET_TIME_Relative t2)
Return the minimum of two relative time values.
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future)
Given a timestamp in the future, how much time remains until then?
struct GNUNET_TIME_Absolute GNUNET_TIME_relative_to_absolute(struct GNUNET_TIME_Relative rel)
Convert relative time to an absolute time in the future.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get_monotonic(const struct GNUNET_CONFIGURATION_Handle *cfg)
Obtain the current time and make sure it is monotonically increasing.
struct GNUNET_TIME_AbsoluteNBO GNUNET_TIME_absolute_hton(struct GNUNET_TIME_Absolute a)
Convert absolute time to network byte order.
void GNUNET_TRANSPORT_communicator_address_remove(struct GNUNET_TRANSPORT_AddressIdentifier *ai)
Notify transport service about an address that this communicator no longer provides for this peer.
int GNUNET_TRANSPORT_communicator_receive(struct GNUNET_TRANSPORT_CommunicatorHandle *handle, const struct GNUNET_PeerIdentity *sender, const struct GNUNET_MessageHeader *msg, struct GNUNET_TIME_Relative expected_addr_validity, GNUNET_TRANSPORT_MessageCompletedCallback cb, void *cb_cls)
Notify transport service that the communicator has received a message.
void GNUNET_TRANSPORT_communicator_mq_del(struct GNUNET_TRANSPORT_QueueHandle *qh)
Notify transport service that an MQ became unavailable due to a disconnect or timeout.
void GNUNET_TRANSPORT_application_done(struct GNUNET_TRANSPORT_ApplicationHandle *ch)
Shutdown TRANSPORT application client.
#define GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED
Queue length.
struct GNUNET_TRANSPORT_ApplicationHandle * GNUNET_TRANSPORT_application_init(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the TRANSPORT application client handle.
struct GNUNET_TRANSPORT_QueueHandle * GNUNET_TRANSPORT_communicator_mq_add(struct GNUNET_TRANSPORT_CommunicatorHandle *ch, const struct GNUNET_PeerIdentity *peer, const char *address, uint32_t mtu, uint64_t q_len, uint32_t priority, enum GNUNET_NetworkType nt, enum GNUNET_TRANSPORT_ConnectionStatus cs, struct GNUNET_MQ_Handle *mq)
Notify transport service that a MQ became available due to an "inbound" connection or because the com...
struct GNUNET_TRANSPORT_AddressIdentifier * GNUNET_TRANSPORT_communicator_address_add(struct GNUNET_TRANSPORT_CommunicatorHandle *ch, const char *address, enum GNUNET_NetworkType nt, struct GNUNET_TIME_Relative expiration)
Notify transport service about an address that this communicator provides for this peer.
void GNUNET_TRANSPORT_application_validate(struct GNUNET_TRANSPORT_ApplicationHandle *ch, const struct GNUNET_PeerIdentity *peer, enum GNUNET_NetworkType nt, const char *addr)
An application (or a communicator) has received a HELLO (or other address data of another peer) and w...
void GNUNET_TRANSPORT_communicator_mq_update(struct GNUNET_TRANSPORT_CommunicatorHandle *ch, const struct GNUNET_TRANSPORT_QueueHandle *u_qh, uint64_t q_len, uint32_t priority)
Notify transport service that an MQ was updated.
void GNUNET_TRANSPORT_communicator_notify(struct GNUNET_TRANSPORT_CommunicatorHandle *ch, const struct GNUNET_PeerIdentity *pid, const char *comm, const struct GNUNET_MessageHeader *header)
The communicator asks the transport service to route a message via a different path to another commun...
void GNUNET_TRANSPORT_communicator_disconnect(struct GNUNET_TRANSPORT_CommunicatorHandle *ch)
Disconnect from the transport service.
struct GNUNET_TRANSPORT_CommunicatorHandle * GNUNET_TRANSPORT_communicator_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *config_section_name, const char *addr_prefix, enum GNUNET_TRANSPORT_CommunicatorCharacteristics cc, GNUNET_TRANSPORT_CommunicatorMqInit mq_init, void *mq_init_cls, GNUNET_TRANSPORT_CommunicatorNotify notify_cb, void *notify_cb_cls)
Connect to the transport service.
@ GNUNET_TRANSPORT_CC_UNRELIABLE
Transmission is unreliable (e.g.
@ GNUNET_TRANSPORT_CS_OUTBOUND
this is an outbound connection (transport initiated)
void receiver(void *cls, const void *buf, size_t available, const struct sockaddr *addr, socklen_t addrlen, int errCode)
Callback to read from the SOCKS5 proxy.
Interface we broadcast our presence on.
socklen_t salen
Number of bytes in sa.
struct ipv6_mreq mcreq
If this is an IPv6 interface, this is the request we use to join/leave the group.
struct BroadcastInterface * next
Kept in a DLL.
int found
Was this interface found in the last iface_proc() scan?
struct UDPBroadcast bcm
Message we broadcast on this interface.
struct sockaddr * ba
Broadcast address to use on the interface.
struct GNUNET_SCHEDULER_Task * broadcast_task
Task for this broadcast interface.
struct BroadcastInterface * prev
Kept in a DLL.
struct sockaddr * sa
Sender's address of the interface.
Handle to a node in a heap.
Internal representation of the hash map.
Internal representation of the hash map.
header of what an ECC signature signs this must be followed by "size - 8" bytes of the actual signed ...
uint32_t size
How many bytes does this signature sign? (including this purpose header); in network byte order (!...
uint32_t purpose
What does this signature vouch for? This must contain a GNUNET_SIGNATURE_PURPOSE_XXX constant (from g...
Private ECC key encoded for transmission.
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and encr...
Private ECC key encoded for transmission.
an ECC signature using EdDSA.
Definition of a command line option.
Handle to a message queue.
Handle for active NAT registrations.
Handle to the interface scanner.
The identity of the host (wraps the signing key of the peer).
struct GNUNET_CRYPTO_EddsaPublicKey public_key
Entry in list of pending tasks.
Time for absolute time used by GNUnet, in microseconds and in network byte order.
Time for absolute times used by GNUnet, in microseconds.
uint64_t abs_value_us
The actual value.
Time for relative time used by GNUnet, in microseconds.
uint64_t rel_value_us
The actual value.
Internal representation of an address a communicator is currently providing for the transport service...
Handle to the TRANSPORT subsystem for application management.
Opaque handle to the transport service for communicators.
Handle returned to identify the internal data structure the transport API has created to manage a mes...
"Plaintext" header at beginning of KX message.
char gcm_tag[(128/8)]
HMAC for the following encrypted message, using GCM.
int rekeying
A flag indicating, if the sender is doing rekeying.
struct GNUNET_CRYPTO_EcdhePublicKey ephemeral
Ephemeral key for KX.
Pre-generated "kid" code (key and IV identification code) to quickly derive master key for a struct U...
struct GNUNET_ShortHashCode kid
Key and IV identification code.
uint32_t sequence_number
Sequence number used to derive this entry from master key.
struct KeyCacheEntry * next
Kept in a DLL.
struct KeyCacheEntry * prev
Kept in a DLL.
struct SharedSecret * ss
Corresponding shared secret.
Information we track per receiving address we have recently been in contact with (encryption to recei...
struct GNUNET_CONTAINER_HeapNode * hn
Entry in sender expiration heap.
struct GNUNET_TIME_Absolute rekey_timeout
Timeout for this receiver address.
int rekeying
Flag indicating sender is initiated rekeying for this receiver.
struct SharedSecret * ss_tail
Shared secrets we received with target, last used is tail.
int number_rekeying_kce
Number of kce we retain for sending the rekeying shared secret.
char * foreign_addr
Address of the receiver in the human-readable format with the COMMUNICATOR_ADDRESS_PREFIX.
unsigned int rekey_acks_available
Acks available when we started rekeying.
unsigned int acks_available
Number of BOX keys from ACKs we have currently available for this receiver.
struct SharedSecret * ss_rekey
Shared secret we use with target for rekeying.
struct SharedSecret * ss_head
Shared secrets we received from target, first used is head.
uint64_t rekey_send_bytes
Send bytes for this receiver address.
struct GNUNET_TRANSPORT_QueueHandle * kx_qh
handle for KX queue with the ch.
unsigned int num_secrets
Length of the DLL at ss_head.
struct GNUNET_TIME_Absolute timeout
Timeout for this receiver address.
size_t kx_mtu
MTU we allowed transport for this receiver's KX queue.
struct sockaddr * address
Address of the other peer.
struct GNUNET_PeerIdentity target
To whom are we talking to.
socklen_t address_len
Length of the address.
struct GNUNET_MQ_Handle * kx_mq
KX message queue we are providing for the ch.
int receiver_destroy_called
receiver_destroy already called on receiver.
size_t d_mtu
MTU we allowed transport for this receiver's default queue.
enum GNUNET_NetworkType nt
Which network type does this queue use?
struct GNUNET_MQ_Handle * d_mq
Default message queue we are providing for the ch.
struct GNUNET_TRANSPORT_QueueHandle * d_qh
handle for default queue with the ch.
Context information to be used while searching for operation contexts.
const struct sockaddr * address
Address we are looking for.
struct SenderAddress * sender
Return value to set if we found a match.
socklen_t address_len
Number of bytes in address.
Information we track per sender address we have recently been in contact with (we decrypt messages fr...
struct GNUNET_PeerIdentity target
To whom are we talking to.
struct GNUNET_CONTAINER_HeapNode * hn
Entry in sender expiration heap.
struct sockaddr * address
Address of the other peer.
socklen_t address_len
Length of the address.
enum GNUNET_NetworkType nt
Which network type does this queue use?
unsigned int acks_available
Number of BOX keys from ACKs we have currently available for this sender.
unsigned int num_secrets
Length of the DLL at ss_head.
struct GNUNET_TIME_Absolute timeout
Timeout for this sender.
int rekeying
Flag indicating sender is initiated rekeying for this receiver.
int kce_task_finished
Is the kce_task finished?
struct GNUNET_SCHEDULER_Task * kce_task_rekey
ID of kce rekey working queue task.
struct GNUNET_SCHEDULER_Task * kce_task
ID of kce working queue task.
struct SharedSecret * ss_head
Shared secrets we used with target, first used is head.
int sender_destroy_called
sender_destroy already called on sender.
struct SharedSecret * ss_rekey
Shared secret we use with target for rekeying.
struct SharedSecret * ss_tail
Shared secrets we used with target, last used is tail.
Shared secret we generated for a particular sender or receiver.
struct KeyCacheEntry * kce_tail
Kept in a DLL, sorted by sequence number.
uint32_t sequence_allowed
Up to which sequence number did the other peer allow us to use this key, or up to which number did we...
struct SharedSecret * next
Kept in a DLL.
unsigned int active_kce_count
Number of active KCN entries.
uint32_t sequence_used
Up to which sequence number did we use this master already? (for encrypting only)
struct SharedSecret * prev
Kept in a DLL.
struct SenderAddress * sender
Sender we use this shared secret with, or NULL.
struct KeyCacheEntry * kce_head
Kept in a DLL, sorted by sequence number.
struct GNUNET_HashCode cmac
CMAC is used to identify master in ACKs.
struct ReceiverAddress * receiver
Receiver we use this shared secret with, or NULL.
struct GNUNET_HashCode master
Master shared secret.
uint32_t sequence_max
Sequence acknowledgement limit.
struct GNUNET_HashCode cmac
CMAC of the base key being acknowledged.
uint32_t acks_available
Sequence acknowledgement limit.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_COMMUNICATOR_UDP_ACK.
int rekeying
A flag indicating, if the sender is doing rekeying.
char gcm_tag[(128/8)]
128-bit authentication tag for the following encrypted message, from GCM.
struct GNUNET_ShortHashCode kid
Key and IV identification code.
Broadcast by peer in LAN announcing its presence.
struct GNUNET_CRYPTO_EddsaSignature sender_sig
Sender's signature of type GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_UDP_BROADCAST.
struct GNUNET_PeerIdentity sender
Sender's peer identity.
Encrypted continuation of UDP initial handshake, followed by message header with payload.
struct GNUNET_PeerIdentity sender
Sender's identity.
struct GNUNET_CRYPTO_EddsaSignature sender_sig
Sender's signature of type GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_UDP_HANDSHAKE.
struct GNUNET_TIME_AbsoluteNBO monotonic_time
Monotonic time of sender, to possibly help detect replay attacks (if receiver persists times by sende...
struct GNUNET_PeerIdentity sender
Sender's identity.
struct GNUNET_ShortHashCode kid
Key and IV identification code.
char gcm_tag[(128/8)]
128-bit authentication tag for the following encrypted message, from GCM.
Signature we use to verify that the broadcast was really made by the peer that claims to have made it...
struct GNUNET_CRYPTO_EccSignaturePurpose purpose
Purpose must be GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_UDP_BROADCAST.
struct GNUNET_HashCode h_address
Hash of the sender's UDP address.
struct GNUNET_PeerIdentity sender
Identity of the inititor of the UDP broadcast.
Signature we use to verify that the ephemeral key was really chosen by the specified sender.
struct GNUNET_PeerIdentity receiver
Presumed identity of the target of the UDP connection (UDP server)
struct GNUNET_TIME_AbsoluteNBO monotonic_time
Monotonic time of sender, to possibly help detect replay attacks (if receiver persists times by sende...
struct GNUNET_CRYPTO_EcdhePublicKey ephemeral
Ephemeral key used by the sender.
struct GNUNET_CRYPTO_EccSignaturePurpose purpose
Purpose must be GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_UDP_HANDSHAKE.
struct GNUNET_PeerIdentity sender
Identity of the inititor of the UDP connection (UDP client).
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.