summaryrefslogtreecommitdiff
path: root/sender.c
diff options
context:
space:
mode:
Diffstat (limited to 'sender.c')
-rw-r--r--sender.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sender.c b/sender.c
index d940e17..9cc7a71 100644
--- a/sender.c
+++ b/sender.c
@@ -83,13 +83,6 @@ void new_session(int sock, mbedtls_ctr_drbg_context *ctr_drbg) {
83} 83}
84 84
85int main() { 85int main() {
86 mbedtls_ctr_drbg_context ctr_drbg;
87 mbedtls_entropy_context entropy;
88
89 mbedtls_entropy_init(&entropy);
90 mbedtls_ctr_drbg_init(&ctr_drbg);
91 mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, pp, sizeof(pp));
92
93 struct addrinfo hints, *result, *rp; 86 struct addrinfo hints, *result, *rp;
94 memset (&hints, 0, sizeof (hints)); 87 memset (&hints, 0, sizeof (hints));
95 hints.ai_socktype = SOCK_DGRAM; 88 hints.ai_socktype = SOCK_DGRAM;
@@ -109,10 +102,19 @@ int main() {
109 errx(EXIT_FAILURE, "Can't open socket"); 102 errx(EXIT_FAILURE, "Can't open socket");
110 freeaddrinfo(result); 103 freeaddrinfo(result);
111 104
105 // Setup
106 mbedtls_ctr_drbg_context ctr_drbg;
107 mbedtls_entropy_context entropy;
108
109 mbedtls_entropy_init(&entropy);
110 mbedtls_ctr_drbg_init(&ctr_drbg);
111 mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy, pp, sizeof(pp));
112
112 new_session(sock, &ctr_drbg); 113 new_session(sock, &ctr_drbg);
113 114
114 sleep(3); 115 sleep(3);
115 116
117 // Fire
116 const unsigned char *logline = (const unsigned char*)"Juchuuu, es klappt!\n"; 118 const unsigned char *logline = (const unsigned char*)"Juchuuu, es klappt!\n";
117 send_udp(sock, &ctr_drbg, logline, strlen((char*)logline)); 119 send_udp(sock, &ctr_drbg, logline, strlen((char*)logline));
118 send_udp(sock, &ctr_drbg, logline, strlen((char*)logline)); 120 send_udp(sock, &ctr_drbg, logline, strlen((char*)logline));