summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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