From fca7910e5ed19713977116b3ab8aeeea1212e5e1 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Sun, 3 Aug 2025 19:11:03 -0400 Subject: [PATCH] tls: fix coverity warning Type: fix Change-Id: I97e08e93b02271599e52462ab83767168a2eb1cb Signed-off-by: Florin Coras --- src/plugins/tlsopenssl/tls_openssl.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/plugins/tlsopenssl/tls_openssl.c b/src/plugins/tlsopenssl/tls_openssl.c index 08ae12a1f18..3d0c52230fa 100644 --- a/src/plugins/tlsopenssl/tls_openssl.c +++ b/src/plugins/tlsopenssl/tls_openssl.c @@ -1067,19 +1067,18 @@ openssl_start_listen (tls_ctx_t * lctx) clib_warning ("unable to use SSL certificate"); goto err; } + rv = SSL_CTX_use_PrivateKey (ssl_ctx, cki->key); + if (rv != 1) + { + clib_warning ("unable to use SSL PrivateKey"); + goto err; + } } else { lctx->flags |= TLS_CONN_F_ASYNC_CERT; } - rv = SSL_CTX_use_PrivateKey (ssl_ctx, cki->key); - if (rv != 1) - { - clib_warning ("unable to use SSL PrivateKey"); - goto err; - } - if (lctx->alpn_list) SSL_CTX_set_alpn_select_cb (ssl_ctx, openssl_alpn_select_cb, (void *) lctx->alpn_list); -- 2.16.6