14
mud.c
14
mud.c
@@ -773,8 +773,19 @@ mud_keyx_init(struct mud *mud, uint64_t now)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
mud_set_aes(struct mud *mud)
|
||||||
|
{
|
||||||
|
if (!crypto_aead_aes256gcm_is_available())
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
mud->crypto.aes = 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
struct mud *
|
struct mud *
|
||||||
mud_create(int port, int v4, int v6, int aes, int mtu)
|
mud_create(int port, int v4, int v6, int mtu)
|
||||||
{
|
{
|
||||||
uint64_t now = mud_now();
|
uint64_t now = mud_now();
|
||||||
|
|
||||||
@@ -799,7 +810,6 @@ mud_create(int port, int v4, int v6, int aes, int mtu)
|
|||||||
mud->send_timeout = MUD_SEND_TIMEOUT;
|
mud->send_timeout = MUD_SEND_TIMEOUT;
|
||||||
mud->time_tolerance = MUD_TIME_TOLERANCE;
|
mud->time_tolerance = MUD_TIME_TOLERANCE;
|
||||||
mud->tc = MUD_PACKET_TC;
|
mud->tc = MUD_PACKET_TC;
|
||||||
mud->crypto.aes = aes && crypto_aead_aes256gcm_is_available();
|
|
||||||
|
|
||||||
randombytes_buf(mud->kiss, sizeof(mud->kiss));
|
randombytes_buf(mud->kiss, sizeof(mud->kiss));
|
||||||
mud_set_mtu(mud, mtu);
|
mud_set_mtu(mud, mtu);
|
||||||
|
|||||||
3
mud.h
3
mud.h
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
struct mud;
|
struct mud;
|
||||||
|
|
||||||
struct mud *mud_create (int, int, int, int, int);
|
struct mud *mud_create (int, int, int, int);
|
||||||
void mud_delete (struct mud *);
|
void mud_delete (struct mud *);
|
||||||
|
|
||||||
int mud_get_fd (struct mud *);
|
int mud_get_fd (struct mud *);
|
||||||
@@ -19,6 +19,7 @@ int mud_get_mtu (struct mud *);
|
|||||||
int mud_set_send_timeout_msec (struct mud *, unsigned);
|
int mud_set_send_timeout_msec (struct mud *, unsigned);
|
||||||
int mud_set_time_tolerance_sec (struct mud *, unsigned);
|
int mud_set_time_tolerance_sec (struct mud *, unsigned);
|
||||||
int mud_set_tc (struct mud *, int);
|
int mud_set_tc (struct mud *, int);
|
||||||
|
int mud_set_aes (struct mud *);
|
||||||
|
|
||||||
int mud_peer (struct mud *, const char *, const char *, int, int);
|
int mud_peer (struct mud *, const char *, const char *, int, int);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user