From 63dde087796bfcd730508b069ebae7c79b7cebe8 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sat, 26 Mar 2022 09:39:49 +0100 Subject: lib: Refactor reading packet from rbuff Reading packets from the rbuff and checking their validity (non-zero size, pass crc check, pass decryption) is now extracted into a function. Also adds a function to get the length of an sdu_du_buff instead of subtracting the tail and head pointers. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/crypt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/lib/crypt.c') diff --git a/src/lib/crypt.c b/src/lib/crypt.c index e19981bc..2985fc6a 100644 --- a/src/lib/crypt.c +++ b/src/lib/crypt.c @@ -282,8 +282,7 @@ static int openssl_decrypt(struct flow * f, int in_sz; int tmp_sz; - in = shm_du_buff_head(sdb); - in_sz = shm_du_buff_tail(sdb) - in; + in_sz = shm_du_buff_len(sdb); if (in_sz < IVSZ) return -ECRYPT; -- cgit v1.2.3