summaryrefslogtreecommitdiffstats
path: root/test/cert_comp_test.c
diff options
context:
space:
mode:
authorTodd Short <tshort@akamai.com>2022-10-19 10:22:29 -0400
committerPauli <pauli@openssl.org>2022-10-21 10:34:55 +1100
commitdc45bfb4b452ba5a876ebf48791217b69d092ff9 (patch)
treea1d82312f324b98b6da38ea44c39ebcfcf58c85c /test/cert_comp_test.c
parentd06d5d6b68f39c7f75f1130f984efa78c291fb57 (diff)
Fix coverity 1516095 deadcode
Unless multiple compression algorithms are configured, test 3 is not run, so anything looking at `test == 3` is considered dead code. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19440)
Diffstat (limited to 'test/cert_comp_test.c')
-rw-r--r--test/cert_comp_test.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/cert_comp_test.c b/test/cert_comp_test.c
index 66320bddd4..5c385df805 100644
--- a/test/cert_comp_test.c
+++ b/test/cert_comp_test.c
@@ -148,7 +148,11 @@ static int test_ssl_cert_comp(int test)
if (expected_client == TLSEXT_comp_cert_none)
expected_client = TLSEXT_comp_cert_zstd;
#endif
- /* if there's only one comp algorithm, pref won't do much */
+ /*
+ * If there's only one comp algorithm, pref won't do much
+ * Coverity can get confused in this case, and consider test == 3
+ * to be DEADCODE
+ */
if (test == 3 && expected_client == expected_server) {
TEST_info("Only one compression algorithm configured");
return 1;
@@ -160,6 +164,7 @@ static int test_ssl_cert_comp(int test)
&sctx, &cctx, cert, privkey)))
goto end;
if (test == 3) {
+ /* coverity[deadcode] */
server_pref[0] = expected_server;
server_pref[1] = expected_client;
if (!TEST_true(SSL_CTX_set1_cert_comp_preference(sctx, server_pref, 2)))
@@ -203,6 +208,7 @@ static int test_ssl_cert_comp(int test)
if (!TEST_true(create_ssl_connection(serverssl, clientssl, SSL_ERROR_NONE)))
goto end;
if (test == 3) {
+ /* coverity[deadcode] */
SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(serverssl);
/* expect that the pre-compressed cert won't be used */