build: fix ipsecmb version check
[vpp.git] / 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")