summaryrefslogtreecommitdiff
path: root/sender.c
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2021-01-18 15:05:13 +0100
committerDirk Engling <erdgeist@erdgeist.org>2021-01-18 15:05:13 +0100
commite7536f75b2571e440d160c96a8d2bceb726b8c78 (patch)
tree25c7342f18050897000e861159991b4d06cdd9f4 /sender.c
parent7dcf2f3a45d5c665bb8b3bac3508dddd622c4a93 (diff)
Bump sender.c to new udp version with 96 bit gcm iv
Diffstat (limited to 'sender.c')
-rw-r--r--sender.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sender.c b/sender.c
index 69cc527..cda56f9 100644
--- a/sender.c
+++ b/sender.c
@@ -32,7 +32,7 @@ static socklen_t logging_host_address_len = 0;
32static int logging_socket = -1; 32static int logging_socket = -1;
33typedef uint64_t SessionId_t; 33typedef uint64_t SessionId_t;
34 34
35enum { SESSION_ID_LENGTH = 8, AES_KEY_LENGTH = 16, GCM_IV_LENGTH = 16, GCM_TAG_LENGTH = 16 }; 35enum { SESSION_ID_LENGTH = 8, AES_KEY_LENGTH = 16, GCM_IV_LENGTH = 12, GCM_TAG_LENGTH = 16 };
36static SessionId_t session_id; 36static SessionId_t session_id;
37static uint8_t aes_key[16]; 37static uint8_t aes_key[16];
38static mbedtls_gcm_context ctx; 38static mbedtls_gcm_context ctx;
@@ -43,7 +43,7 @@ void send_udp(int sock, mbedtls_ctr_drbg_context *ctr_drbg, const uint8_t *text,
43 43
44 const size_t total_length = 1 + SESSION_ID_LENGTH + GCM_IV_LENGTH + GCM_TAG_LENGTH + len; 44 const size_t total_length = 1 + SESSION_ID_LENGTH + GCM_IV_LENGTH + GCM_TAG_LENGTH + len;
45 uint8_t *output = alloca(total_length); 45 uint8_t *output = alloca(total_length);
46 output[0] = 1; 46 output[0] = 2;
47 memcpy(output + 1, (uint8_t*)&session_id, SESSION_ID_LENGTH); 47 memcpy(output + 1, (uint8_t*)&session_id, SESSION_ID_LENGTH);
48 memcpy(output + 1 + SESSION_ID_LENGTH, iv, GCM_IV_LENGTH); 48 memcpy(output + 1 + SESSION_ID_LENGTH, iv, GCM_IV_LENGTH);
49 49