diff options
-rw-r--r-- | sender.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -32,7 +32,7 @@ static socklen_t logging_host_address_len = 0; | |||
32 | static int logging_socket = -1; | 32 | static int logging_socket = -1; |
33 | typedef uint64_t SessionId_t; | 33 | typedef uint64_t SessionId_t; |
34 | 34 | ||
35 | enum { SESSION_ID_LENGTH = 8, AES_KEY_LENGTH = 16, GCM_IV_LENGTH = 16, GCM_TAG_LENGTH = 16 }; | 35 | enum { SESSION_ID_LENGTH = 8, AES_KEY_LENGTH = 16, GCM_IV_LENGTH = 12, GCM_TAG_LENGTH = 16 }; |
36 | static SessionId_t session_id; | 36 | static SessionId_t session_id; |
37 | static uint8_t aes_key[16]; | 37 | static uint8_t aes_key[16]; |
38 | static mbedtls_gcm_context ctx; | 38 | static 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 | ||