Skip to content

Commit e2ed815

Browse files
Enable SCSV check unconditionally
1 parent 63fd322 commit e2ed815

7 files changed

Lines changed: 358 additions & 22 deletions

File tree

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1881,7 +1881,6 @@ endif()
18811881
# - Truncated HMAC
18821882
# - Renegotiation indication
18831883
# - Secure renegotiation
1884-
# - Fallback SCSV
18851884

18861885
add_option(WOLFSSL_OCSP "Enable OCSP (default: disabled)" "no" "yes;no")
18871886
add_option(WOLFSSL_OCSPSTAPLING "Enable OCSP Stapling (default: disabled)" "no" "yes;no")

configure.ac

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,6 @@ then
12501250
test "$enable_savecert" = "" && enable_savecert=yes
12511251
test "$enable_postauth" = "" && enable_postauth=yes
12521252
test "$enable_hrrcookie" = "" && enable_hrrcookie=yes
1253-
test "$enable_fallback_scsv" = "" && enable_fallback_scsv=yes
12541253
test "$enable_crl_monitor" = "" && enable_crl_monitor=yes
12551254
test "$enable_sni" = "" && enable_sni=yes
12561255
test "$enable_maxfragment" = "" && enable_maxfragment=yes
@@ -8313,18 +8312,6 @@ AC_ARG_ENABLE([secure-renegotiation-info],
83138312
)
83148313
83158314
8316-
# Fallback SCSV
8317-
AC_ARG_ENABLE([fallback-scsv],
8318-
[AS_HELP_STRING([--enable-fallback-scsv],[Enable Fallback SCSV (default: disabled)])],
8319-
[ ENABLED_FALLBACK_SCSV=$enableval ],
8320-
[ ENABLED_FALLBACK_SCSV=no ]
8321-
)
8322-
8323-
if test "x$ENABLED_FALLBACK_SCSV" = "xyes"
8324-
then
8325-
AM_CFLAGS="$AM_CFLAGS -DHAVE_FALLBACK_SCSV"
8326-
fi
8327-
83288315
# Exporting Keying Material
83298316
AC_ARG_ENABLE([keying-material],
83308317
[AS_HELP_STRING([--enable-keying-material],[Enable Keying Material Exporters (default: disabled)])],
@@ -12937,7 +12924,6 @@ echo " * Session Ticket: $ENABLED_SESSION_TICKET"
1293712924
echo " * Extended Master Secret: $ENABLED_EXTENDED_MASTER"
1293812925
echo " * Renegotiation Indication: $ENABLED_RENEGOTIATION_INDICATION"
1293912926
echo " * Secure Renegotiation: $ENABLED_SECURE_RENEGOTIATION"
12940-
echo " * Fallback SCSV: $ENABLED_FALLBACK_SCSV"
1294112927
echo " * Keying Material Exporter: $ENABLED_KEYING_MATERIAL"
1294212928
echo " * All TLS Extensions: $ENABLED_TLSX"
1294312929
echo " * S/MIME: $ENABLED_SMIME"

examples/configs/user_settings_all.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ extern "C" {
9696
#define WOLFSSL_POST_HANDSHAKE_AUTH
9797
#define WOLFSSL_SEND_HRR_COOKIE /* Used by DTLS v1.3 */
9898
#define HAVE_ANON /* anon cipher suites */
99-
#define HAVE_FALLBACK_SCSV /* TLS_FALLBACK_SCSV */
10099
#define WOLFSSL_EARLY_DATA
101100
#define HAVE_SERVER_RENEGOTIATION_INFO
102101

src/internal.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
* WOLFSSL_TEST_APPLE_NATIVE_CERT_VALIDATION:
6161
* Testing mode for Apple cert validation default: off
6262
* HAVE_DANE: DNS-based cert validation (DNSSEC) default: off
63-
* HAVE_FALLBACK_SCSV: TLS Fallback SCSV anti-downgrade default: off
6463
* WOLFSSL_ACERT: Attribute certificate support default: off
6564
* WOLFSSL_DEBUG_CERTS: Debug logging for cert processing default: off
6665
* WOLFSSL_HOSTNAME_VERIFY_ALT_NAME_ONLY:
@@ -38463,6 +38462,7 @@ static int AddPSKtoPreMasterSecret(WOLFSSL* ssl)
3846338462
word32 begin = i;
3846438463
int ret = 0;
3846538464
byte lesserVersion;
38465+
byte maxMinor;
3846638466

3846738467
WOLFSSL_START(WC_FUNC_CLIENT_HELLO_DO);
3846838468
WOLFSSL_ENTER("DoClientHello");
@@ -38526,6 +38526,14 @@ static int AddPSKtoPreMasterSecret(WOLFSSL* ssl)
3852638526
if (pv.major == SSLv3_MAJOR && pv.minor >= TLSv1_3_MINOR)
3852738527
pv.minor = TLSv1_2_MINOR;
3852838528

38529+
/* Snapshot the server's effective max version before the downgrade
38530+
* logic below lowers ssl->version.minor to the negotiated version.
38531+
* This honors runtime restrictions (e.g. SSL_OP_NO_TLSv1_3 on a
38532+
* TLS 1.3 capable method), unlike ssl->ctx->method->version.minor.
38533+
* Used by the TLS_FALLBACK_SCSV check, which runs after the cipher
38534+
* suites are parsed (and thus after ssl->version.minor is mutated). */
38535+
maxMinor = ssl->version.minor;
38536+
3852938537
lesserVersion = (byte)(!ssl->options.dtls &&
3853038538
ssl->version.minor > pv.minor);
3853138539
lesserVersion |= ssl->options.dtls &&ssl->version.minor < pv.minor;
@@ -38810,18 +38818,19 @@ static int AddPSKtoPreMasterSecret(WOLFSSL* ssl)
3881038818
}
3881138819
}
3881238820
#endif /* HAVE_SERVER_RENEGOTIATION_INFO */
38813-
#if defined(HAVE_FALLBACK_SCSV) || defined(OPENSSL_ALL)
38814-
/* check for TLS_FALLBACK_SCSV suite */
38821+
/* Check for TLS_FALLBACK_SCSV (RFC 7507). Always enforced. */
3881538822
if (FindSuite(ssl->clSuites, TLS_FALLBACK_SCSV, 0) >= 0) {
3881638823
WOLFSSL_MSG("Found Fallback SCSV");
38817-
if (ssl->ctx->method->version.minor > pv.minor) {
38824+
/* Abort if the server supports a version higher than the client
38825+
* offered. DTLS version minors decrease as the version increases. */
38826+
if ((!ssl->options.dtls && maxMinor > pv.minor) ||
38827+
(ssl->options.dtls && maxMinor < pv.minor)) {
3881838828
WOLFSSL_MSG("Client trying to connect with lesser version");
3881938829
SendAlert(ssl, alert_fatal, inappropriate_fallback);
3882038830
ret = VERSION_ERROR;
3882138831
goto out;
3882238832
}
3882338833
}
38824-
#endif
3882538834

3882638835
i += ssl->clSuites->suiteSz;
3882738836
ssl->clSuites->hashSigAlgoSz = 0;

0 commit comments

Comments
 (0)