Skip to content

Commit 428e158

Browse files
committed
configure.ac:
* in handling for enable-all-asm, add check for full Gnu C and don't auto-enable all-asm unless full Gnu C and enable-all-crypto, among other sanity checks. * in enable-all and enable-all-crypto, correctly conditionalize several FIPS-v6-only features/algorithms. * in FIPS v5 setup, force off SRTP and SRTP-KDF (with warnings).
1 parent e227b2a commit 428e158

1 file changed

Lines changed: 44 additions & 12 deletions

File tree

configure.ac

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,6 @@ then
864864
test "$enable_session_ticket" = "" && enable_session_ticket=yes
865865
test "$enable_earlydata" = "" && enable_earlydata=yes
866866
test "$enable_ech" = "" && enable_ech=yes
867-
test "$enable_srtp" = "" && enable_srtp=yes
868867
test "$enable_rpk" = "" && enable_rpk=yes
869868

870869
if test "$ENABLED_LINUXKM_DEFAULTS" != "yes"
@@ -915,6 +914,11 @@ then
915914
fi
916915
fi
917916

917+
if test "$ENABLED_FIPS" = "no" || test "$HAVE_FIPS_VERSION" -ge 6
918+
then
919+
test "$enable_srtp" = "" && enable_srtp=yes
920+
fi
921+
918922
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DER_LOAD -DKEEP_OUR_CERT -DKEEP_PEER_CERT"
919923

920924
# Certificate extensions and alt. names for FPKI use
@@ -929,9 +933,29 @@ fi
929933

930934

931935
# Auto-selected activation of all applicable asm accelerations
936+
937+
# Enable asm automatically only if the compiler advertises itself as full Gnu C.
938+
if "$CC" $AM_CFLAGS $CPPFLAGS $CFLAGS -x c - -o /dev/null >/dev/null 2>&1 <<' EOF'
939+
#include <stdlib.h>
940+
int main(int argc, char **argv) {
941+
(void)argc; (void)argv;
942+
#ifdef __STRICT_ANSI__
943+
#error __STRICT_ANSI__
944+
#endif
945+
#ifndef __GNUC__
946+
#error !__GNUC__
947+
#endif
948+
return 0;
949+
}
950+
EOF
951+
then
952+
HAVE_GNUC=yes
953+
fi
954+
932955
if test "$enable_all_crypto" = "yes" &&
933956
test "$ENABLED_LINUXKM_DEFAULTS" = "no" &&
934957
test "$ENABLED_ASM" != "no" &&
958+
test "$HAVE_GNUC" = "yes" &&
935959
test "$enable_sp_asm" != "no" &&
936960
test "$enable_intelasm" != "no" &&
937961
test "$enable_armasm" != "no"
@@ -1005,7 +1029,6 @@ if test "$ENABLED_ALL_CRYPT" = "yes"
10051029
then
10061030
test "$enable_atomicuser" = "" && enable_atomicuser=yes
10071031
test "$enable_aesgcm" = "" && enable_aesgcm=yes
1008-
test "$enable_aesgcm_stream" = "" && test "$enable_aesgcm" = "yes" && enable_aesgcm_stream=yes
10091032
test "$enable_aesccm" = "" && enable_aesccm=yes
10101033
test "$enable_aesctr" = "" && enable_aesctr=yes
10111034
test "$enable_aeseax" = "" && enable_aeseax=yes
@@ -1017,8 +1040,6 @@ then
10171040
test "$enable_sha224" = "" && enable_sha224=yes
10181041
test "$enable_sha512" = "" && enable_sha512=yes
10191042
test "$enable_sha3" = "" && enable_sha3=yes
1020-
test "$enable_shake128" = "" && enable_shake128=yes
1021-
test "$enable_shake256" = "" && enable_shake256=yes
10221043
test "$enable_sessioncerts" = "" && enable_sessioncerts=yes
10231044
test "$enable_keygen" = "" && enable_keygen=yes
10241045
test "$enable_certgen" = "" && enable_certgen=yes
@@ -1056,12 +1077,6 @@ then
10561077
test "$enable_md4" = "" && enable_md4=yes
10571078
test "$enable_anon" = "" && enable_anon=yes
10581079
test "$enable_ssh" = "" && test "$enable_hmac" != "no" && enable_ssh=yes
1059-
test "$enable_srtp_kdf" = "" && enable_srtp_kdf=yes
1060-
1061-
if test "$ENABLED_LINUXKM_DEFAULTS" != "yes"
1062-
then
1063-
test "$enable_compkey" = "" && enable_compkey=yes
1064-
fi
10651080

10661081
# sp-math is incompatible with opensslextra, ECC custom curves, and DSA.
10671082
if test "$ENABLED_SP_MATH" = "no"
@@ -1093,10 +1108,16 @@ then
10931108
fi
10941109
fi
10951110

1096-
if test "$ENABLED_FIPS" = "no" || test "$HAVE_FIPS_VERSION" -ge 6 || test "$FIPS_VERSION" = "v5-dev"; then
1111+
if test "$ENABLED_FIPS" = "no" || test "$HAVE_FIPS_VERSION" -ge 6
1112+
then
1113+
test "$enable_aesgcm_stream" = "" && test "$enable_aesgcm" = "yes" && enable_aesgcm_stream=yes
10971114
test "$enable_aesxts" = "" && enable_aesxts=yes
10981115
test "$enable_aesxts_stream" = "" && test "$enable_aesxts" = "yes" && (test "$enable_armasm" = "" || test "$enable_armasm" = "no") && enable_aesxts_stream=yes
10991116
test "$enable_aessiv" = "" && enable_aessiv=yes
1117+
test "$enable_shake128" = "" && enable_shake128=yes
1118+
test "$enable_shake256" = "" && enable_shake256=yes
1119+
test "$enable_compkey" = "" && test "$ENABLED_LINUXKM_DEFAULTS" != "yes" && enable_compkey=yes
1120+
test "$enable_srtp_kdf" = "" && enable_srtp_kdf=yes
11001121
fi
11011122

11021123
if test "$ENABLED_FIPS" = "no" || test "$HAVE_FIPS_VERSION" -le 5; then
@@ -3997,7 +4018,8 @@ AC_ARG_ENABLE([compkey],
39974018
[ ENABLED_COMPKEY=no ]
39984019
)
39994020

4000-
if test "$ENABLED_WPAS" = "yes" || test "$ENABLED_OPENSSLALL" = "yes"
4021+
if (test "$ENABLED_WPAS" = "yes" || test "$ENABLED_OPENSSLALL" = "yes") &&
4022+
(test "$HAVE_FIPS_VERSION" != "5" || test "$FIPS_VERSION" = "v5-dev")
40014023
then
40024024
ENABLED_COMPKEY=yes
40034025
fi
@@ -5486,6 +5508,16 @@ AS_CASE([$FIPS_VERSION],
54865508
(test "$FIPS_VERSION" != "v5-dev" || test "$enable_aesofb" != "no")],
54875509
[ENABLED_AESOFB="yes"; AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AES_OFB"])])
54885510
5511+
AS_IF([test "$ENABLED_SRTP" != "no" &&
5512+
(test "$FIPS_VERSION" != "v5-dev" || test "$enable_srtp" != "yes")],
5513+
[AC_MSG_WARN([Forcing off srtp for FIPS ${FIPS_VERSION}.])
5514+
ENABLED_SRTP="no"])
5515+
5516+
AS_IF([test "$ENABLED_SRTP_KDF" != "no" &&
5517+
(test "$FIPS_VERSION" != "v5-dev" || test "$enable_srtp_kdf" != "yes")],
5518+
[AC_MSG_WARN([Forcing off srtp-kdf for FIPS ${FIPS_VERSION}.])
5519+
ENABLED_SRTP_KDF="no"])
5520+
54895521
AS_IF([(test "$ENABLED_AESCCM" = "yes" && test "$HAVE_AESCCM_PORT" != "yes") ||
54905522
(test "$ENABLED_AESCTR" = "yes" && test "$HAVE_AESCTR_PORT" != "yes") ||
54915523
(test "$ENABLED_AESGCM" = "yes" && test "$HAVE_AESGCM_PORT" != "yes") ||

0 commit comments

Comments
 (0)