code for managing the key exchange (SET_KEY, PING, PONG) with other peers More...
#include "gnunet_util_lib.h"
Go to the source code of this file.
Functions | |
void | GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx, const void *payload, size_t payload_size) |
Encrypt and transmit a message with the given payload. More... | |
int | GSC_KX_init (struct GNUNET_CRYPTO_EddsaPrivateKey *pk) |
Initialize KX subsystem. More... | |
void | GSC_KX_done (void) |
Shutdown KX subsystem. More... | |
int | GSC_NEIGHBOURS_check_excess_bandwidth (const struct GSC_KeyExchangeInfo *target) |
Check if the given neighbour has excess bandwidth available. More... | |
unsigned int | GSC_NEIGHBOURS_get_queue_length (const struct GSC_KeyExchangeInfo *target) |
Check how many messages are queued for the given neighbour. More... | |
void | GSC_KX_handle_client_monitor_peers (struct GNUNET_MQ_Handle *mq) |
Handle GNUNET_MESSAGE_TYPE_CORE_MONITOR_PEERS request. More... | |
code for managing the key exchange (SET_KEY, PING, PONG) with other peers
Definition in file gnunet-service-core_kx.h.
void GSC_KX_encrypt_and_transmit | ( | struct GSC_KeyExchangeInfo * | kx, |
const void * | payload, | ||
size_t | payload_size | ||
) |
Encrypt and transmit a message with the given payload.
kx | key exchange context |
payload | payload of the message |
payload_size | number of bytes in 'payload' |
Definition at line 1630 of file gnunet-service-core_kx.c.
References calculate_seed(), derive_auth_key(), derive_iv(), do_encrypt(), GSC_KeyExchangeInfo::encrypt_key, ENCRYPTED_HEADER_SIZE, env, GNUNET_assert, GNUNET_CRYPTO_hash(), GNUNET_CRYPTO_hmac(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_h2s2(), GNUNET_i2s(), GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_CORE_ENCRYPTED_MESSAGE, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NO, GNUNET_OK, GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_hton(), GSC_KeyExchangeInfo::has_excess_bandwidth, EncryptedMessage::hmac, EncryptedMessage::iv_seed, GSC_KeyExchangeInfo::last_sequence_number_sent, GSC_KeyExchangeInfo::mq, payload, GSC_KeyExchangeInfo::peer, EncryptedMessage::reserved, EncryptedMessage::sequence_number, and EncryptedMessage::timestamp.
Referenced by transmit_typemap_task(), and try_transmission().
int GSC_KX_init | ( | struct GNUNET_CRYPTO_EddsaPrivateKey * | pk | ) |
Initialize KX subsystem.
pk | private key to use for the peer |
Definition at line 2050 of file gnunet-service-core_kx.c.
References current_ekm, do_rekey(), EphemeralKeyMessage::ephemeral_key, GNUNET_CRYPTO_ecdhe_key_create(), GNUNET_CRYPTO_eddsa_key_get_public(), GNUNET_CRYPTO_hash(), GNUNET_ERROR_TYPE_INFO, GNUNET_h2s(), GNUNET_log, GNUNET_MESSAGE_TYPE_CORE_ENCRYPTED_MESSAGE, GNUNET_MESSAGE_TYPE_CORE_EPHEMERAL_KEY, GNUNET_MESSAGE_TYPE_CORE_PING, GNUNET_MESSAGE_TYPE_CORE_PONG, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_notification_context_create(), GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SYSERR, GNUNET_TRANSPORT_core_connect(), GSC_cfg, GSC_KX_done(), GSC_my_identity, handle_transport_notify_connect(), handle_transport_notify_disconnect(), handlers, my_ephemeral_key, my_private_key, nc, pk, GNUNET_PeerIdentity::public_key, REKEY_FREQUENCY, rekey_task, sign_ephemeral_key(), and transport.
Referenced by run().
void GSC_KX_done | ( | void | ) |
Shutdown KX subsystem.
Definition at line 2110 of file gnunet-service-core_kx.c.
References GNUNET_notification_context_destroy(), GNUNET_SCHEDULER_cancel(), GNUNET_TRANSPORT_core_disconnect(), my_ephemeral_key, my_private_key, nc, rekey_task, and transport.
Referenced by GSC_KX_init(), and shutdown_task().
int GSC_NEIGHBOURS_check_excess_bandwidth | ( | const struct GSC_KeyExchangeInfo * | target | ) |
Check if the given neighbour has excess bandwidth available.
target | neighbour to check |
Definition at line 2150 of file gnunet-service-core_kx.c.
References GSC_KeyExchangeInfo::has_excess_bandwidth.
Referenced by try_transmission().
unsigned int GSC_NEIGHBOURS_get_queue_length | ( | const struct GSC_KeyExchangeInfo * | kxinfo | ) |
Check how many messages are queued for the given neighbour.
target | neighbour to check |
kxinfo | data about neighbour to check |
Definition at line 2143 of file gnunet-service-core_kx.c.
References GNUNET_MQ_get_length(), and GSC_KeyExchangeInfo::mq.
Referenced by try_transmission().
void GSC_KX_handle_client_monitor_peers | ( | struct GNUNET_MQ_Handle * | mq | ) |
Handle GNUNET_MESSAGE_TYPE_CORE_MONITOR_PEERS request.
For this request type, the client does not have to have transmitted an INIT request. All current peers are returned, regardless of which message types they accept.
mq | message queue to add for monitoring |
Definition at line 2165 of file gnunet-service-core_kx.c.
References env, GNUNET_CORE_KX_ITERATION_FINISHED, GNUNET_MESSAGE_TYPE_CORE_MONITOR_NOTIFY, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_notification_context_add(), GNUNET_TIME_absolute_hton(), GNUNET_TIME_UNIT_FOREVER_ABS, kx_head, mq, msg, nc, GSC_KeyExchangeInfo::next, GSC_KeyExchangeInfo::peer, MonitorNotifyMessage::state, GSC_KeyExchangeInfo::status, MonitorNotifyMessage::timeout, and GSC_KeyExchangeInfo::timeout.
Referenced by handle_client_monitor_peers().