Skip to content

Commit 3fac3b7

Browse files
committed
configure.ac:
* move leanpsk and asn option processing early to make their results available to existing math back end selector logic; * add -DWOLFSSL_ASN_ALL to enable-all-crypto; * tweak asn option processing to preserve "original" value in case later configure logic wants to pivot on that.
1 parent 53c4c00 commit 3fac3b7

1 file changed

Lines changed: 67 additions & 67 deletions

File tree

configure.ac

Lines changed: 67 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,69 @@ then
789789
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_X86_BUILD"
790790
fi
791791

792+
793+
AC_ARG_ENABLE([leanpsk],
794+
[AS_HELP_STRING([--enable-leanpsk],[Enable Lean PSK build (default: disabled)])],
795+
[ ENABLED_LEANPSK=$enableval ],
796+
[ ENABLED_LEANPSK=no ]
797+
)
798+
799+
if test "$ENABLED_LEANPSK" = "yes"
800+
then
801+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LEANPSK -DWOLFSSL_STATIC_PSK -DHAVE_NULL_CIPHER -DSINGLE_THREADED -DNO_AES -DNO_FILESYSTEM -DNO_RSA -DNO_DSA -DNO_DH -DNO_PWDBASED -DNO_MD4 -DNO_MD5 -DNO_ERROR_STRINGS -DNO_OLD_TLS -DNO_RC4 -DNO_WRITEV -DNO_DEV_RANDOM -DWOLFSSL_USER_IO -DNO_SHA"
802+
ENABLED_SLOWMATH="no"
803+
ENABLED_SINGLETHREADED="yes"
804+
enable_lowresource=yes
805+
fi
806+
807+
808+
# ASN
809+
810+
# disabling ASN implicitly disables certs, RSA, DSA, and ECC,
811+
# and also disables MPI unless DH is enabled.
812+
813+
# turn off ASN if leanpsk on
814+
if test "$ENABLED_LEANPSK" = "yes"
815+
then
816+
enable_asn=no
817+
fi
818+
819+
AC_ARG_ENABLE([asn],
820+
[AS_HELP_STRING([--enable-asn],[Enable ASN (default: enabled)])],
821+
[ ENABLED_ASN=$enableval ],
822+
[ ENABLED_ASN=yes ]
823+
)
824+
825+
for v in `echo $ENABLED_ASN | tr "," " "`
826+
do
827+
case $v in
828+
all)
829+
# Enable all ASN features
830+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASN_ALL"
831+
ENABLED_ASN=yes
832+
;;
833+
template | yes)
834+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASN_TEMPLATE"
835+
ENABLED_ASN=yes
836+
;;
837+
original)
838+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASN_ORIGINAL"
839+
;;
840+
nocrypt)
841+
AM_CFLAGS="$AM_CFLAGS -DNO_ASN_CRYPT"
842+
enable_pwdbased=no
843+
;;
844+
no)
845+
AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_ASN_CRYPT"
846+
enable_pwdbased=no
847+
;;
848+
*)
849+
AC_MSG_ERROR([Invalid asn option. Valid are: all, template/yes, original, nocrypt or no. Seen: $ENABLED_ASN.])
850+
break;;
851+
esac
852+
done
853+
854+
792855
# if sp-math-all is not set, then enable fast math
793856
if test "x$ENABLED_FASTMATH" = "xyes" && test "$enable_sp_math_all" = "" && test "$enable_sp_math" = ""
794857
then
@@ -1137,8 +1200,8 @@ then
11371200
AM_CFLAGS="$AM_CFLAGS -DHAVE_FFDHE_2048 -DHAVE_FFDHE_3072"
11381201
DEFAULT_MAX_CLASSIC_ASYM_KEY_BITS=4096
11391202

1140-
# Enable multiple attribute additions such as DC
1141-
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MULTI_ATTRIB"
1203+
# Enable all parsing features for ASN */
1204+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASN_ALL"
11421205

11431206
# Enable DH Extra
11441207
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DH_EXTRA"
@@ -2291,21 +2354,6 @@ then
22912354
DEFAULT_MAX_CLASSIC_ASYM_KEY_BITS=4096
22922355
fi
22932356

2294-
# lean psk build
2295-
AC_ARG_ENABLE([leanpsk],
2296-
[AS_HELP_STRING([--enable-leanpsk],[Enable Lean PSK build (default: disabled)])],
2297-
[ ENABLED_LEANPSK=$enableval ],
2298-
[ ENABLED_LEANPSK=no ]
2299-
)
2300-
2301-
if test "$ENABLED_LEANPSK" = "yes"
2302-
then
2303-
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LEANPSK -DWOLFSSL_STATIC_PSK -DHAVE_NULL_CIPHER -DSINGLE_THREADED -DNO_AES -DNO_FILESYSTEM -DNO_RSA -DNO_DSA -DNO_DH -DNO_PWDBASED -DNO_MD4 -DNO_MD5 -DNO_ERROR_STRINGS -DNO_OLD_TLS -DNO_RC4 -DNO_WRITEV -DNO_DEV_RANDOM -DWOLFSSL_USER_IO -DNO_SHA"
2304-
ENABLED_SLOWMATH="no"
2305-
ENABLED_SINGLETHREADED="yes"
2306-
enable_lowresource=yes
2307-
fi
2308-
23092357

23102358
# lean TLS build (TLS 1.2 client only (no client auth), ECC256, AES128 and SHA256 w/o Shamir)
23112359
AC_ARG_ENABLE([leantls],
@@ -4745,54 +4793,6 @@ then
47454793
fi
47464794

47474795

4748-
# ASN
4749-
4750-
# turn off asn, which means no certs, no rsa, no dsa, no ecc,
4751-
# and no big int (unless dh is on)
4752-
4753-
# turn off ASN if leanpsk on
4754-
if test "$ENABLED_LEANPSK" = "yes"
4755-
then
4756-
enable_asn=no
4757-
fi
4758-
4759-
AC_ARG_ENABLE([asn],
4760-
[AS_HELP_STRING([--enable-asn],[Enable ASN (default: enabled)])],
4761-
[ ENABLED_ASN=$enableval ],
4762-
[ ENABLED_ASN=yes ]
4763-
)
4764-
4765-
for v in `echo $ENABLED_ASN | tr "," " "`
4766-
do
4767-
case $v in
4768-
all)
4769-
# Enable all ASN features
4770-
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASN_ALL"
4771-
ENABLED_ASN=yes
4772-
;;
4773-
template | yes)
4774-
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASN_TEMPLATE"
4775-
ENABLED_ASN=yes
4776-
;;
4777-
original)
4778-
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASN_ORIGINAL"
4779-
ENABLED_ASN=yes
4780-
;;
4781-
nocrypt)
4782-
AM_CFLAGS="$AM_CFLAGS -DNO_ASN_CRYPT"
4783-
enable_pwdbased=no
4784-
;;
4785-
no)
4786-
AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_ASN_CRYPT"
4787-
enable_pwdbased=no
4788-
ENABLED_ASN=no
4789-
;;
4790-
*)
4791-
AC_MSG_ERROR([Invalid asn option. Valid are: all, template/yes, original, nocrypt or no. Seen: $ENABLED_ASN.])
4792-
break;;
4793-
esac
4794-
done
4795-
47964796
if test "$ENABLED_RSA" = "yes" && test "$ENABLED_RSAVFY" = "no" && \
47974797
test "$ENABLED_ASN" = "no" && test "$ENABLED_LOWRESOURCE" = "no"
47984798
then
@@ -8896,7 +8896,7 @@ fi
88968896
# determine if we have key validation mechanism
88978897
if test "x$ENABLED_ECC" != "xno" || test "x$ENABLED_RSA" = "xyes"
88988898
then
8899-
if test "x$ENABLED_ASN" = "xyes"
8899+
if test "$ENABLED_ASN" != "no" && test "$ENABLED_ASN" != "nocrypt"
89008900
then
89018901
ENABLED_PKI="yes"
89028902
fi
@@ -9826,7 +9826,7 @@ AM_CONDITIONAL([BUILD_FASTMATH],[test "x$ENABLED_FASTMATH" = "xyes" || test "x$E
98269826
AM_CONDITIONAL([BUILD_HEAPMATH],[test "x$ENABLED_HEAPMATH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
98279827
AM_CONDITIONAL([BUILD_EXAMPLE_SERVERS],[test "x$ENABLED_EXAMPLES" = "xyes" && test "x$ENABLED_LEANTLS" = "xno"])
98289828
AM_CONDITIONAL([BUILD_EXAMPLE_CLIENTS],[test "x$ENABLED_EXAMPLES" = "xyes"])
9829-
AM_CONDITIONAL([BUILD_EXAMPLE_ASN1],[test "x$ENABLED_EXAMPLES" = "xyes"] && [test "x$ENABLED_ASN_PRINT" = "xyes"] && [test "x$ENABLED_ASN" = "xyes"])
9829+
AM_CONDITIONAL([BUILD_EXAMPLE_ASN1],[test "x$ENABLED_EXAMPLES" = "xyes" && test "x$ENABLED_ASN_PRINT" = "xyes" && test "$ENABLED_ASN" != "no"])
98309830
AM_CONDITIONAL([BUILD_TESTS],[test "x$ENABLED_EXAMPLES" = "xyes"])
98319831
AM_CONDITIONAL([BUILD_THREADED_EXAMPLES],[test "x$ENABLED_SINGLETHREADED" = "xno" && test "x$ENABLED_EXAMPLES" = "xyes" && test "x$ENABLED_LEANTLS" = "xno"])
98329832
AM_CONDITIONAL([BUILD_WOLFCRYPT_TESTS],[test "x$ENABLED_CRYPT_TESTS" = "xyes"])

0 commit comments

Comments
 (0)