Skip to content

Commit 0069e7e

Browse files
emmaLfinn00dmarion
authored andcommitted
crypto-ipsecmb: upgrade to ipsecmb v3.0.1
Type: feature ipsec-mb 3.0 removed its Makefiles, so the external package is now built with CMake. IMB_MGR was made opaque, so the engine now calls the library's IMB_* macros instead of IMB_MGR function pointers, which also keeps compatibility with v2.0.2. Change-Id: I2920d61d644728596282fea57d631c672d79cecf Signed-off-by: Emma Finn <emma.finn@intel.com>
1 parent 273c97f commit 0069e7e

3 files changed

Lines changed: 167 additions & 72 deletions

File tree

‎build/external/packages/ipsec-mb.mk‎

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,39 @@
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
1313

14-
ipsec-mb_version := 2.0
15-
ipsec-mb_patch_version := 2
14+
ipsec-mb_version := 3.0
15+
ipsec-mb_patch_version := 1
1616
ipsec-mb_version_str := $(ipsec-mb_version).$(ipsec-mb_patch_version)
1717
ipsec-mb_tarball := v$(ipsec-mb_version_str).tar.gz
18-
ipsec-mb_tarball_sha256sum_2.0 := b0e22e113ebbaa4aa8fd2332897540bff87bfabf397daeb05301b603947dda83
18+
ipsec-mb_tarball_sha256sum_3.0 := f971b253d1ad4affa01bad557a4b8ae60fce37256e0afca03d480377c497c1aa
1919

2020
ipsec-mb_tarball_sha256sum := $(ipsec-mb_tarball_sha256sum_$(ipsec-mb_version))
2121
ipsec-mb_tarball_strip_dirs := 1
22-
ipsec-mb_url := https://github.com/intel/intel-ipsec-mb/archive/$(ipsec-mb_tarball)
22+
ipsec-mb_url := https://github.com/intel/intel-ipsec-mb/archive/$(ipsec-mb_tarball)
23+
24+
# ipsec-mb 3.0 only supports CMake builds (legacy Makefiles were deprecated)
2325
define ipsec-mb_config_cmds
24-
@true
26+
@$(CMAKE) -S $(ipsec-mb_src_dir) -B $(ipsec-mb_build_dir) \
27+
-DCMAKE_BUILD_TYPE=Release \
28+
-DBUILD_SHARED_LIBS=OFF \
29+
-DBUILD_LIBRARY_ONLY=ON \
30+
-DSAFE_PARAM=OFF \
31+
-DSAFE_LOOKUP=OFF \
32+
-DSAFE_DATA=OFF \
33+
-DCMAKE_INSTALL_PREFIX=$(ipsec-mb_install_dir) \
34+
-DEXTRA_CFLAGS="-g -msse4.2" > $(ipsec-mb_config_log) 2>&1
2535
endef
2636

2737
define ipsec-mb_build_cmds
28-
@$(MAKE) -C $(ipsec-mb_src_dir)/lib -j \
29-
SHARED=n \
30-
SAFE_PARAM=n \
31-
SAFE_LOOKUP=n \
32-
SAFE_DATA=n \
33-
PREFIX=$(ipsec-mb_install_dir) \
34-
EXTRA_CFLAGS="-g -msse4.2" > $(ipsec-mb_build_log)
38+
@$(CMAKE) --build $(ipsec-mb_build_dir) --parallel $(JOBS) \
39+
> $(ipsec-mb_build_log) 2>&1
3540
endef
3641

3742
define ipsec-mb_install_cmds
3843
@mkdir -p $(ipsec-mb_install_dir)/include
3944
@mkdir -p $(ipsec-mb_install_dir)/lib
4045
@cp $(ipsec-mb_src_dir)/lib/intel-ipsec-mb.h $(ipsec-mb_install_dir)/include
41-
@cp $(ipsec-mb_src_dir)/lib/libIPSec_MB.a $(ipsec-mb_install_dir)/lib
46+
@cp $(ipsec-mb_build_dir)/lib/libIPSec_MB.a $(ipsec-mb_install_dir)/lib
4247
endef
4348

4449
$(eval $(call package,ipsec-mb))

‎src/crypto_engines/ipsecmb/CMakeLists.txt‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,22 @@ vpp_find_library(IPSECMB_LIB NAMES libIPSec_MB.a HINTS ${IPSECMB_LIB_DIR_HINT})
2121

2222
if(IPSECMB_INCLUDE_DIR AND IPSECMB_LIB)
2323

24+
file(READ "${IPSECMB_INCLUDE_DIR}/intel-ipsec-mb.h" ipsecmb_header)
25+
string(REGEX MATCH "IMB_VERSION_STR[ \t]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\"" _ "${ipsecmb_header}")
26+
set(IPSECMB_VERSION "${CMAKE_MATCH_1}")
27+
28+
# Minimum supported verion is v2.0.2.
29+
if(IPSECMB_VERSION VERSION_LESS "2.0.2")
30+
message(STATUS "Intel IPSecMB ${IPSECMB_VERSION} found: ${IPSECMB_INCLUDE_DIR} (2.0.2 or newer required). Disabled")
31+
return()
32+
endif()
33+
2434
get_filename_component(IPSECMB_LIB_DIR ${IPSECMB_LIB} DIRECTORY)
2535
set(IPSECMB_LINK_FLAGS "${IPSECMB_LINK_FLAGS} -L${IPSECMB_LIB_DIR} -Wl,--whole-archive ${IPSECMB_LIB} -Wl,--no-whole-archive")
2636
set(IPSECMB_LINK_FLAGS "${IPSECMB_LINK_FLAGS} -Wl,--exclude-libs,libIPSec_MB.a,-l:libIPSec_MB.a")
37+
# Some ipsec-mb 3.0 objects lack .note.GNU-stack, which would otherwise mark
38+
# the engine as needing an executable stack.
39+
set(IPSECMB_LINK_FLAGS "${IPSECMB_LINK_FLAGS} -Wl,-z,noexecstack")
2740
include_directories(${IPSECMB_INCLUDE_DIR})
2841
add_vpp_crypto_engine(ipsecmb
2942
SOURCES
@@ -33,10 +46,6 @@ if(IPSECMB_INCLUDE_DIR AND IPSECMB_LIB)
3346
${IPSECMB_LINK_FLAGS}
3447
)
3548

36-
file(READ "${IPSECMB_INCLUDE_DIR}/intel-ipsec-mb.h" ipsecmb_header)
37-
string(REGEX MATCH "IMB_VERSION_STR (\"+[0-9]+\\.[0-9]+\\.[0-9]+\")" _ ${ipsecmb_header})
38-
string(REPLACE "\"" "" IPSECMB_VERSION ${CMAKE_MATCH_1})
39-
4049
if (${IPSECMB_VERSION} VERSION_GREATER "0.54.0")
4150
add_definitions(-DHAVE_IPSECMB_CHACHA_POLY)
4251
else()

0 commit comments

Comments
 (0)