tls: fix coverity warning 16/43516/2
authorFlorin Coras <[email protected]>
Sun, 3 Aug 2025 23:11:03 +0000 (19:11 -0400)
committerDave Barach <[email protected]>
Sat, 9 Aug 2025 21:23:19 +0000 (21:23 +0000)
Type: fix

Change-Id: I97e08e93b02271599e52462ab83767168a2eb1cb
Signed-off-by: Florin Coras <[email protected]>
src/plugins/tlsopenssl/tls_openssl.c

index 08ae12a..3d0c522 100644 (file)
@@ -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);