From ec635aefa94296e0cda390966d9be323994cc7a7 Mon Sep 17 00:00:00 2001 From: Logan007 Date: Tue, 16 Jun 2020 23:12:51 +0545 Subject: [PATCH] made header encryption indicator 8-bit type --- header_encryption.c | 4 ++-- header_encryption.h | 4 ++-- sn_utils.c | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/header_encryption.c b/header_encryption.c index 1966819..756d198 100644 --- a/header_encryption.c +++ b/header_encryption.c @@ -44,8 +44,8 @@ uint32_t packet_header_decrypt (uint8_t packet[], uint8_t packet_len, } -int32_t packet_header_decrypt_if_required (uint8_t packet[], uint16_t packet_len, - struct sn_community *communities) { +int8_t packet_header_decrypt_if_required (uint8_t packet[], uint16_t packet_len, + struct sn_community *communities) { struct sn_community *c, *tmp; diff --git a/header_encryption.h b/header_encryption.h index a4395e0..65b9709 100644 --- a/header_encryption.h +++ b/header_encryption.h @@ -23,8 +23,8 @@ uint32_t packet_header_decrypt (uint8_t packet[], uint8_t packet_len, char * community_name, he_context_t * ctx); -int32_t packet_header_decrypt_if_required (uint8_t packet[], uint16_t packet_len, - struct sn_community * communities); +int8_t packet_header_decrypt_if_required (uint8_t packet[], uint16_t packet_len, + struct sn_community * communities); int32_t packet_header_encrypt (uint8_t packet[], uint8_t header_len, he_context_t * ctx); diff --git a/sn_utils.c b/sn_utils.c index 95a26b8..b38e045 100644 --- a/sn_utils.c +++ b/sn_utils.c @@ -393,6 +393,8 @@ static int process_udp(n2n_sn_t *sss, ntohs(sender_sock->sin_port)); he = packet_header_decrypt_if_required (udp_buf, udp_size, sss->communities); + if (he < 0) + return -1; /* something wrong with packet decryption */ /* Use decode_common() to determine the kind of packet then process it: *