From 2d8bfaab51c2dd42d73c348e238802912e870b22 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Mon, 8 Jun 2020 00:46:20 +0200 Subject: moved client/server stream crypto init code into subroutines Signed-off-by: Toni Uhlig --- client.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'client.c') diff --git a/client.c b/client.c index 38afa82..95375cf 100644 --- a/client.c +++ b/client.c @@ -65,9 +65,10 @@ enum recv_return protocol_request_server_helo(struct connection * const state, (void)processed; LOG(NOTICE, "Server HELLO with message: %.*s", sizeof(helo_pkt->server_message), helo_pkt->server_message); - crypto_secretstream_xchacha20poly1305_init_pull(&state->crypto_rx_state, - helo_pkt->client_rx_header, - state->session_keys->rx); + if (init_crypto_client(state, helo_pkt->client_rx_header, sizeof(helo_pkt->client_rx_header)) != 0) { + LOG(ERROR, "Client session keypair generation failed"); + return RECV_FATAL; + } if (ev_setup_generic_timer((struct ev_user_data *)state->user_data, PING_INTERVAL) != 0) { LOG(ERROR, "Timer init failed"); -- cgit v1.2.3