45#define LOG(kind, ...) GNUNET_log_from (kind, "communicator-tcp", __VA_ARGS__)
52#define NAT_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
58#define ADDRESS_VALIDITY_PERIOD \
59 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4)
69#define DEFAULT_MAX_QUEUE_LENGTH 8
75#define BUF_SIZE (2 * 64 * 1024 + sizeof(struct TCPBox))
80#define DEFAULT_REKEY_INTERVAL GNUNET_TIME_UNIT_DAYS
85#define PROTO_QUEUE_TIMEOUT GNUNET_TIME_UNIT_MINUTES
91#define REKEY_MAX_BYTES (1024LLU * 1024 * 400)
97#define INITIAL_KX_SIZE \
98 (sizeof(struct GNUNET_CRYPTO_EcdhePublicKey) \
99 + sizeof(struct TCPConfirmation))
104#define INITIAL_CORE_KX_SIZE \
105 (sizeof(struct EphemeralKeyMessage) \
106 + sizeof(struct PingMessage) \
107 + sizeof(struct PongMessage))
112#define COMMUNICATOR_ADDRESS_PREFIX "tcp"
117#define COMMUNICATOR_CONFIG_SECTION "communicator-tcp"
810 struct sockaddr *
addr;
948static unsigned char ikm[256 / 8];
966 key.eddsa_key = *edpk;
977 key.eddsa_key = *edpk;
996 if (NULL !=
queue->listen_sock)
1007 "Disconnecting queue for peer `%s'\n",
1009 if (NULL !=
queue->rekey_monotime_sc)
1012 queue->rekey_monotime_sc = NULL;
1014 if (NULL !=
queue->handshake_monotime_sc)
1017 queue->handshake_monotime_sc = NULL;
1019 if (NULL !=
queue->handshake_ack_monotime_sc)
1022 queue->handshake_ack_monotime_sc = NULL;
1024 if (NULL !=
queue->rekey_monotime_get)
1027 queue->rekey_monotime_get = NULL;
1029 if (NULL !=
queue->handshake_monotime_get)
1032 queue->handshake_monotime_get = NULL;
1034 if (NULL !=
queue->handshake_ack_monotime_get)
1037 queue->handshake_ack_monotime_get = NULL;
1039 if (NULL !=
queue->qh)
1051 if (NULL !=
queue->read_task)
1054 queue->read_task = NULL;
1056 if (NULL !=
queue->write_task)
1059 queue->write_task = NULL;
1064 "closing socket failed\n");
1066 gcry_cipher_close (
queue->in_cipher);
1067 gcry_cipher_close (
queue->out_cipher);
1069 if (0 !=
queue->backpressure)
1080 "add read net listen\n");
1133 memset (&fin, 0,
sizeof(fin));
1140 memcpy (
queue->pwrite_buf, &fin,
sizeof(fin));
1141 queue->pwrite_off =
sizeof(fin);
1172 "# messages lost in communicator API towards CORE",
1179 "backpressure %u\n",
1180 queue->backpressure);
1182 queue->backpressure--;
1184 if ((
queue->destroyed) && (0 ==
queue->backpressure))
1195 if (NULL ==
queue->read_task)
1217 const void *plaintext,
1218 size_t plaintext_len)
1224 "pass message from %s to core\n",
1227 if (ntohs (hdr->
size) != plaintext_len)
1241 "passed to core\n");
1243 queue->backpressure++;
1247 "# bytes lost due to CORE not running",
1265 gcry_cipher_hd_t *cipher,
1274 GCRY_CIPHER_MODE_CTR,
1280 "gnunet-communicator-tcp-key",
1282 "gnunet-communicator-tcp-key"),
1290 "gnunet-communicator-tcp-ctr",
1292 "gnunet-communicator-tcp-ctr"),
1295 gcry_cipher_setctr (*cipher, ctr,
sizeof(ctr));
1300 "gnunet-communicator-hmac",
1301 strlen (
"gnunet-communicator-hmac"),
1319 "Failed to store rekey monotonic time in PEERSTORE!\n");
1321 queue->rekey_monotime_sc = NULL;
1346 rekey_monotonic_time = &
queue->rekey_monotonic_time;
1350 queue->rekey_monotime_get = NULL;
1353 if (
sizeof(*mtbe) !=
record->value_size)
1365 "Queue from %s dropped, rekey monotime in the past\n",
1369 queue->rekey_monotime_get = NULL;
1375 "transport_tcp_communicator",
1378 rekey_monotonic_time,
1380 rekey_monotonic_time),
1439 "do_rekey size %u\n",
1468 &
queue->target.public_key))
1477 "transport_tcp_communicator",
1483 gcry_cipher_close (
queue->in_cipher);
1502 "Failed to store handshake ack monotonic time in PEERSTORE!\n");
1504 queue->handshake_ack_monotime_sc = NULL;
1529 handshake_ack_monotonic_time = &
queue->handshake_ack_monotonic_time;
1533 queue->handshake_ack_monotime_get = NULL;
1536 if (
sizeof(*mtbe) !=
record->value_size)
1548 "Queue from %s dropped, handshake ack monotime in the past\n",
1552 queue->handshake_ack_monotime_get = NULL;
1557 queue->handshake_ack_monotime_sc =
1559 "transport_tcp_communicator",
1562 handshake_ack_monotonic_time,
1563 sizeof(*handshake_ack_monotonic_time),
1585 "sending challenge\n");
1605 gcry_cipher_encrypt (
queue->out_cipher,
1610 queue->cwrite_off +=
sizeof(tca);
1612 "sending challenge done\n");
1627 queue->rekey_left_bytes =
1646 memset (&rekey, 0,
sizeof(rekey));
1656 "inject_rekey size %u\n",
1682 gcry_cipher_encrypt (
queue->out_cipher,
1687 queue->cwrite_off +=
sizeof(rekey);
1689 gcry_cipher_close (
queue->out_cipher);
1721 if (AF_INET == sa_family)
1725 struct sockaddr_in *natted_address;
1727 natted_address =
GNUNET_memdup (in,
sizeof (
struct sockaddr));
1728 natted_address->sin_port = 0;
1730 sizeof(
struct sockaddr),
1735 if (NULL != pending_reversal && (NULL == sender ||
1736 0 != memcmp (sender,
1737 &pending_reversal->
target,
1742 "Removing invalid pending reversal for `%s'at `%s'\n",
1802 "Sent %lu bytes to TCP queue\n", sent);
1803 if ((-1 == sent) && (EAGAIN != errno) && (EINTR != errno))
1811 size_t usent = (size_t) sent;
1840 queue->write_task = NULL;
1841 if (0 !=
queue->cwrite_off)
1847 "Sent %lu bytes to TCP queue\n", sent);
1848 if ((-1 == sent) && (EAGAIN != errno) && (EINTR != errno))
1856 size_t usent = (size_t) sent;
1857 queue->cwrite_off -= usent;
1858 memmove (
queue->cwrite_buf,
1859 &
queue->cwrite_buf[usent],
1869 unsigned int we_do_not_need_to_rekey = (0 <
queue->rekey_left_bytes
1870 - (
queue->cwrite_off
1873 if (we_do_not_need_to_rekey &&
1874 (
queue->pwrite_off > 0) &&
1878 "Encrypting %lu bytes\n",
queue->pwrite_off);
1880 gcry_cipher_encrypt (
queue->out_cipher,
1884 queue->pwrite_off));
1885 if (
queue->rekey_left_bytes >
queue->pwrite_off)
1886 queue->rekey_left_bytes -=
queue->pwrite_off;
1888 queue->rekey_left_bytes = 0;
1890 queue->pwrite_off = 0;
1893 if (((0 ==
queue->rekey_left_bytes) ||
1896 (((0 ==
queue->pwrite_off) || ! we_do_not_need_to_rekey) &&
1902 if ((0 ==
queue->pwrite_off) && (!
queue->finishing) &&
1912 "Finishing queue\n");
1917 if ((0 <
queue->cwrite_off) || (0 <
queue->pwrite_off))
1938 const struct TCPBox *box;
1950 "try handle plaintext!\n");
1953 if ((
sizeof(*hdr) >
queue->pread_off))
1956 "Handling plaintext, not even a header!\n");
1964 "Already received data of size %lu bigger than KX size %lu!\n",
1965 queue->unverified_size,
1978 "start processing ack\n");
1979 if (
sizeof(*tca) >
queue->pread_off)
1982 "Handling plaintext size of tca greater than pread offset.\n")
1986 if (ntohs (hdr->
size) !=
sizeof(*tca))
1989 "Handling plaintext size does not match message type.\n");
2010 "Verification of signature failed!\n");
2018 "Challenge in TCPConfirmationAck not correct!\n");
2026 "transport_tcp_communicator",
2033 "Handling plaintext, ack processed!\n");
2047 queue->address->sa_family, NULL);
2059 switch (
queue->address->sa_family)
2099 if (0 != memcmp (&tmac, &box->
hmac,
sizeof(tmac)))
2106 size = ntohs (hdr->
size) +
sizeof(*box);
2108 "Handling plaintext, box processed!\n");
2110 "# bytes decrypted with BOX",
2114 "# messages decrypted with BOX",
2121 if (
sizeof(*rekey) >
queue->pread_off)
2123 if (ntohs (hdr->
size) !=
sizeof(*rekey))
2130 memset (&rekeyz.
hmac, 0,
sizeof(rekeyz.
hmac));
2132 if (0 != memcmp (&tmac, &rekey->
hmac,
sizeof(tmac)))
2141 "Handling plaintext, rekey processed!\n");
2143 "# rekeying successful",
2150 if (
sizeof(*fin) >
queue->pread_off)
2152 if (ntohs (hdr->
size) !=
sizeof(*fin))
2159 memset (&finz.
hmac, 0,
sizeof(finz.
hmac));
2161 if (0 != memcmp (&tmac, &fin->
hmac,
sizeof(tmac)))
2170 "Handling plaintext, finish processed!\n");
2175 "Handling plaintext, nothing processed!\n");
2181 if (-1 !=
queue->unverified_size)
2199 queue->read_task = NULL;
2204 "Received %zd bytes from TCP queue\n", rcvd);
2207 if ((EAGAIN != errno) && (EINTR != errno))
2222 "Queue %p was idle for %s, disconnecting\n",
2234 "Socket for queue %p seems to have been closed\n",
queue);
2240 queue->cread_off += rcvd;
2241 while ((
queue->pread_off <
sizeof(
queue->pread_buf)) &&
2242 (
queue->cread_off > 0))
2248 size_t old_pread_off =
queue->pread_off;
2251 gcry_cipher_decrypt (
queue->in_cipher,
2265 memmove (
queue->pread_buf,
2266 &
queue->pread_buf[done],
2267 queue->pread_off - done);
2268 queue->pread_off -= done;
2283 max = total - old_pread_off;
2285 queue->pread_off = 0;
2304 "Queue %p was idle for %s, disconnecting\n",
2320static struct sockaddr *
2322 struct sockaddr_in6 v6,
2325 struct sockaddr *in;
2327 v6.sin6_family = AF_INET6;
2328 v6.sin6_port = htons ((uint16_t)
port);
2329#if HAVE_SOCKADDR_IN_SIN_LEN
2330 v6.sin6_len =
sizeof(
struct sockaddr_in6);
2332 v6.sin6_flowinfo = 0;
2333 v6.sin6_scope_id = 0;
2335 *sock_len =
sizeof(
struct sockaddr_in6);
2348static struct sockaddr *
2350 struct sockaddr_in v4,
2353 struct sockaddr *in;
2355 v4.sin_family = AF_INET;
2356 v4.sin_port = htons ((uint16_t)
port);
2357#if HAVE_SOCKADDR_IN_SIN_LEN
2358 v4.sin_len =
sizeof(
struct sockaddr_in);
2361 *sock_len =
sizeof(
struct sockaddr_in);
2376 struct sockaddr_in *i4;
2377 struct sockaddr_in6 *i6;
2378 socklen_t sock_len_ipv4;
2379 socklen_t sock_len_ipv6;
2382 if (*
port > UINT16_MAX)
2385 "BINDTO specification `%s' invalid: value too large for port\n",
2438 "extract address with bindto %s\n",
2443 "bindto is NULL\n");
2448 "extract address 2\n");
2451 if ((
'[' == *cp) && (
']' == cp[strlen (cp) - 1]))
2454 cp[strlen (cp) - 1] =
'\0';
2459 token = strtok_r (cp,
"]", &rest);
2460 if (strlen (bindto) == strlen (token))
2462 token = strtok_r (cp,
":", &rest);
2473 "tcp address: %s\n",
2497 if (NULL != addr_and_port)
2500 token = strtok_r (cp,
"]", &rest);
2501 if (strlen (addr_and_port) == strlen (token))
2503 colon = strrchr (cp,
':');
2514 token = strtok_r (NULL,
"]", &rest);
2528 if (1 == sscanf (addr,
"%u%1s", &
port,
dummy))
2531 if (
port > UINT16_MAX)
2534 "Port `%u' invalid: value too large for port\n",
2543 "BINDTO specification invalid: last ':' not followed by number\n");
2568static struct sockaddr *
2571 struct sockaddr *in;
2573 struct sockaddr_in v4;
2574 struct sockaddr_in6 v6;
2577 memset (&v4, 0,
sizeof(v4));
2589 if (1 == inet_pton (AF_INET,
start, &v4.sin_addr))
2599 else if (1 == inet_pton (AF_INET6,
start, &v6.sin6_addr))
2628 uint16_t msize = ntohs (
msg->
size);
2631 "In MQ send. Queue finishing: %s; write task running: %s\n",
2633 (NULL ==
queue->write_task) ?
"yes" :
"no");
2642 memcpy (&
queue->pwrite_buf[
queue->pwrite_off], &box,
sizeof(box));
2643 queue->pwrite_off +=
sizeof(box);
2645 queue->pwrite_off += msize;
2647 "%lu bytes of plaintext to send\n",
queue->pwrite_off);
2649 if (NULL ==
queue->write_task)
2691 queue->pwrite_off = 0;
2710 "MQ error in queue to %s: %d\n",
2767 memcpy (
queue->cwrite_buf, c,
sizeof(*c));
2768 queue->cwrite_off =
sizeof(*c);
2775 sizeof(
tc.challenge));
2788 gcry_cipher_encrypt (
queue->out_cipher,
2793 queue->challenge =
tc.challenge;
2794 queue->cwrite_off +=
sizeof(
tc);
2797 "handshake written\n");
2833 "Failed to store handshake monotonic time in PEERSTORE!\n");
2835 queue->handshake_monotime_sc = NULL;
2860 handshake_monotonic_time = &
queue->handshake_monotonic_time;
2863 "tcp handshake with us %s\n",
2867 queue->handshake_monotime_get = NULL;
2871 "tcp handshake from peer %s\n",
2873 if (
sizeof(*mtbe) !=
record->value_size)
2885 "Queue from %s dropped, handshake monotime in the past\n",
2889 queue->handshake_ack_monotime_get = NULL;
2894 "transport_tcp_communicator",
2897 handshake_monotonic_time,
2899 handshake_monotonic_time),
2929 gcry_cipher_decrypt (
queue->in_cipher,
2946 &
tc->sender.public_key);
2948 queue->handshake_monotime_get =
2950 "transport_tcp_communicator",
2974 queue->read_task = NULL;
2985 "Received %lu bytes to write in buffer of size %lu for KX from queue %p (expires in %"
2990 if ((EAGAIN != errno) && (EINTR != errno))
3004 "Socket for queue %p seems to have been closed\n",
queue);
3008 queue->cread_off += rcvd;
3013 "%lu/%lu bytes of KX read. Rescheduling...\n",
3027 "Invalid TCP KX received from %s\n",
3036 "Invalid sender in TCP KX received from %s\n",
3052 memmove (
queue->cread_buf,
3056 "cread_off is %lu bytes before adjusting\n",
3060 "cread_off set to %lu bytes\n",
3093 "Proto received %lu bytes for KX\n", rcvd);
3096 if ((EAGAIN != errno) && (EINTR != errno))
3111 "Socket for proto queue %p seems to have been closed\n", pq);
3121 &
pm->clientIdentity);
3124 queue->target =
pm->clientIdentity;
3147 "Invalid TCP KX received from %s\n",
3149 gcry_cipher_close (
queue->in_cipher);
3165 "created queue with target %s\n",
3169 "start kx proto\n");
3185 queue->challenge_received =
tc.challenge;
3194 struct sockaddr *in,
3206 "socket(%d) failed: %s",
3214 (errno != EINPROGRESS))
3217 "connect to `%s' failed: %s",
3250 struct sockaddr_storage in;
3254 struct sockaddr *in_addr;
3263 addrlen =
sizeof(in);
3264 memset (&in, 0,
sizeof(in));
3266 (
struct sockaddr*) &in,
3268 if ((NULL == sock) && ((EMFILE == errno) || (ENFILE == errno)))
3274 if ((NULL == sock) && ((EAGAIN == errno) || (ENOBUFS == errno)))
3288 const struct sockaddr *addr,
3293 struct sockaddr *in_addr;
3297 "addr->sa_family %d\n",
3300 "Try to connect back\n");
3303 "in_addr->sa_family %d\n",
3304 in_addr->sa_family);
3321 "Couldn't create ProtoQueue for sending TCPNATProbeMessage\n");
3329 struct sockaddr *in = cls;
3334 sizeof(
struct sockaddr),
3345 "No pending reversal found for address %s\n",
3373 struct sockaddr *in;
3374 socklen_t in_len = 0;
3376 struct sockaddr_in *v4;
3377 struct sockaddr_in6 *v6;
3385 "Connecting to %s at %s\n",
3401 "Failed to setup TCP socket address\n");
3418 "Queue for %s already exists or is in construction\n",
address);
3422 switch (in->sa_family)
3425 v4 = (
struct sockaddr_in *) in;
3426 if (0 == v4->sin_port)
3430 sizeof(
struct sockaddr),
3437 "There is already a request reversal for `%s'at `%s'\n",
3450 "IPv6 disabled, skipping %s\n",
address);
3454 v6 = (
struct sockaddr_in6 *) in;
3455 if (0 == v6->sin6_port)
3458 "Request reversal for `%s' at `%s' not possible for an IPv6 address\n",
3472 struct sockaddr_in local_sa;
3475 memset (&local_sa, 0,
sizeof(local_sa));
3476 local_sa.sin_family = AF_INET;
3484 "request reversal for `%s' at `%s' failed\n",
3491 pending_reversal->
in =
in;
3497 pending_reversal->
target = *peer;
3503 "Created NAT WAIT connection to `%s' at `%s'\n",
3516 "socket(%d) failed: %s",
3523 (errno != EINPROGRESS))
3526 "connect to `%s' failed: %s",
3535 queue->target = *peer;
3537 queue->key = queue_map_key;
3538 queue->address = in;
3539 queue->address_len = in_len;
3544 "booted queue with target %s\n",
3555 "start kx mq_init\n");
3691 "Shutdown done!\n");
3736 const struct sockaddr *addr,
3743 "nat address cb %s %s\n",
3744 add_remove ?
"add" :
"remove",
3792 "after add address %s\n",
3830 "PILS service is lacking initial secret key file configuration setting. Exiting\n");
3848 "PILS service cannot create dir for saving initial secret key file. Exiting\n");
3862 if (NULL == filehandle)
3865 "PILS service had an issue with opening the initial secret key file. Exiting\n");
3876 "PILS service had an issue with writing the initial secret key to file. Exiting\n")
3886 "PILS is going to read initial secret key from file %s\n",
3891 if (NULL == filehandle)
3894 " Not able to open file\n");
3900 " File has the wrong size %lu\n",
3908 " Something is wrong with the file size, expected: %lu size, got: %lu\n",
3921 " Read initial secret key with wrong size %u, expected %lu\n",
ret,
3942 struct sockaddr_storage in_sto;
3952 "Address is NULL.\n");
3962 if (NULL == listen_sock)
3989 sto_len =
sizeof(in_sto);
3992 (
struct sockaddr *) &in_sto,
3995 memcpy (&in_sto, addr, in_len);
4003 GNUNET_a2s ((
const struct sockaddr *) &in_sto, sto_len));
4033 "creating map entry\n");
4041 "map entry created\n");
4078 struct sockaddr **saddrs;
4079 socklen_t *saddr_lens;
4084 "starting nat register!\n");
4092 "registering address %s\n",
4095 saddr_lens[i] = pos->addr_len;
4096 len += saddr_lens[i];
4102 "registering addresses %lu %lu %lu %lu\n",
4111 (
const struct sockaddr **) saddrs,
4140 const struct sockaddr *addr,
4143 struct sockaddr_in *v4;
4144 struct sockaddr_in6 *v6;
4145 struct sockaddr *in;
4150 if (AF_INET == addr->sa_family)
4152 v4 = (
struct sockaddr_in *) addr;
4155 else if (AF_INET6 == addr->sa_family)
4157 v6 = (
struct sockaddr_in6 *) addr;
4163 "Address family %u not suitable (not AF_INET %u nor AF_INET6 %u \n",
4174 "Address is NULL. This might be an error or the resolver finished resolving.\n");
4178 "Resolver finished resolving, but we do not listen to an address!.\n");
4192 "Got PID to derive from `%s':\n",
4219 const char *cfgfile,
4223 struct sockaddr *in;
4225 struct sockaddr_in v4;
4226 struct sockaddr_in6 v6;
4238 memset (&v4,0,
sizeof(
struct sockaddr_in));
4239 memset (&v6,0,
sizeof(
struct sockaddr_in6));
4323 if (1 == inet_pton (AF_INET,
start, &v4.sin_addr))
4335 if (1 == inet_pton (AF_INET6,
start, &v6.sin6_addr))
4376 "Starting tcp communicator\n");
4382 "gnunet-communicator-tcp",
4383 _ (
"GNUnet TCP communicator"),
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
struct GNUNET_GETOPT_CommandLineOption options[]
struct GNUNET_MQ_Handle * mq
struct GNUNET_MessageHeader * msg
static int start
Set if we are to start default services (including ARM).
static int ret
Final status code.
static uint16_t port
Port number.
void pid_change_cb(void *cls, const struct GNUNET_HELLO_Parser *parser, const struct GNUNET_HashCode *addr_hash)
static void calculate_hmac(struct GNUNET_HashCode *hmac_secret, const void *buf, size_t buf_size, struct GNUNET_ShortHashCode *smac)
Compute mac over buf, and ratched the hmac_secret.
static void queue_finish(struct Queue *queue)
Append a 'finish' message to the outgoing transmission.
static void transmit_kx(struct Queue *queue, const struct GNUNET_CRYPTO_HpkeEncapsulation *c)
Generate and transmit our ephemeral key and the signature for the initial KX with the other peer.
static void boot_queue(struct Queue *queue)
Add the given queue to our internal data structure.
static unsigned int bind_port
The port the communicator should be assigned to.
static size_t try_handle_plaintext(struct Queue *queue)
Test if we have received a full message in plaintext.
static void pass_plaintext_to_core(struct Queue *queue, const void *plaintext, size_t plaintext_len)
We received plaintext_len bytes of plaintext on queue.
static struct sockaddr * tcp_address_to_sockaddr_numeric_v6(socklen_t *sock_len, struct sockaddr_in6 v6, unsigned int port)
Convert a struct sockaddr_in6 to astruct sockaddr *`.
static struct GNUNET_PeerIdentity my_identity
Our public key.
#define COMMUNICATOR_ADDRESS_PREFIX
Address prefix used by the communicator.
static unsigned char ikm[256/8]
The initial key material for the peer.
static void mq_destroy(struct GNUNET_MQ_Handle *mq, void *impl_state)
Signature of functions implementing the destruction of a message queue.
#define ADDRESS_VALIDITY_PERIOD
How long do we believe our addresses to remain up (before the other peer should revalidate).
static struct PortOnlyIpv4Ipv6 * tcp_address_to_sockaddr_port_only(const char *bindto, unsigned int *port)
Convert TCP bind specification to a struct PortOnlyIpv4Ipv6 *
static void setup_in_cipher(const struct GNUNET_CRYPTO_HpkeEncapsulation *ephemeral, struct Queue *queue)
Setup cipher of queue for decryption.
#define INITIAL_CORE_KX_SIZE
Size of the initial core key exchange messages.
static void do_rekey(struct Queue *queue, const struct TCPRekey *rekey)
Handle rekey message on queue.
static void eddsa_priv_to_hpke_key(struct GNUNET_CRYPTO_EddsaPrivateKey *edpk, struct GNUNET_CRYPTO_EcdhePrivateKey *pk)
static struct ProtoQueue * create_proto_queue(struct GNUNET_NETWORK_Handle *sock, struct sockaddr *in, socklen_t addrlen)
static int init_socket(struct sockaddr *addr, socklen_t in_len)
This method launch network interactions for each address we like to bind to.
static void try_connection_reversal(void *cls, const struct sockaddr *addr, socklen_t addrlen)
static struct GNUNET_NT_InterfaceScanner * is
Network scanner to determine network types.
static void listen_cb(void *cls)
We have been notified that our listen socket has something to read.
static void rekey_monotime_cb(void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg)
Callback called by peerstore when records for GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_REKEY where...
static int disable_v6
IPv6 disabled.
static struct GNUNET_CONTAINER_MultiHashMap * pending_reversals
Map of pending reversals.
static struct GNUNET_STATISTICS_Handle * stats
For logging statistics.
static void queue_destroy(struct Queue *queue)
Functions with this signature are called whenever we need to close a queue due to a disconnect or fai...
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 an acknowledgement for this communicator (!...
static void handshake_ack_monotime_store_cb(void *cls, int success)
Callback called when peerstore store operation for handshake ack monotime value is finished.
static struct GNUNET_PEERSTORE_Handle * peerstore
Database for peer's HELLOs.
static int pending_reversals_delete_it(void *cls, const struct GNUNET_HashCode *key, void *value)
static struct ProtoQueue * proto_tail
Protoqueues DLL tail.
static void queue_read_kx(void *cls)
Read from the socket of the queue until we have enough data to initialize the decryption logic and ca...
static int get_lt_delete_it(void *cls, const struct GNUNET_HashCode *key, void *value)
Iterator over all ListenTasks to clean up.
static void inject_rekey(struct Queue *queue)
Inject a struct TCPRekey message into the queue's plaintext buffer.
static struct GNUNET_TIME_Relative rekey_interval
The rekey interval.
#define NAT_TIMEOUT
How long until we give up on establishing an NAT connection? Must be > 4 RTT.
#define BUF_SIZE
Size of our IO buffers for ciphertext data.
static void do_shutdown(void *cls)
Shutdown the UNIX communicator.
#define COMMUNICATOR_CONFIG_SECTION
Configuration section used by the communicator.
static struct GNUNET_CONTAINER_MultiHashMap * queue_map
Queues (map from peer identity to struct Queue)
static void proto_read_kx(void *cls)
Read from the socket of the proto queue until we have enough data to upgrade to full queue.
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 sockaddr * tcp_address_to_sockaddr_numeric_v4(socklen_t *sock_len, struct sockaddr_in v4, unsigned int port)
Convert a struct sockaddr_in4 to astruct sockaddr *`.
static void check_and_remove_pending_reversal(struct sockaddr *in, sa_family_t sa_family, struct GNUNET_PeerIdentity *sender)
static void init_socket_resolv(void *cls, const struct sockaddr *addr, socklen_t in_len)
This method is the callback called by the resolver API, and wraps method init_socket.
static struct GNUNET_TRANSPORT_CommunicatorHandle * ch
Our environment.
static unsigned long long max_queue_length
Maximum queue length before we stop reading towards the transport service.
static void setup_cipher(const struct GNUNET_ShortHashCode *prk, const struct GNUNET_PeerIdentity *pid, gcry_cipher_hd_t *cipher, struct GNUNET_HashCode *hmac_key)
Setup cipher based on shared secret dh and decrypting peer pid.
struct GNUNET_RESOLVER_RequestHandle * resolve_request_handle
Handle for DNS lookup of bindto address.
static void nat_register()
This method reads from the DLL addrs_head to register them at the NAT service.
static void setup_out_cipher(struct Queue *queue, struct GNUNET_ShortHashCode *dh)
Setup cipher for outgoing data stream based on target and our ephemeral private key.
static int addrs_lens
Number of addresses in the DLL for register at NAT service.
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
Setup communicator and launch network interactions.
static struct GNUNET_NAT_Handle * nat
Connection to NAT service.
static void pending_reversal_timeout(void *cls)
#define PROTO_QUEUE_TIMEOUT
How long do we wait until we must have received the initial KX?
static void queue_read(void *cls)
Queue read task.
#define REKEY_MAX_BYTES
How often do we rekey based on number of bytes transmitted? (additionally randomized).
static int get_queue_delete_it(void *cls, const struct GNUNET_HashCode *target, void *value)
Iterator over all message queues to clean up.
static void mq_cancel(struct GNUNET_MQ_Handle *mq, void *impl_state)
Implementation function that cancels the currently sent message.
#define INITIAL_KX_SIZE
Size of the initial key exchange message sent first in both directions.
static void handshake_ack_monotime_cb(void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg)
Callback called by peerstore when records for GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE_A...
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 proto_queue_write(void *cls)
We have been notified that our socket is ready to write.
static void handshake_monotime_store_cb(void *cls, int success)
Callback called when peerstore store operation for handshake monotime is finished.
static void send_challenge(struct GNUNET_CRYPTO_ChallengeNonceP challenge, struct Queue *queue)
Sending challenge with TcpConfirmationAck back to sender of ephemeral key.
static void rekey_monotime_store_cb(void *cls, int success)
Callback called when peerstore store operation for rekey monotime value is finished.
static char * extract_address(const char *bindto)
This Method extracts the address part of the BINDTO string.
static struct ProtoQueue * proto_head
Protoqueues DLL head.
static int shutdown_running
A flag indicating we are already doing a shutdown.
static enum GNUNET_GenericReturnValue load_ikm()
FIXME: We could alternatively ask PILS for de/encaps, but at a high cost wrt async RPC calls....
static int decrypt_and_check_tc(struct Queue *queue, struct TCPConfirmation *tc, char *ibuf)
We have received the first bytes from the other side on a queue.
#define DEFAULT_REKEY_INTERVAL
How often do we rekey based on time (at least)
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.
static void queue_write(void *cls)
We have been notified that our socket is ready to write.
static void add_addr(struct sockaddr *in, socklen_t in_len)
This method adds addresses to the DLL, that are later register at the NAT service.
static void handshake_monotime_cb(void *cls, const struct GNUNET_PEERSTORE_Record *record, const char *emsg)
Callback called by peerstore when records for GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE w...
static struct Addresses * addrs_head
Head of DLL with addresses we like to register at NAT service.
static struct sockaddr * tcp_address_to_sockaddr(const char *bindto, socklen_t *sock_len)
Convert TCP bind specification to a struct sockaddr *
static void eddsa_pub_to_hpke_key(struct GNUNET_CRYPTO_EddsaPublicKey *edpk, struct GNUNET_CRYPTO_EcdhePublicKey *pk)
static struct Addresses * addrs_tail
Head of DLL with addresses we like to register at NAT service.
static void setup_in_cipher_elligator(const struct GNUNET_CRYPTO_HpkeEncapsulation *c, struct Queue *queue)
Setup cipher of queue for decryption from an elligator representative.
#define DEFAULT_MAX_QUEUE_LENGTH
How many messages do we keep at most in the queue to the transport service before we start to drop (d...
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 unsigned int extract_port(const char *addr_and_port)
This Method extracts the port part of the BINDTO string.
static struct GNUNET_CRYPTO_EcdhePrivateKey my_x25519_private_key
Our private key.
static void mq_send(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 struct GNUNET_PILS_Handle * pils
For PILS.
static void start_initial_kx_out(struct Queue *queue)
Initialize our key material for outgoing transmissions and inform the other peer about it.
static void free_proto_queue(struct ProtoQueue *pq)
Closes socket and frees memory associated with pq.
static struct GNUNET_CONTAINER_MultiHashMap * lt_map
ListenTasks (map from socket to struct ListenTask)
static unsigned long long rekey_max_bytes
The rekey byte maximum.
static void core_read_finished_cb(void *cls, int success)
Core tells us it is done processing a message that transport received on a queue with status success.
static struct GNUNET_TRANSPORT_AddressIdentifier * ai
Handle to the operation that publishes our address.
static void record(void *cls, size_t data_size, const void *data)
Process recorded audio data.
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.
struct GNUNET_CRYPTO_PrivateKey pk
Private key from command line option, or NULL.
struct GNUNET_SCHEDULER_Task * read_task
static char * value
Value of the record to add/remove.
static uint32_t type
Type string converted to DNS type value.
static struct GNUNET_NAT_AUTO_Test * nt
Handle to a NAT test operation.
static struct GNUNET_PeerIdentity pid
Identity of the peer we transmit to / connect to.
static struct GNUNET_TRANSPORT_PluginMonitor * pm
Handle if we are monitoring plugin session activity.
static void queue(const char *hostname)
Add hostname to the list of requests to be made.
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
Core service; the main API for encrypted P2P communications.
API to the peerstore service.
struct GNUNET_PILS_Handle * GNUNET_PILS_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_PILS_PidChangeCallback pid_change_cb, void *cls)
Connect to the PILS service.
void GNUNET_PILS_disconnect(struct GNUNET_PILS_Handle *handle)
Disconnect from the PILS service.
void GNUNET_PILS_derive_pid(size_t seed_key_bytes, const uint8_t seed_key[seed_key_bytes], const struct GNUNET_HashCode *addrs_hash, struct GNUNET_CRYPTO_EddsaPrivateKey *outkey)
Generate the peer id from the addresses hash and the initial secret key.
Constants for network protocols.
Functions related to doing DNS lookups.
#define GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_HANDSHAKE_ACK
Signature by a peer sending back the nonce received at initial handshake.
#define GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_REKEY
Signature used by TCP communicator rekey.
#define GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_HANDSHAKE
Signature used by TCP communicator handshake.
API to create, modify and access statistics.
API of the transport service towards the communicator processes.
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.
#define GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED
Queue length.
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...
void GNUNET_TRANSPORT_communicator_disconnect(struct GNUNET_TRANSPORT_CommunicatorHandle *ch)
Disconnect from the transport service.
GNUNET_TRANSPORT_ConnectionStatus
Possible states of a connection.
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, GNUNET_TRANSPORT_StartBurstNotify sb)
Connect to the transport service.
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_communicator_address_remove_all(struct GNUNET_TRANSPORT_CommunicatorHandle *ch)
Notify transport service that this communicator no longer provides all its addresses for this peer.
@ GNUNET_TRANSPORT_CC_RELIABLE
Transmission is reliabile (with ACKs), e.g.
@ GNUNET_TRANSPORT_CS_INBOUND
this is an inbound connection (communicator initiated)
@ GNUNET_TRANSPORT_CS_OUTBOUND
this is an outbound connection (transport initiated)
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
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?
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_kem_decaps(const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, const struct GNUNET_CRYPTO_HpkeEncapsulation *c, struct GNUNET_ShortHashCode *prk)
Decapsulate a key for a private EdDSA key.
uint64_t GNUNET_CRYPTO_random_u64(enum GNUNET_CRYPTO_Quality mode, uint64_t max)
Generate a random unsigned 64-bit value.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_elligator_kem_decaps(const struct GNUNET_CRYPTO_EcdhePrivateKey *skR, const struct GNUNET_CRYPTO_HpkeEncapsulation *c, struct GNUNET_ShortHashCode *shared_secret)
Carries out ecdh decapsulation with own private key and the representative of the received public key...
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_hpke_elligator_kem_encaps(const struct GNUNET_CRYPTO_EcdhePublicKey *pkR, struct GNUNET_CRYPTO_HpkeEncapsulation *c, struct GNUNET_ShortHashCode *shared_secret)
Carries out ecdh encapsulation with given public key and the private key from a freshly created ephem...
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_eddsa_kem_encaps(const struct GNUNET_CRYPTO_EddsaPublicKey *pub, struct GNUNET_CRYPTO_HpkeEncapsulation *c, struct GNUNET_ShortHashCode *prk)
Encapsulate key material for a EdDSA public 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.
@ GNUNET_CRYPTO_QUALITY_WEAK
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
@ GNUNET_CRYPTO_QUALITY_NONCE
Randomness for IVs etc.
struct GNUNET_DISK_FileHandle * GNUNET_DISK_file_open(const char *fn, enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm)
Open a file.
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
enum GNUNET_GenericReturnValue GNUNET_DISK_file_test_read(const char *fil)
Check that fil corresponds to a filename and the file has read permissions.
enum GNUNET_GenericReturnValue GNUNET_DISK_file_close(struct GNUNET_DISK_FileHandle *h)
Close an open file.
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_create_for_file(const char *filename)
Create the directory structure for storing a file.
ssize_t GNUNET_DISK_file_read(const struct GNUNET_DISK_FileHandle *h, void *result, size_t len)
Read the contents of a binary file into a buffer.
enum GNUNET_GenericReturnValue GNUNET_DISK_file_handle_size(struct GNUNET_DISK_FileHandle *fh, off_t *size)
Get the size of an open file.
@ GNUNET_DISK_OPEN_READ
Open the file for reading.
@ GNUNET_DISK_OPEN_WRITE
Open the file for writing.
@ GNUNET_DISK_OPEN_CREATE
Create file if it doesn't exist.
@ GNUNET_DISK_PERM_USER_READ
Owner can read.
@ GNUNET_DISK_PERM_NONE
Nobody is allowed to do anything to the file.
@ GNUNET_DISK_PERM_USER_WRITE
Owner can write.
#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_expand(void *result, size_t out_len, const struct GNUNET_ShortHashCode *prk,...)
HKDF-Expand using SHA256.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_contains(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Check if the map contains any value under the given key (including values that are NULL).
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
void * GNUNET_CONTAINER_multihashmap_get(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Given a key find a value in the map matching the key.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_remove(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
Remove the given key-value pair from the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
unsigned int GNUNET_CONTAINER_multihashmap_size(const struct GNUNET_CONTAINER_MultiHashMap *map)
Get the number of key-value pairs in the map.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
Allow multiple values with the same key.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY
There must only be one value per key; storing a value should fail if a value under the same key alrea...
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32.
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
#define GNUNET_log(kind,...)
void GNUNET_CRYPTO_hash_context_read(struct GNUNET_HashContext *hc, const void *buf, size_t size)
Add data to be hashed.
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won't work on W32;.
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
void GNUNET_CRYPTO_hash_context_finish(struct GNUNET_HashContext *hc, struct GNUNET_HashCode *r_hash)
Finish the hash computation.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_sk_to_x25519(const struct GNUNET_CRYPTO_PrivateKey *sk, struct GNUNET_CRYPTO_EcdhePrivateKey *x25519)
Convert a GNUnet identity key to a key sutiable for HPKE (X25519)
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_hpke_pk_to_x25519(const struct GNUNET_CRYPTO_PublicKey *pk, struct GNUNET_CRYPTO_EcdhePublicKey *x25519)
Convert a GNUnet identity key to a key sutiable for HPKE (X25519)
GNUNET_GenericReturnValue
Named constants for return values.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
struct GNUNET_HashContext * GNUNET_CRYPTO_hash_context_start(void)
Start incremental hashing operation.
void GNUNET_CRYPTO_hmac_raw(const void *key, size_t key_len, const void *plaintext, size_t plaintext_len, struct GNUNET_HashCode *hmac)
Calculate HMAC of a message (RFC 2104) TODO: Shouldn't this be the standard hmac function and the abo...
@ GNUNET_PUBLIC_KEY_TYPE_EDDSA
EDDSA identity.
#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).
const char * GNUNET_e2s(const struct GNUNET_CRYPTO_EcdhePublicKey *p)
Convert a public key value to a string (for printing debug messages).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#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).
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).
void GNUNET_log_config_missing(enum GNUNET_ErrorType kind, const char *section, const char *option)
Log error message about missing configuration option.
#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...
const char * GNUNET_p2s(const struct GNUNET_CRYPTO_EddsaPublicKey *p)
Convert a public key value to a string (for printing debug messages).
@ 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_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.
int GNUNET_NAT_request_reversal(struct GNUNET_NAT_Handle *nh, const struct sockaddr_in *local_sa, const struct sockaddr_in *remote_sa)
We learned about a peer (possibly behind NAT) so run the gnunet-nat-client to send dummy ICMP respons...
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...
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_NETWORK_Handle * GNUNET_NETWORK_socket_accept(const struct GNUNET_NETWORK_Handle *desc, struct sockaddr *address, socklen_t *address_len)
Accept a new connection on a socket.
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_recv(const struct GNUNET_NETWORK_Handle *desc, void *buffer, size_t length)
Read data from a connected 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_socket_connect(const struct GNUNET_NETWORK_Handle *desc, const struct sockaddr *address, socklen_t address_len)
Connect a socket to some remote address.
ssize_t GNUNET_NETWORK_socket_send(const struct GNUNET_NETWORK_Handle *desc, const void *buffer, size_t length)
Send data (always non-blocking).
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.
enum GNUNET_GenericReturnValue GNUNET_NETWORK_socket_listen(const struct GNUNET_NETWORK_Handle *desc, int backlog)
Listen on a socket.
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.
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_gnunet(void)
Return default project data used by 'libgnunetutil' for GNUnet.
struct GNUNET_PEERSTORE_IterateContext * GNUNET_PEERSTORE_iteration_start(struct GNUNET_PEERSTORE_Handle *h, const char *sub_system, const struct GNUNET_PeerIdentity *peer, const char *key, GNUNET_PEERSTORE_Processor callback, void *callback_cls)
Iterate over peerstore entries.
void GNUNET_PEERSTORE_iteration_next(struct GNUNET_PEERSTORE_IterateContext *ic, uint64_t limit)
Continue an iteration.
void GNUNET_PEERSTORE_store_cancel(struct GNUNET_PEERSTORE_StoreContext *sc)
Cancel a store request.
void GNUNET_PEERSTORE_disconnect(struct GNUNET_PEERSTORE_Handle *h)
Disconnect from the PEERSTORE service.
struct GNUNET_PEERSTORE_Handle * GNUNET_PEERSTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the PEERSTORE service.
#define GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE
Key used to store sender's monotonic time from handshake message.
struct GNUNET_PEERSTORE_StoreContext * GNUNET_PEERSTORE_store(struct GNUNET_PEERSTORE_Handle *h, const char *sub_system, const struct GNUNET_PeerIdentity *peer, const char *key, const void *value, size_t size, struct GNUNET_TIME_Absolute expiry, enum GNUNET_PEERSTORE_StoreOption options, GNUNET_PEERSTORE_Continuation cont, void *cont_cls)
Store a new entry in the PEERSTORE.
#define GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE_ACK
Key used to store sender's monotonic time from handshake ack message.
#define GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_REKEY
Key used to store sender's monotonic time from rekey message.
void GNUNET_PEERSTORE_iteration_stop(struct GNUNET_PEERSTORE_IterateContext *ic)
Cancel an iteration.
@ GNUNET_PEERSTORE_STOREOPTION_REPLACE
Delete any previous values for the given key before storing the given value.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(const struct GNUNET_OS_ProjectData *pd, 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_TCP_CONFIRMATION_ACK
TCP communicator confirmation ack.
#define GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_NAT_PROBE
TCP NAT probe message, send from NAT'd peer to other peer to establish bi-directional communication.
#define GNUNET_MESSAGE_TYPE_COMMUNICATOR_TCP_FINISH
TCP communicator end of stream.
#define GNUNET_MESSAGE_TYPE_COMMUNICATOR_TCP_BOX
TCP communicator payload box.
#define GNUNET_MESSAGE_TYPE_COMMUNICATOR_TCP_REKEY
TCP communicator rekey message.
struct GNUNET_RESOLVER_RequestHandle * GNUNET_RESOLVER_ip_get(const char *hostname, int af, struct GNUNET_TIME_Relative timeout, GNUNET_RESOLVER_AddressCallback callback, void *callback_cls)
Convert a string to one or more IP addresses.
void GNUNET_RESOLVER_request_cancel(struct GNUNET_RESOLVER_RequestHandle *rh)
Cancel a request that is still pending with the resolver.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
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_write_net(struct GNUNET_TIME_Relative delay, struct GNUNET_NETWORK_Handle *wfd, 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_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
void(* GNUNET_SCHEDULER_TaskCallback)(void *cls)
Signature of the main function of a task.
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).
#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?
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
#define GNUNET_TIME_UNIT_MINUTES
One minute.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_ntoh(struct GNUNET_TIME_AbsoluteNBO a)
Convert absolute time from network byte order.
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.
const char * GNUNET_STRINGS_absolute_time_to_string(struct GNUNET_TIME_Absolute t)
Like asctime, except for GNUnet time.
#define GNUNET_TIME_UNIT_FOREVER_ABS
Constant used to specify "forever".
static unsigned int size
Size of the "table".
static struct GNUNET_SCHEDULER_TaskContext tc
Task context of the current task.
DLL to store the addresses we like to register at NAT service.
struct Addresses * next
Kept in a DLL.
struct Addresses * prev
Kept in a DLL.
struct sockaddr * addr
Address we like to register at NAT service.
socklen_t addr_len
Length of address we like to register at NAT service.
Internal representation of the hash map.
Type of a nonce used for challenges.
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.
Public ECC key (always for curve Ed25519) encoded in a format suitable for network transmission and E...
an ECC signature using EdDSA.
HPKE DHKEM encapsulation (X25519) See RFC 9180.
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
Handle used to access files (and pipes).
Definition of a command line option.
Context for parsing HELLOs.
Handle to a message queue.
Handle for active NAT registrations.
Handle to the interface scanner.
Handle to the PEERSTORE service.
Context for a iterate request.
Context for a store request.
A handle for the PILS service.
The identity of the host (wraps the signing key of the peer).
struct GNUNET_CRYPTO_EddsaPublicKey public_key
Handle to a request given to the resolver.
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...
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...
Struct to use as closure.
struct GNUNET_NETWORK_Handle * listen_sock
Listen socket.
struct GNUNET_SCHEDULER_Task * listen_task
ID of listen task.
Struct for pending nat reversals.
struct sockaddr * in
Address the reversal was send to.
struct GNUNET_SCHEDULER_Task * timeout_task
struct GNUNET_PeerIdentity target
To whom are we like to talk to.
In case of port only configuration we like to bind to ipv4 and ipv6 addresses.
struct sockaddr * addr_ipv4
Ipv4 address we like to bind to.
struct sockaddr * addr_ipv6
Ipv6 address we like to bind to.
socklen_t addr_len_ipv6
Length of ipv6 address.
socklen_t addr_len_ipv4
Length of ipv4 address.
Handle for an incoming connection where we do not yet have enough information to setup a full queue.
socklen_t address_len
Length of the address.
struct GNUNET_SCHEDULER_Task * write_task
ID of write task for this connection.
char write_buf[sizeof(struct TCPNATProbeMessage)]
buffer for writing struct TCPNATProbeMessage to network.
struct GNUNET_NETWORK_Handle * listen_sock
Listen socket.
size_t ibuf_off
Current offset for reading into ibuf.
struct GNUNET_TIME_Absolute timeout
Timeout for this protoqueue.
struct GNUNET_NETWORK_Handle * sock
socket that we transmit all data with on this queue
struct sockaddr * address
Address of the other peer.
struct ProtoQueue * prev
Kept in a DLL.
char ibuf[(sizeof(struct GNUNET_CRYPTO_EcdhePublicKey)+sizeof(struct TCPConfirmation))]
Buffer for reading all the information we need to upgrade from protoqueue to queue.
size_t write_off
Offset of the buffer?
struct GNUNET_SCHEDULER_Task * read_task
ID of read task for this connection.
struct ProtoQueue * next
Kept in a DLL.
struct GNUNET_CRYPTO_EcdhePublicKey target_hpke_key
To whom are we talking to.
unsigned int backpressure
How may messages did we pass from this queue to CORE for which we have yet to receive an acknowledgem...
struct GNUNET_NETWORK_Handle * sock
socket that we transmit all data with on this queue
struct GNUNET_PEERSTORE_IterateContext * handshake_ack_monotime_get
Iteration Context for retrieving the monotonic time send with the handshake ack.
int rekeyed
GNUNET_YES if we just rekeyed and must thus possibly re-decrypt ciphertext.
struct GNUNET_CRYPTO_ChallengeNonceP challenge
Challenge value used to protect against replay attack, if there is no stored monotonic time value.
size_t unverified_size
Size of data received without KX challenge played back.
struct GNUNET_TRANSPORT_QueueHandle * qh
handle for this queue with the ch.
struct GNUNET_HashCode out_hmac
Shared secret for HMAC generation on outgoing data, ratcheted after each operation.
int finishing
Did we enqueue a finish message and are closing down the queue?
int initial_core_kx_done
Has the initial (core) handshake already happened?
struct GNUNET_HashCode key
Key in hash map.
socklen_t address_len
Length of the address.
struct GNUNET_MQ_Handle * mq
Message queue we are providing for the ch.
unsigned long long bytes_in_queue
Number of bytes we currently have in our write queue.
char pread_buf[UINT16_MAX+1+sizeof(struct TCPBox)]
Plaintext buffer for decrypted plaintext.
int destroyed
Did we technically destroy this queue, but kept the allocation around because of backpressure not bei...
struct GNUNET_PEERSTORE_StoreContext * rekey_monotime_sc
Store Context for retrieving the monotonic time send with key for rekeying.
size_t cwrite_off
At which offset in the ciphertext write buffer should we append more ciphertext from reading next?
struct GNUNET_PEERSTORE_IterateContext * rekey_monotime_get
Iteration Context for retrieving the monotonic time send with key for rekeying.
char cread_buf[(2 *64 *1024+sizeof(struct TCPBox))]
Buffer for reading ciphertext from network into.
enum GNUNET_NetworkType nt
Which network type does this queue use?
struct GNUNET_CRYPTO_ChallengeNonceP challenge_received
Challenge value received.
uint64_t rekey_left_bytes
How many more bytes may we sent with the current out_cipher before we should rekey?
int mq_awaits_continue
Is MQ awaiting a GNUNET_MQ_impl_send_continue() call?
gcry_cipher_hd_t in_cipher
cipher for decryption of incoming data.
struct GNUNET_PEERSTORE_StoreContext * handshake_ack_monotime_sc
Store Context for retrieving the monotonic time send with the handshake ack.
struct GNUNET_SCHEDULER_Task * write_task
ID of write task for this connection.
size_t pwrite_off
At which offset in the plaintext output buffer should we append more plaintext for encryption next?
struct GNUNET_TIME_Absolute timeout
Timeout for this queue.
size_t cread_off
At which offset in the ciphertext read buffer should we append more ciphertext for transmission next?
struct GNUNET_TIME_Absolute rekey_time
Until what time may we sent with the current out_cipher before we should rekey?
struct GNUNET_PeerIdentity target
To whom are we talking to.
char cwrite_buf[(2 *64 *1024+sizeof(struct TCPBox))]
buffer for writing ciphertext to network.
struct GNUNET_PEERSTORE_StoreContext * handshake_monotime_sc
Store Context for retrieving the monotonic time send with the handshake.
size_t pread_off
At which offset in the plaintext input buffer should we append more plaintext from decryption next?
struct GNUNET_SCHEDULER_Task * read_task
ID of read task for this connection.
enum GNUNET_TRANSPORT_ConnectionStatus cs
The connection status of this queue.
gcry_cipher_hd_t out_cipher
cipher for encryption of outgoing data.
char pwrite_buf[UINT16_MAX+1+sizeof(struct TCPBox)]
Plaintext buffer for messages to be encrypted.
struct GNUNET_HashCode in_hmac
Shared secret for HMAC verification on incoming data.
struct GNUNET_PEERSTORE_IterateContext * handshake_monotime_get
Iteration Context for retrieving the monotonic time send with the handshake.
struct GNUNET_NETWORK_Handle * listen_sock
Listen socket.
struct sockaddr * address
Address of the other peer.
struct GNUNET_TIME_AbsoluteNBO handshake_ack_monotonic_time
Monotonic time value for handshake ack message.
struct GNUNET_TIME_AbsoluteNBO rekey_monotonic_time
Monotonic time value for rekey message.
struct GNUNET_TIME_AbsoluteNBO handshake_monotonic_time
Monotonic time value for handshake message.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_COMMUNICATOR_TCP_BOX.
struct GNUNET_ShortHashCode hmac
HMAC for the following encrypted message.
Ack for the encrypted continuation of TCP initial 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_CRYPTO_EddsaSignature sender_sig
Sender's signature of type GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_HANDSHAKE_ACK.
struct GNUNET_CRYPTO_ChallengeNonceP challenge
Challenge value used to protect against replay attack, if there is no stored monotonic time value.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_COMMUNICATOR_TCP_CONFIRMATION_ACK.
struct GNUNET_PeerIdentity sender
Sender's identity.
Encrypted continuation of TCP initial 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_CRYPTO_EddsaSignature sender_sig
Sender's signature of type GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_HANDSHAKE.
struct GNUNET_PeerIdentity sender
Sender's identity.
struct GNUNET_CRYPTO_ChallengeNonceP challenge
Challenge value used to protect against replay attack, if there is no stored monotonic time value.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_COMMUNICATOR_TCP_FINISH.
struct GNUNET_ShortHashCode hmac
HMAC for the following encrypted message.
Basically a WELCOME message, but with the purpose of giving the waiting peer a client handle to use.
struct GNUNET_PeerIdentity clientIdentity
Identity of the sender of the message.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_NAT_PROBE.
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_EddsaSignature sender_sig
Sender's signature of type GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_REKEY.
struct GNUNET_CRYPTO_HpkeEncapsulation ephemeral
New ephemeral key.
struct GNUNET_ShortHashCode hmac
HMAC for the following encrypted message.
struct GNUNET_MessageHeader header
Type is GNUNET_MESSAGE_TYPE_COMMUNICATOR_TCP_REKEY.
Signature we use to verify that the ack from the receiver of the ephemeral key was really send by the...
struct GNUNET_CRYPTO_EccSignaturePurpose purpose
Purpose must be GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_HANDSHAKE_ACK.
struct GNUNET_PeerIdentity sender
Identity of the inititor of the TCP connection (TCP client).
struct GNUNET_CRYPTO_ChallengeNonceP challenge
Challenge value used to protect against replay attack, if there is no stored monotonic time value.
struct GNUNET_PeerIdentity receiver
Presumed identity of the target of the TCP connection (TCP server)
struct GNUNET_TIME_AbsoluteNBO monotonic_time
Monotonic time of sender, to possibly help detect replay attacks (if receiver persists times by sende...
Signature we use to verify that the ephemeral key was really chosen by the specified sender.
struct GNUNET_CRYPTO_ChallengeNonceP challenge
Challenge value used to protect against replay attack, if there is no stored monotonic time value.
struct GNUNET_CRYPTO_EccSignaturePurpose purpose
Purpose must be GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_HANDSHAKE.
struct GNUNET_CRYPTO_HpkeEncapsulation ephemeral
Ephemeral key used by the sender (as Elligator representative).
struct GNUNET_PeerIdentity sender
Identity of the inititor of the TCP connection (TCP client).
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 receiver
Presumed identity of the target of the TCP connection (TCP server)
Signature we use to verify that the ephemeral key was really chosen by the specified sender.
struct GNUNET_CRYPTO_HpkeEncapsulation ephemeral
Ephemeral key used by the sender.
struct GNUNET_CRYPTO_EccSignaturePurpose purpose
Purpose must be GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_REKEY.
struct GNUNET_PeerIdentity sender
Identity of the inititor of the TCP connection (TCP client).
struct GNUNET_PeerIdentity receiver
Presumed identity of the target of the TCP connection (TCP server)
struct GNUNET_TIME_AbsoluteNBO monotonic_time
Monotonic time of sender, to possibly help detect replay attacks (if receiver persists times by sende...