23
mud.c
23
mud.c
@@ -766,15 +766,16 @@ mud_keyx(struct mud *mud, unsigned char *public, int aes)
|
|||||||
|
|
||||||
mud->crypto.next.aes = mud->crypto.aes && aes;
|
mud->crypto.next.aes = mud->crypto.aes && aes;
|
||||||
|
|
||||||
if (mud->crypto.next.aes) {
|
if (!mud->crypto.next.aes)
|
||||||
crypto_aead_aes256gcm_beforenm((crypto_aead_aes256gcm_state *)
|
return;
|
||||||
mud->crypto.next.encrypt.state,
|
|
||||||
mud->crypto.next.encrypt.key);
|
|
||||||
|
|
||||||
crypto_aead_aes256gcm_beforenm((crypto_aead_aes256gcm_state *)
|
crypto_aead_aes256gcm_beforenm((crypto_aead_aes256gcm_state *)
|
||||||
mud->crypto.next.decrypt.state,
|
mud->crypto.next.encrypt.state,
|
||||||
mud->crypto.next.decrypt.key);
|
mud->crypto.next.encrypt.key);
|
||||||
}
|
|
||||||
|
crypto_aead_aes256gcm_beforenm((crypto_aead_aes256gcm_state *)
|
||||||
|
mud->crypto.next.decrypt.state,
|
||||||
|
mud->crypto.next.decrypt.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1003,12 +1004,10 @@ static void
|
|||||||
mud_packet_send(struct mud *mud, enum mud_packet_code code,
|
mud_packet_send(struct mud *mud, enum mud_packet_code code,
|
||||||
struct mud_path *path, uint64_t now, int flags)
|
struct mud_path *path, uint64_t now, int flags)
|
||||||
{
|
{
|
||||||
unsigned char data[MUD_PACKET_MAX_SIZE];
|
unsigned char data[MUD_PACKET_MAX_SIZE] = {0};
|
||||||
struct mud_packet *packet = (struct mud_packet *)data;
|
struct mud_packet *packet = (struct mud_packet *)data;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
|
||||||
memset(data, 0, sizeof(data));
|
|
||||||
|
|
||||||
mud_write48(packet->hdr.time, now);
|
mud_write48(packet->hdr.time, now);
|
||||||
memcpy(packet->hdr.kiss, mud->local.kiss, sizeof(mud->local.kiss));
|
memcpy(packet->hdr.kiss, mud->local.kiss, sizeof(mud->local.kiss));
|
||||||
|
|
||||||
@@ -1054,7 +1053,7 @@ mud_packet_send(struct mud *mud, enum mud_packet_code code,
|
|||||||
struct mud_crypto_opt opt = {
|
struct mud_crypto_opt opt = {
|
||||||
.dst = data + sizeof(packet->hdr) + size,
|
.dst = data + sizeof(packet->hdr) + size,
|
||||||
.ad = {
|
.ad = {
|
||||||
.data = packet->hdr.zero,
|
.data = data,
|
||||||
.size = sizeof(packet->hdr) + size,
|
.size = sizeof(packet->hdr) + size,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user