aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/crypto_native/CMakeLists.txt
diff options
context:
space:
mode:
authorDamjan Marion <dmarion@me.com>2020-01-31 10:24:07 +0100
committerDamjan Marion <damarion@cisco.com>2020-01-31 18:06:09 +0100
commit776644efe78f427a75fc5e122014b44b39d470c3 (patch)
treef8487ba02ad941bc2c09206b3d0477db3cc595ba /src/plugins/crypto_native/CMakeLists.txt
parent62b1cea6eda4060968f44b2639fdd756617211f4 (diff)
crypto-native: add ARMv8 AES-CBC implementation
Type: feature Change-Id: I32256061b9509880eec843db2f918879cdafbe47 Signed-off-by: Damjan Marion <dmarion@me.com>
Diffstat (limited to 'src/plugins/crypto_native/CMakeLists.txt')
-rw-r--r--src/plugins/crypto_native/CMakeLists.txt34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/plugins/crypto_native/CMakeLists.txt b/src/plugins/crypto_native/CMakeLists.txt
index cd701ec7d55..9fc3e7d4090 100644
--- a/src/plugins/crypto_native/CMakeLists.txt
+++ b/src/plugins/crypto_native/CMakeLists.txt
@@ -11,27 +11,37 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
- return()
+if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
+ list(APPEND VARIANTS "sse42\;-march=silvermont")
+ list(APPEND VARIANTS "avx2\;-march=core-avx2")
+ if(compiler_flag_march_skylake_avx512)
+ list(APPEND VARIANTS "avx512\;-march=skylake-avx512")
+ endif()
+ if(compiler_flag_march_icelake_client)
+ list(APPEND VARIANTS "vaesni\;-march=icelake-client")
+ endif()
+ set (COMPILE_FILES aes_cbc.c aes_gcm.c)
+ set (COMPILE_OPTS -Wall -fno-common -maes)
endif()
-add_vpp_plugin(crypto_native SOURCES main.c)
-
-list(APPEND VARIANTS "sse42\;-march=silvermont")
-list(APPEND VARIANTS "avx2\;-march=core-avx2")
-if(compiler_flag_march_skylake_avx512)
- list(APPEND VARIANTS "avx512\;-march=skylake-avx512")
+if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)")
+ list(APPEND VARIANTS "armv8\;-march=native")
+ set (COMPILE_FILES aes_cbc.c)
+ set (COMPILE_OPTS -Wall -fno-common)
endif()
-if(compiler_flag_march_icelake_client)
- list(APPEND VARIANTS "vaesni\;-march=icelake-client")
+
+if (NOT VARIANTS)
+ return()
endif()
+add_vpp_plugin(crypto_native SOURCES main.c)
+
foreach(VARIANT ${VARIANTS})
list(GET VARIANT 0 v)
list(GET VARIANT 1 f)
set(l crypto_native_${v})
- add_library(${l} OBJECT aes_cbc.c aes_gcm.c)
+ add_library(${l} OBJECT ${COMPILE_FILES})
set_target_properties(${l} PROPERTIES POSITION_INDEPENDENT_CODE ON)
- target_compile_options(${l} PUBLIC ${f} -Wall -fno-common -maes)
+ target_compile_options(${l} PUBLIC ${f} ${COMPILE_OPTS})
target_sources(crypto_native_plugin PRIVATE $<TARGET_OBJECTS:${l}>)
endforeach()