diff options
author | Dirk Engling <erdgeist@erdgeist.org> | 2021-01-18 15:05:13 +0100 |
---|---|---|
committer | Dirk Engling <erdgeist@erdgeist.org> | 2021-01-18 15:05:13 +0100 |
commit | e7536f75b2571e440d160c96a8d2bceb726b8c78 (patch) | |
tree | 25c7342f18050897000e861159991b4d06cdd9f4 | |
parent | 7dcf2f3a45d5c665bb8b3bac3508dddd622c4a93 (diff) |
Bump sender.c to new udp version with 96 bit gcm iv
-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 | ||