diff options
author | Dirk Engling <erdgeist@erdgeist.org> | 2020-12-05 06:34:49 +0100 |
---|---|---|
committer | Dirk Engling <erdgeist@erdgeist.org> | 2020-12-05 06:34:49 +0100 |
commit | 5b369d672e35d95740dd3d24f8d69ea08fb7741c (patch) | |
tree | 66fb22731465b36d06637b7f23d0525af3d6c56e /sender.c | |
parent | 179cf4adb4c20f4e2eacbc91af880a9279454eb2 (diff) |
Only free gcm context after all packets were sent
Diffstat (limited to 'sender.c')
-rw-r--r-- | sender.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -53,8 +53,6 @@ void send_udp(int sock, mbedtls_ctr_drbg_context *ctr_drbg, const uint8_t *text, | |||
53 | output + 1 + SESSION_ID_LENGTH + GCM_IV_LENGTH)) { | 53 | output + 1 + SESSION_ID_LENGTH + GCM_IV_LENGTH)) { |
54 | sendto(sock, output, total_length, 0, (struct sockaddr*)&logging_host_address, logging_host_address_len); | 54 | sendto(sock, output, total_length, 0, (struct sockaddr*)&logging_host_address, logging_host_address_len); |
55 | } | 55 | } |
56 | |||
57 | mbedtls_gcm_free(&ctx); | ||
58 | } | 56 | } |
59 | 57 | ||
60 | void new_session(int sock, mbedtls_ctr_drbg_context *ctr_drbg) { | 58 | void new_session(int sock, mbedtls_ctr_drbg_context *ctr_drbg) { |
@@ -120,5 +118,6 @@ int main() { | |||
120 | send_udp(sock, &ctr_drbg, logline, strlen((char*)logline)); | 118 | send_udp(sock, &ctr_drbg, logline, strlen((char*)logline)); |
121 | send_udp(sock, &ctr_drbg, logline, strlen((char*)logline)); | 119 | send_udp(sock, &ctr_drbg, logline, strlen((char*)logline)); |
122 | 120 | ||
121 | mbedtls_gcm_free(&ctx); | ||
123 | close(sock); | 122 | close(sock); |
124 | } | 123 | } |