diff --git a/configure.ac b/configure.ac index 09bfa9094..8a5a9cd42 100644 --- a/configure.ac +++ b/configure.ac @@ -100,6 +100,9 @@ else REPRODUCIBLE_BUILD_DEFAULT=no fi +# Fail when an option is passed that is not recognized +m4_divert_once([DEFAULTS], [enable_option_checking=fatal]) + # Allow experimental settings AC_ARG_ENABLE([experimental], [AS_HELP_STRING([--enable-experimental],[Allow experimental settings in the configuration (default: disabled)])], @@ -3757,13 +3760,13 @@ then fi # ECC Minimum Key Size -ENABLED_ECCMINSZ=224 AC_ARG_WITH([eccminsz], [AS_HELP_STRING([--with-eccminsz=BITS],[Sets the ECC minimum key size (default: 224 bits)])], [ ENABLED_ECCMINSZ=$withval AM_CFLAGS="$AM_CFLAGS -DECC_MIN_KEY_SZ=$withval" - ] + ], + [ ENABLED_ECCMINSZ=224 ] ) # Compressed Key @@ -8324,7 +8327,7 @@ fi AC_ARG_WITH([max-ecc-bits], [AS_HELP_STRING([--with-max-ecc-bits=number],[number of bits to support for ECC algorithms])], [WITH_MAX_ECC_BITS=$withval], - [WITH_MAX_ECC_BITS="$DEFAULT_MAX_ECC_BITS"]) + ) if test -n "$WITH_MAX_ECC_BITS"; then if test "$WITH_MAX_ECC_BITS" -lt 112 -o "$WITH_MAX_ECC_BITS" -gt 1024; then @@ -10044,3 +10047,10 @@ if test "$MINGW_LIB_WARNING" = "yes" then AC_MSG_WARN([Building with shared and static library at the same time on this system may cause export/import problems when using non contemporary GNU tools.]) fi + +if test -n "$WITH_MAX_ECC_BITS"; then + if test "$WITH_MAX_ECC_BITS" -lt "$ENABLED_ECCMINSZ"; then + AC_MSG_ERROR([--with-max-ecc-bits argument ($WITH_MAX_ECC_BITS) must be greater than --with-eccminsz argument ($ENABLED_ECCMINSZ)]) + fi +fi + diff --git a/wolfcrypt/src/kdf.c b/wolfcrypt/src/kdf.c index 9fc56762b..30046f533 100644 --- a/wolfcrypt/src/kdf.c +++ b/wolfcrypt/src/kdf.c @@ -571,7 +571,7 @@ int wc_PRF_TLS(byte* digest, word32 digLen, const byte* secret, word32 secLen, (void)heap; /* okmLen (2) + protocol|label len (1) + info len(1) + protocollen + * labellen + infolen */ - len = (size_t)4 + protocolLen + labelLen + infoLen; + len = 4U + protocolLen + labelLen + infoLen; data = (byte*)XMALLOC(len, heap, DYNAMIC_TYPE_TMP_BUFFER); if (data == NULL)