Skip to content

Commit 924887b

Browse files
committed
configure.ac and wolfssl/wolfcrypt/settings.h: implement --enable-experimental and add a WOLFSSL_EXPERIMENTAL_SETTINGS gate, and refactor "EXPERIMENTAL" features (all pq) to note and enforce requirement for --enable-experimental and WOLFSSL_EXPERIMENTAL_SETTINGS.
1 parent 3728cd3 commit 924887b

File tree

2 files changed

+38
-5
lines changed

2 files changed

+38
-5
lines changed

configure.ac

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,18 @@ else
102102
REPRODUCIBLE_BUILD_DEFAULT=no
103103
fi
104104

105+
# Allow experimental settings
106+
AC_ARG_ENABLE([experimental],
107+
[AS_HELP_STRING([--enable-experimental],[Allow experimental settings in the configuration (default: disabled)])],
108+
[ ENABLED_EXPERIMENTAL=$enableval ],
109+
[ ENABLED_EXPERIMENTAL=no ]
110+
)
111+
if test "$ENABLED_EXPERIMENTAL" = "yes"
112+
then
113+
AS_IF([ test "$ENABLED_DISTRO" = "yes" && test "$ENABLED_EXPERIMENTAL" = "yes" ],[ AC_MSG_ERROR([--enable-distro and --enable-experimental are mutually exclusive.]) ])
114+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_EXPERIMENTAL_SETTINGS"
115+
AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_EXPERIMENTAL_SETTINGS"
116+
fi
105117

106118
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stddef.h time.h sys/ioctl.h sys/socket.h sys/time.h errno.h sys/un.h])
107119
AC_CHECK_LIB([network],[socket])
@@ -1057,8 +1069,9 @@ fi
10571069
ENABLED_LIBOQS="no"
10581070
tryliboqsdir=""
10591071
AC_ARG_WITH([liboqs],
1060-
[AS_HELP_STRING([--with-liboqs=PATH],[Path to liboqs install (default /usr/local) EXPERIMENTAL!])],
1072+
[AS_HELP_STRING([--with-liboqs=PATH],[Path to liboqs install (default /usr/local) (requires --enable-experimental)])],
10611073
[
1074+
AS_IF([ test "$ENABLED_EXPERIMENTAL" != "yes" ],[ AC_MSG_ERROR([LIBOQS requires --enable-experimental.]) ])
10621075
AC_MSG_CHECKING([for liboqs])
10631076
LIBS="$LIBS -loqs"
10641077
@@ -1105,7 +1118,7 @@ AC_ARG_WITH([liboqs],
11051118
# - SHA3, Shake128 and Shake256, or
11061119
# - SHA256, SHA512, AES-CTR
11071120
AC_ARG_ENABLE([kyber],
1108-
[AS_HELP_STRING([--enable-kyber],[Enable KYBER (default: disabled)])],
1121+
[AS_HELP_STRING([--enable-kyber],[Enable KYBER (requires --enable-experimental) (default: disabled)])],
11091122
[ ENABLED_KYBER=$enableval ],
11101123
[ ENABLED_KYBER=no ]
11111124
)
@@ -1141,6 +1154,7 @@ done
11411154

11421155
if test "$ENABLED_KYBER" != "no"
11431156
then
1157+
AS_IF([ test "$ENABLED_EXPERIMENTAL" != "yes" ],[ AC_MSG_ERROR([KYBER requires --enable-experimental.]) ])
11441158
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_KYBER"
11451159
# Use liboqs if specified.
11461160
if test "$ENABLED_LIBOQS" = "no"; then
@@ -1220,8 +1234,9 @@ fi
12201234
ENABLED_LIBXMSS="no"
12211235
trylibxmssdir=""
12221236
AC_ARG_WITH([libxmss],
1223-
[AS_HELP_STRING([--with-libxmss=PATH],[PATH to xmss-reference root dir. EXPERIMENTAL!])],
1237+
[AS_HELP_STRING([--with-libxmss=PATH],[PATH to xmss-reference root dir. (requires --enable-experimental)!])],
12241238
[
1239+
AS_IF([ test "$ENABLED_EXPERIMENTAL" != "yes" ],[ AC_MSG_ERROR([libxmss requires --enable-experimental.]) ])
12251240
AC_MSG_CHECKING([for libxmss])
12261241
12271242
trylibxmssdir=$withval
@@ -1318,8 +1333,9 @@ fi
13181333
ENABLED_LIBLMS="no"
13191334
tryliblmsdir=""
13201335
AC_ARG_WITH([liblms],
1321-
[AS_HELP_STRING([--with-liblms=PATH],[PATH to hash-sigs LMS/HSS install (default /usr/local) EXPERIMENTAL!])],
1336+
[AS_HELP_STRING([--with-liblms=PATH],[PATH to hash-sigs LMS/HSS install (default /usr/local) (requires --enable-experimental)!])],
13221337
[
1338+
AS_IF([ test "$ENABLED_EXPERIMENTAL" != "yes" ],[ AC_MSG_ERROR([liblms requires --enable-experimental.]) ])
13231339
AC_MSG_CHECKING([for liblms])
13241340
13251341
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <hss.h>]], [[ param_set_t lm_type; param_set_t lm_ots_type; hss_get_public_key_len(4, &lm_type, &lm_ots_type); ]])], [ liblms_linked=yes ],[ liblms_linked=no ])
@@ -8185,11 +8201,13 @@ AC_ARG_ENABLE([sys-ca-certs],
81858201
)
81868202

81878203
AC_ARG_ENABLE([dual-alg-certs],
8188-
[AS_HELP_STRING([--enable-dual-alg-certs],[Enable support for dual key/signature certificates in TLS 1.3 as defined in X9.146 (default: disabled)])],
8204+
[AS_HELP_STRING([--enable-dual-alg-certs],[Enable support for dual key/signature certificates in TLS 1.3 as defined in X9.146 (requires --enable-experimental) (default: disabled)])],
81898205
[ ENABLED_DUAL_ALG_CERTS=$enableval ],
81908206
[ ENABLED_DUAL_ALG_CERTS=no ]
81918207
)
81928208

8209+
AS_IF([ test "$ENABLED_DUAL_ALG_CERTS" != "no" && test "$ENABLED_EXPERIMENTAL" != "yes" ],[ AC_MSG_ERROR([dual-alg-certs requires --enable-experimental.]) ])
8210+
81938211
# check if should run the trusted peer certs test
81948212
# (for now checking both C_FLAGS and C_EXTRA_FLAGS)
81958213
AS_CASE(["$CFLAGS $CPPFLAGS"],[*'WOLFSSL_TRUST_PEER_CERT'*],[ENABLED_TRUSTED_PEER_CERT=yes])
@@ -9430,6 +9448,12 @@ echo " * SIMD+FPU enable as flags: $ASFLAGS_FPUSIMD_ENABLE" && \
94309448
echo " * Linux kernel module PIE: $ENABLED_LINUXKM_PIE"
94319449
echo " * Linux kernel module bench: $ENABLED_LINUXKM_BENCHMARKS"
94329450

9451+
if test "$ENABLED_EXPERIMENTAL" = "yes"
9452+
then
9453+
echo " * Experimental settings: Allowed"
9454+
else
9455+
echo " * Experimental settings: Forbidden"
9456+
fi
94339457
echo " * Debug enabled: $ax_enable_debug"
94349458
echo " * Coverage enabled: $ax_enable_coverage"
94359459
echo " * Warnings as failure: $ac_cv_warnings_as_errors"

wolfssl/wolfcrypt/settings.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3262,6 +3262,15 @@ extern void uITRON4_free(void *p) ;
32623262
#define WOLFSSL_NO_KYBER1024
32633263
#endif
32643264

3265+
#if (defined(HAVE_LIBOQS) || \
3266+
defined(WOLFSSL_WC_KYBER) || \
3267+
defined(HAVE_LIBXMSS) || \
3268+
defined(HAVE_LIBLMS) || \
3269+
defined(WOLFSSL_DUAL_ALG_CERTS)) && \
3270+
!defined(WOLFSSL_EXPERIMENTAL_SETTINGS)
3271+
#error Experimental settings without WOLFSSL_EXPERIMENTAL_SETTINGS
3272+
#endif
3273+
32653274
#if defined(HAVE_PQC) && !defined(HAVE_LIBOQS) && !defined(HAVE_PQM4) && \
32663275
!defined(WOLFSSL_HAVE_KYBER)
32673276
#error Please do not define HAVE_PQC yourself.

0 commit comments

Comments
 (0)