Merge pull request #1607 from SparkiDev/tls13_interop_ver

Return TLS 1.3 draft version in ServerHello
This commit is contained in:
toddouska
2018-06-12 08:30:48 -07:00
committed by GitHub
2 changed files with 20 additions and 4 deletions

View File

@@ -5211,8 +5211,18 @@ static int TLSX_SupportedVersions_Write(void* data, byte* output,
} }
#ifndef WOLFSSL_TLS13_DRAFT_18 #ifndef WOLFSSL_TLS13_DRAFT_18
else if (msgType == server_hello || msgType == hello_retry_request) { else if (msgType == server_hello || msgType == hello_retry_request) {
output[0] = ssl->version.major; #ifndef WOLFSSL_TLS13_FINAL
output[1] = ssl->version.minor; if (ssl->version.major == SSLv3_MAJOR &&
ssl->version.minor == TLSv1_3_MINOR) {
output[0] = TLS_DRAFT_MAJOR;
output[1] = TLS_DRAFT_MINOR;
}
else
#endif
{
output[0] = ssl->version.major;
output[1] = ssl->version.minor;
}
*pSz += OPAQUE16_LEN; *pSz += OPAQUE16_LEN;
} }

View File

@@ -3703,8 +3703,14 @@ static int RestartHandshakeHashWithCookie(WOLFSSL* ssl, Cookie* cookie)
hrrIdx += 2; hrrIdx += 2;
c16toa(OPAQUE16_LEN, hrr + hrrIdx); c16toa(OPAQUE16_LEN, hrr + hrrIdx);
hrrIdx += 2; hrrIdx += 2;
hrr[hrrIdx++] = ssl->version.major; /* TODO: [TLS13] Change to ssl->version.major and minor once final. */
hrr[hrrIdx++] = ssl->version.minor; #ifdef WOLFSSL_TLS13_FINAL
hrr[hrrIdx++] = ssl->version.major;
hrr[hrrIdx++] = ssl->version.minor;
#else
hrr[hrrIdx++] = TLS_DRAFT_MAJOR;
hrr[hrrIdx++] = TLS_DRAFT_MINOR;
#endif
#endif #endif
/* Mandatory Cookie Extension */ /* Mandatory Cookie Extension */
c16toa(TLSX_COOKIE, hrr + hrrIdx); c16toa(TLSX_COOKIE, hrr + hrrIdx);