Return TLS 1.3 draft version in ServerHello

This commit is contained in:
Sean Parkinson
2018-06-07 22:01:42 +10:00
parent b63d3173a1
commit 020b69aba0
2 changed files with 20 additions and 4 deletions

View File

@@ -4751,8 +4751,18 @@ static int TLSX_SupportedVersions_Write(void* data, byte* output,
}
#ifndef WOLFSSL_TLS13_DRAFT_18
else if (msgType == server_hello || msgType == hello_retry_request) {
output[0] = ssl->version.major;
output[1] = ssl->version.minor;
#ifndef WOLFSSL_TLS13_FINAL
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;
}

View File

@@ -3713,8 +3713,14 @@ static int RestartHandshakeHashWithCookie(WOLFSSL* ssl, Cookie* cookie)
hrrIdx += 2;
c16toa(OPAQUE16_LEN, hrr + hrrIdx);
hrrIdx += 2;
hrr[hrrIdx++] = ssl->version.major;
hrr[hrrIdx++] = ssl->version.minor;
/* TODO: [TLS13] Change to ssl->version.major and minor once final. */
#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
/* Mandatory Cookie Extension */
c16toa(TLSX_COOKIE, hrr + hrrIdx);