From f457f1fa024ac8cd4f80885aa92b2fc22db882db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Ganne?= <bganne@cisco.com>
Date: Wed, 4 Jan 2023 17:56:58 +0100
Subject: [PATCH] build: do not link with libssl if not needed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

In most cases we only need OpenSSL libcrypto (crypto primitives) but
not libssl (tls).

Type: improvement

Change-Id: I9dce27d23d65bf46aea2d0f8aaf417240701efcc
Signed-off-by: BenoƮt Ganne <bganne@cisco.com>
---
 src/plugins/crypto_openssl/CMakeLists.txt | 2 +-
 src/plugins/dpdk/CMakeLists.txt           | 2 +-
 src/plugins/ikev2/CMakeLists.txt          | 2 +-
 src/plugins/wireguard/CMakeLists.txt      | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/plugins/crypto_openssl/CMakeLists.txt b/src/plugins/crypto_openssl/CMakeLists.txt
index 5d86e3b3e5e..472b0ef3243 100644
--- a/src/plugins/crypto_openssl/CMakeLists.txt
+++ b/src/plugins/crypto_openssl/CMakeLists.txt
@@ -23,5 +23,5 @@ add_vpp_plugin(crypto_openssl
   main.c
 
   LINK_LIBRARIES
-  ${OPENSSL_LIBRARIES}
+  ${OPENSSL_CRYPTO_LIBRARIES}
 )
diff --git a/src/plugins/dpdk/CMakeLists.txt b/src/plugins/dpdk/CMakeLists.txt
index a6dda260227..48b1548f9c2 100644
--- a/src/plugins/dpdk/CMakeLists.txt
+++ b/src/plugins/dpdk/CMakeLists.txt
@@ -156,7 +156,7 @@ add_vpp_plugin(dpdk
   ${DPDK_LINK_LIBRARIES}
 
   LINK_LIBRARIES
-  ${OPENSSL_LIBRARIES}
+  ${OPENSSL_CRYPTO_LIBRARIES}
 
   COMPONENT
   vpp-plugin-dpdk
diff --git a/src/plugins/ikev2/CMakeLists.txt b/src/plugins/ikev2/CMakeLists.txt
index e4c1788d44d..568271ed7d9 100644
--- a/src/plugins/ikev2/CMakeLists.txt
+++ b/src/plugins/ikev2/CMakeLists.txt
@@ -40,5 +40,5 @@ add_vpp_plugin(ikev2
   ikev2_priv.h
 
   LINK_LIBRARIES
-  ${OPENSSL_LIBRARIES}
+  ${OPENSSL_CRYPTO_LIBRARIES}
 )
diff --git a/src/plugins/wireguard/CMakeLists.txt b/src/plugins/wireguard/CMakeLists.txt
index 31f09f1d8e3..581fcf23860 100644
--- a/src/plugins/wireguard/CMakeLists.txt
+++ b/src/plugins/wireguard/CMakeLists.txt
@@ -54,7 +54,7 @@ add_vpp_plugin(wireguard
   wireguard_index_table.h
   wireguard_api.c
 
-  LINK_LIBRARIES ${OPENSSL_LIBRARIES}
+  LINK_LIBRARIES ${OPENSSL_CRYPTO_LIBRARIES}
 
   API_FILES
   wireguard.api