aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/m4/odp_crypto.m4
blob: e7cfa88658c80b5324351ffda96aa8540bab7cff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2022 ARM Limited
# Copyright (c) 2022 Nokia
#

# ODP_CRYPTO
# ----------
# Select default crypto implementation
AC_ARG_WITH([crypto],
            [AS_HELP_STRING([--with-crypto],
                            [Choose crypto implementation (openssl/armv8crypto/ipsecmb/null)]
                            [[default=openssl] (linux-generic)])],
            [], [with_crypto=openssl])

# Default to OpenSSL implementation if crypto is enabled
AS_IF([test "x$with_crypto" = "xyes"], [with_crypto=openssl])

# Default to Null implementation if crypto is disabled
AS_IF([test "x$with_crypto" = "xno"], [with_crypto=null])
AS_IF([test "x$with_crypto" = "xopenssl" -a "x$with_openssl" = "xno"], [with_crypto=null])

AS_IF([test "x$with_crypto" != "xopenssl" -a "x$with_crypto" != "xarmv8crypto" -a "x$with_crypto" != "xipsecmb" -a "x$with_crypto" != "xnull"],
      [AC_MSG_ERROR([Invalid crypto implementation name])])

##########################################################################
# OpenSSL implementation
##########################################################################
AC_CONFIG_COMMANDS_PRE([dnl
AM_CONDITIONAL([WITH_OPENSSL_CRYPTO], [test "x$with_crypto" == "xopenssl"])
])

##########################################################################
# ARMv8 Crypto library implementation
##########################################################################
AS_IF([test "x$with_crypto" == "xarmv8crypto"],
      [PKG_CHECK_MODULES([AARCH64CRYPTO], [libAArch64crypto])
       AARCH64CRYPTO_PKG=", libAArch64crypto"
       AC_SUBST([AARCH64CRYPTO_PKG])])

AC_CONFIG_COMMANDS_PRE([dnl
AM_CONDITIONAL([WITH_ARMV8_CRYPTO], [test "x$with_crypto" == "xarmv8crypto"])
])

##########################################################################
# Multi-buffer IPSec library implementation
##########################################################################
AC_CONFIG_COMMANDS_PRE([dnl
AM_CONDITIONAL([WITH_IPSECMB_CRYPTO], [test "x$with_crypto" == "xipsecmb"])
])

##########################################################################
# Null implementation
##########################################################################
AS_IF([test "x$with_crypto" == "xnull"],
      [AC_MSG_WARN([Using null crypto. Strong cryptography is not available])])