[PATCH v4 5/9] app/test: fix TLS zero length record

Stephen Hemminger stephen at networkplumber.org
Thu Nov 21 19:23:26 CET 2024


The code was duplicating the same condition three times?
Reading the commit message, the intention was:

    Add unit tests to verify the zero len TLS records. Zero len packets are
    allowed when content type is app data while zero packet length with
    other content type (such as handshake) would result in an error.

Link: https://pvs-studio.com/en/blog/posts/cpp/1179/

Fixes: 79a58624369a ("test/security: verify zero length TLS records")
Cc: vvelumuri at marvell.com
Cc: stable at dpdk.org

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 app/test/test_cryptodev.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index c647baeee1..a33ef574cc 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -12253,10 +12253,7 @@ test_tls_record_proto_all(const struct tls_record_test_flags *flags)
 		if (flags->skip_sess_destroy && sec_session_outb == NULL)
 			sec_session_outb = ut_params->sec_session;
 
-		if (flags->zero_len &&
-		    ((flags->content_type == TLS_RECORD_TEST_CONTENT_TYPE_HANDSHAKE) ||
-		    (flags->content_type == TLS_RECORD_TEST_CONTENT_TYPE_HANDSHAKE) ||
-		    (flags->content_type == TLS_RECORD_TEST_CONTENT_TYPE_HANDSHAKE))) {
+		if (flags->zero_len && flags->content_type != TLS_RECORD_TEST_CONTENT_TYPE_APP) {
 			if (ret == TEST_SUCCESS)
 				return TEST_FAILED;
 			goto skip_decrypt;
-- 
2.45.2



More information about the stable mailing list