summaryrefslogtreecommitdiff
path: root/sender.c
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2020-12-05 06:34:49 +0100
committerDirk Engling <erdgeist@erdgeist.org>2020-12-05 06:34:49 +0100
commit5b369d672e35d95740dd3d24f8d69ea08fb7741c (patch)
tree66fb22731465b36d06637b7f23d0525af3d6c56e /sender.c
parent179cf4adb4c20f4e2eacbc91af880a9279454eb2 (diff)
Only free gcm context after all packets were sent
Diffstat (limited to 'sender.c')
-rw-r--r--sender.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sender.c b/sender.c
index c56cb8c..d940e17 100644
--- a/sender.c
+++ b/sender.c
@@ -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
60void new_session(int sock, mbedtls_ctr_drbg_context *ctr_drbg) { 58void 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}