diff --git a/configure.ac b/configure.ac index 729b8dc65..55677749f 100644 --- a/configure.ac +++ b/configure.ac @@ -4171,6 +4171,14 @@ then AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SECURE_RENEGOTIATION -DHAVE_SERVER_RENEGOTIATION_INFO" fi +# Secure Renegotiation Info +AC_ARG_ENABLE([secure-renegotiation-info], + [AS_HELP_STRING([--enable-secure-renegotiation-info],[Enable Secure Renegotiation info extension (default: enabled)])], + [ ENABLED_SECURE_RENEGOTIATION_INFO=$enableval ], + [ ENABLED_SECURE_RENEGOTIATION_INFO=yes ] + ) + + # Fallback SCSV AC_ARG_ENABLE([fallback-scsv], [AS_HELP_STRING([--enable-fallback-scsv],[Enable Fallback SCSV (default: disabled)])], @@ -7153,8 +7161,21 @@ AS_IF([test "x$ENABLED_WOLFSSH" = "xyes"],[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSL_W if test "x$ENABLED_CERTS" = "xno" || test "x$ENABLED_LEANPSK" = "xyes" || test "x$ENABLED_ASN" = "xno"; then AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS" + ENABLED_ASN=no fi +# only allow secure renegotiation info with TLSV12 and ASN +if test "x$ENABLED_ASN" = "xno" || \ + test "x$ENABLED_TLSV12" = "xno" || \ + test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"; then + ENABLED_SECURE_RENEGOTIATION_INFO="no" +fi + +if test "x$ENABLED_SECURE_RENEGOTIATION_INFO" = "xyes"; then + AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SERVER_RENEGOTIATION_INFO" +fi + + # Depricated Algorithm Handling if test "$ENABLED_ARC4" = "yes" diff --git a/src/internal.c b/src/internal.c index 7a0500ede..d8ecfdcc4 100644 --- a/src/internal.c +++ b/src/internal.c @@ -31371,7 +31371,6 @@ static int DefTicketEncCb(WOLFSSL* ssl, byte key_name[WOLFSSL_TICKET_NAME_SZ], #ifndef WOLFSSL_NO_TLS12 #if defined(HAVE_SECURE_RENEGOTIATION) && \ - defined(HAVE_SERVER_RENEGOTIATION_INFO) && \ !defined(WOLFSSL_NO_SERVER) /* handle generation of server's hello_request (0) */ @@ -31440,7 +31439,7 @@ static int DefTicketEncCb(WOLFSSL* ssl, byte key_name[WOLFSSL_TICKET_NAME_SZ], return ret; } -#endif /* HAVE_SECURE_RENEGOTIATION && HAVE_SERVER_RENEGOTIATION_INFO */ +#endif /* HAVE_SECURE_RENEGOTIATION && !WOLFSSL_NO_SERVER */ #ifdef WOLFSSL_DTLS /* handle generation of DTLS hello_verify_request (3) */ diff --git a/src/ssl.c b/src/ssl.c index bb38e5422..b9d7087fa 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -2863,7 +2863,7 @@ int wolfSSL_ALPN_FreePeerProtocol(WOLFSSL* ssl, char **list) #endif /* HAVE_ALPN */ /* Secure Renegotiation */ -#ifdef HAVE_SECURE_RENEGOTIATION +#ifdef HAVE_SERVER_RENEGOTIATION_INFO /* user is forcing ability to use secure renegotiation, we discourage it */ int wolfSSL_UseSecureRenegotiation(WOLFSSL* ssl) @@ -2954,7 +2954,7 @@ static int _Rehandshake(WOLFSSL* ssl) ssl->secure_renegotiation->cache_status = SCR_CACHE_NEEDED; -#if !defined(NO_WOLFSSL_SERVER) && defined(HAVE_SERVER_RENEGOTIATION_INFO) +#if !defined(NO_WOLFSSL_SERVER) && defined(HAVE_SECURE_RENEGOTIATION) if (ssl->options.side == WOLFSSL_SERVER_END) { ret = SendHelloRequest(ssl); if (ret != 0) { @@ -3041,7 +3041,7 @@ long wolfSSL_SSL_get_secure_renegotiation_support(WOLFSSL* ssl) return ssl->secure_renegotiation->enabled; } -#endif /* HAVE_SECURE_RENEGOTIATION */ +#endif /* HAVE_SECURE_RENEGOTIATION_INFO */ #if defined(HAVE_SESSION_TICKET) /* Session Ticket */ diff --git a/wolfssl/internal.h b/wolfssl/internal.h index 529b28a24..046db8e98 100644 --- a/wolfssl/internal.h +++ b/wolfssl/internal.h @@ -2839,7 +2839,7 @@ struct WOLFSSL_CTX { byte dhKeyTested:1; /* Set when key has been tested. */ #endif #endif -#ifdef HAVE_SECURE_RENEGOTIATION +#if defined(HAVE_SECURE_RENEGOTIATION) || defined(HAVE_SERVER_RENEGOTIATION_INFO) byte useSecureReneg:1; /* when set will set WOLFSSL objects generated to enable */ #endif #ifdef HAVE_ENCRYPT_THEN_MAC @@ -4760,7 +4760,7 @@ WOLFSSL_LOCAL int SendCertificateRequest(WOLFSSL*); WOLFSSL_LOCAL int CreateOcspResponse(WOLFSSL*, OcspRequest**, buffer*); #endif #if defined(HAVE_SECURE_RENEGOTIATION) && \ - defined(HAVE_SERVER_RENEGOTIATION_INFO) + !defined(WOLFSSL_NO_SERVER) WOLFSSL_LOCAL int SendHelloRequest(WOLFSSL*); #endif WOLFSSL_LOCAL int SendCertificateStatus(WOLFSSL*); diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index 4e899b2d8..461fd192a 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -3710,7 +3710,7 @@ WOLFSSL_API int wolfSSL_NoKeyShares(WOLFSSL* ssl); /* Secure Renegotiation */ -#ifdef HAVE_SECURE_RENEGOTIATION +#if defined(HAVE_SECURE_RENEGOTIATION) || defined(HAVE_SERVER_RENEGOTIATION_INFO) WOLFSSL_API int wolfSSL_UseSecureRenegotiation(WOLFSSL* ssl); WOLFSSL_API int wolfSSL_CTX_UseSecureRenegotiation(WOLFSSL_CTX* ctx); diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index b0e10576b..c68b17915 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -2579,6 +2579,14 @@ extern void uITRON4_free(void *p) ; */ #endif +/* if secure renegotiation is enabled, make sure server info is enabled */ +#if !defined(HAVE_RENEGOTIATION_INDICATION) && \ + !defined(HAVE_SERVER_RENEGOTIATION_INFO) && \ + defined(HAVE_SECURE_RENEGOTIATION) && \ + !defined(NO_WOLFSSL_SERVER) + #define HAVE_SERVER_RENEGOTIATION_INFO +#endif + /* Crypto callbacks should enable hash flag support */ #if defined(WOLF_CRYPTO_CB) && !defined(WOLFSSL_HASH_FLAGS) /* FIPS v1 and v2 do not support hash flags, so do not allow it with