build: fix ipsecmb version check 86/33986/2
authorFan Zhang <roy.fan.zhang@intel.com>
Wed, 6 Oct 2021 13:23:33 +0000 (14:23 +0100)
committerDamjan Marion <dmarion@me.com>
Thu, 7 Oct 2021 15:34:48 +0000 (15:34 +0000)
Type: fix

This patch fixes the chacha20-poly1305 support check in ipsecmb
engine build.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Signed-off-by: PiotrX Kleski <piotrx.kleski@intel.com>
Change-Id: I74b52a27f78a0f6a65c867dbd44a44a8f4a2ed60

src/plugins/crypto_ipsecmb/CMakeLists.txt

index fd9c972..429343a 100644 (file)
@@ -12,8 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-include (CheckFunctionExists)
-
 if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
   return()
 endif()
@@ -35,12 +33,14 @@ if(IPSECMB_INCLUDE_DIR AND IPSECMB_LIB)
                ${IPSECMB_LINK_FLAGS}
                )
 
-       check_function_exists(ipsecmb_ops_chacha_poly HAVE_IPSECMB_CHACHA_POLY)
+       file(READ "${IPSECMB_INCLUDE_DIR}/intel-ipsec-mb.h" ipsecmb_header)
+       string(REGEX MATCH "IMB_VERSION_STR (\"+[0-9]+\\.[0-9]+\\.[0-9]+\")" _ ${ipsecmb_header})
+       string(REPLACE "\"" "" IPSECMB_VERSION ${CMAKE_MATCH_1})
 
-       if (HAVE_IPSECMB_CHACHA_POLY)
+       if (${IPSECMB_VERSION} VERSION_GREATER "0.54.0")
                add_definitions(-DHAVE_IPSECMB_CHACHA_POLY)
        else()
-               message(STATUS "Intel IPSecMB CHACHA support not found. Disabled")
+               message(STATUS "Intel IPSecMB ${IPSECMB_VERSION} does not support chacha20-poly1305. Disabled")
        endif()
 
        target_compile_options(crypto_ipsecmb_plugin PRIVATE "-march=silvermont" "-maes")