Enable TLS v1.3 by default. Remove old TLS v1.3 draft build support.
This commit is contained in:
parent
976db2545d
commit
cd1c2d5fae
72
configure.ac
72
configure.ac
@ -287,78 +287,13 @@ then
|
||||
fi
|
||||
|
||||
|
||||
# TLS v1.3 Draft 18
|
||||
AC_ARG_ENABLE([tls13-draft18],
|
||||
[AS_HELP_STRING([--enable-tls13-draft18],[Enable wolfSSL TLS v1.3 Draft 18 (default: disabled)])],
|
||||
[ ENABLED_TLS13_DRAFT18=$enableval ],
|
||||
[ ENABLED_TLS13_DRAFT18=no ]
|
||||
)
|
||||
if test "$ENABLED_TLS13_DRAFT18" = "yes"
|
||||
then
|
||||
AM_CFLAGS="-DWOLFSSL_TLS13_DRAFT -DWOLFSSL_TLS13_DRAFT_18 $AM_CFLAGS"
|
||||
fi
|
||||
|
||||
|
||||
# TLS v1.3 Draft 22
|
||||
AC_ARG_ENABLE([tls13-draft22],
|
||||
[AS_HELP_STRING([--enable-tls13-draft22],[Enable wolfSSL TLS v1.3 Draft 22 (default: disabled)])],
|
||||
[ ENABLED_TLS13_DRAFT22=$enableval ],
|
||||
[ ENABLED_TLS13_DRAFT22=no ]
|
||||
)
|
||||
if test "$ENABLED_TLS13_DRAFT22" = "yes"
|
||||
then
|
||||
AM_CFLAGS="-DWOLFSSL_TLS13_DRAFT -DWOLFSSL_TLS13_DRAFT_22 $AM_CFLAGS"
|
||||
fi
|
||||
|
||||
|
||||
# TLS v1.3 Draft 23
|
||||
AC_ARG_ENABLE([tls13-draft23],
|
||||
[AS_HELP_STRING([--enable-tls13-draft23],[Enable wolfSSL TLS v1.3 Draft 23 (default: disabled)])],
|
||||
[ ENABLED_TLS13_DRAFT23=$enableval ],
|
||||
[ ENABLED_TLS13_DRAFT23=no ]
|
||||
)
|
||||
if test "$ENABLED_TLS13_DRAFT23" = "yes"
|
||||
then
|
||||
AM_CFLAGS="-DWOLFSSL_TLS13_DRAFT -DWOLFSSL_TLS13_DRAFT_23 $AM_CFLAGS"
|
||||
fi
|
||||
|
||||
|
||||
# TLS v1.3 Draft 26
|
||||
AC_ARG_ENABLE([tls13-draft26],
|
||||
[AS_HELP_STRING([--enable-tls13-draft26],[Enable wolfSSL TLS v1.3 Draft 26 (default: disabled)])],
|
||||
[ ENABLED_TLS13_DRAFT26=$enableval ],
|
||||
[ ENABLED_TLS13_DRAFT26=no ]
|
||||
)
|
||||
if test "$ENABLED_TLS13_DRAFT26" = "yes"
|
||||
then
|
||||
AM_CFLAGS="-DWOLFSSL_TLS13_DRAFT -DWOLFSSL_TLS13_DRAFT_26 $AM_CFLAGS"
|
||||
fi
|
||||
|
||||
|
||||
# TLS v1.3 Draft 28
|
||||
AC_ARG_ENABLE([tls13-draft28],
|
||||
[AS_HELP_STRING([--enable-tls13-draft28],[Enable wolfSSL TLS v1.3 Draft 28 (default: disabled)])],
|
||||
[ ENABLED_TLS13_DRAFT28=$enableval ],
|
||||
[ ENABLED_TLS13_DRAFT28=no ]
|
||||
)
|
||||
if test "$ENABLED_TLS13_DRAFT28" = "yes"
|
||||
then
|
||||
AM_CFLAGS="-DWOLFSSL_TLS13_DRAFT $AM_CFLAGS"
|
||||
fi
|
||||
|
||||
|
||||
# TLS v1.3
|
||||
AC_ARG_ENABLE([tls13],
|
||||
[AS_HELP_STRING([--enable-tls13],[Enable wolfSSL TLS v1.3 (default: disabled)])],
|
||||
[ ENABLED_TLS13=$enableval ],
|
||||
[ ENABLED_TLS13=no ]
|
||||
[ ENABLED_TLS13=yes ]
|
||||
)
|
||||
|
||||
if test "$ENABLED_TLS13_DRAFT18" = "yes" || test "$ENABLED_TLS13_DRAFT22" = "yes" || test "$ENABLED_TLS13_DRAFT23" = "yes" || test "$ENABLED_TLS13_DRAFT26" = "yes" || test "$ENABLED_TLS13_DRAFT28" = "yes"
|
||||
then
|
||||
ENABLED_TLS13="yes"
|
||||
fi
|
||||
|
||||
if test "$ENABLED_TLS13" = "yes"
|
||||
then
|
||||
AM_CFLAGS="-DWOLFSSL_TLS13 -DHAVE_TLS_EXTENSIONS -DHAVE_SUPPORTED_CURVES $AM_CFLAGS"
|
||||
@ -5548,11 +5483,6 @@ echo " * Old TLS Versions: $ENABLED_OLD_TLS"
|
||||
echo " * SSL version 3.0: $ENABLED_SSLV3"
|
||||
echo " * TLS v1.0: $ENABLED_TLSV10"
|
||||
echo " * TLS v1.3: $ENABLED_TLS13"
|
||||
echo " * TLS v1.3 Draft 18: $ENABLED_TLS13_DRAFT18"
|
||||
echo " * TLS v1.3 Draft 22: $ENABLED_TLS13_DRAFT22"
|
||||
echo " * TLS v1.3 Draft 23: $ENABLED_TLS13_DRAFT23"
|
||||
echo " * TLS v1.3 Draft 26: $ENABLED_TLS13_DRAFT26"
|
||||
echo " * TLS v1.3 Draft 28: $ENABLED_TLS13_DRAFT28"
|
||||
echo " * Post-handshake Auth: $ENABLED_TLS13_POST_AUTH"
|
||||
echo " * Early Data: $ENABLED_TLS13_EARLY_DATA"
|
||||
echo " * Send State in HRR Cookie: $ENABLED_SEND_HRR_COOKIE"
|
||||
|
@ -7772,11 +7772,7 @@ static void AddRecordHeader(byte* output, word32 length, byte type, WOLFSSL* ssl
|
||||
rl->pvMajor = ssl->version.major; /* type and version same in each */
|
||||
#ifdef WOLFSSL_TLS13
|
||||
if (IsAtLeastTLSv1_3(ssl->version)) {
|
||||
#ifdef WOLFSSL_TLS13_DRAFT_18
|
||||
rl->pvMinor = TLSv1_MINOR;
|
||||
#else
|
||||
rl->pvMinor = TLSv1_2_MINOR;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@ -8303,11 +8299,7 @@ static int GetRecordHeader(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
|
||||
#else
|
||||
if (rh->pvMajor != ssl->version.major ||
|
||||
(rh->pvMinor != ssl->version.minor &&
|
||||
#ifdef WOLFSSL_TLS13_DRAFT_18
|
||||
(!IsAtLeastTLSv1_3(ssl->version) || rh->pvMinor != TLSv1_MINOR)
|
||||
#else
|
||||
(!IsAtLeastTLSv1_3(ssl->version) || rh->pvMinor != TLSv1_2_MINOR)
|
||||
#endif
|
||||
))
|
||||
#endif
|
||||
{
|
||||
@ -14880,13 +14872,9 @@ int ProcessReply(WOLFSSL* ssl)
|
||||
/* decrypt message */
|
||||
case decryptMessage:
|
||||
|
||||
#if !defined(WOLFSSL_TLS13) || defined(WOLFSSL_TLS13_DRAFT_18)
|
||||
if (IsEncryptionOn(ssl, 0) && ssl->keys.decryptedCur == 0)
|
||||
#else
|
||||
if (IsEncryptionOn(ssl, 0) && ssl->keys.decryptedCur == 0 &&
|
||||
(!IsAtLeastTLSv1_3(ssl->version) ||
|
||||
ssl->curRL.type != change_cipher_spec))
|
||||
#endif
|
||||
{
|
||||
bufferStatic* in = &ssl->buffers.inputBuffer;
|
||||
|
||||
@ -14949,20 +14937,11 @@ int ProcessReply(WOLFSSL* ssl)
|
||||
else
|
||||
{
|
||||
#ifdef WOLFSSL_TLS13
|
||||
#if defined(WOLFSSL_TLS13_DRAFT_18) || \
|
||||
defined(WOLFSSL_TLS13_DRAFT_22) || \
|
||||
defined(WOLFSSL_TLS13_DRAFT_23)
|
||||
ret = DecryptTls13(ssl,
|
||||
in->buffer + in->idx,
|
||||
in->buffer + in->idx,
|
||||
ssl->curSize, NULL, 0);
|
||||
#else
|
||||
ret = DecryptTls13(ssl,
|
||||
in->buffer + in->idx,
|
||||
in->buffer + in->idx,
|
||||
ssl->curSize,
|
||||
(byte*)&ssl->curRL, RECORD_HEADER_SZ);
|
||||
#endif
|
||||
#else
|
||||
ret = DECRYPT_ERROR;
|
||||
#endif /* WOLFSSL_TLS13 */
|
||||
@ -15033,13 +15012,9 @@ int ProcessReply(WOLFSSL* ssl)
|
||||
/* verify digest of message */
|
||||
case verifyMessage:
|
||||
|
||||
#if !defined(WOLFSSL_TLS13) || defined(WOLFSSL_TLS13_DRAFT_18)
|
||||
if (IsEncryptionOn(ssl, 0) && ssl->keys.decryptedCur == 0)
|
||||
#else
|
||||
if (IsEncryptionOn(ssl, 0) && ssl->keys.decryptedCur == 0 &&
|
||||
(!IsAtLeastTLSv1_3(ssl->version) ||
|
||||
ssl->curRL.type != change_cipher_spec))
|
||||
#endif
|
||||
{
|
||||
if (!atomicUser
|
||||
#if defined(HAVE_ENCRYPT_THEN_MAC) && !defined(WOLFSSL_AEAD_ONLY)
|
||||
@ -15200,12 +15175,6 @@ int ProcessReply(WOLFSSL* ssl)
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_TLS13
|
||||
#ifdef WOLFSSL_TLS13_DRAFT_18
|
||||
if (IsAtLeastTLSv1_3(ssl->version)) {
|
||||
SendAlert(ssl, alert_fatal, illegal_parameter);
|
||||
return UNKNOWN_RECORD_TYPE;
|
||||
}
|
||||
#else
|
||||
if (IsAtLeastTLSv1_3(ssl->version)) {
|
||||
word32 i = ssl->buffers.inputBuffer.idx;
|
||||
if (ssl->options.handShakeState == HANDSHAKE_DONE) {
|
||||
@ -15227,7 +15196,6 @@ int ProcessReply(WOLFSSL* ssl)
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef WOLFSSL_NO_TLS12
|
||||
@ -27546,9 +27514,7 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
|
||||
#ifdef WOLFSSL_TLS13
|
||||
word32 ageAdd; /* Obfuscation of age */
|
||||
word16 namedGroup; /* Named group used */
|
||||
#ifndef WOLFSSL_TLS13_DRAFT_18
|
||||
TicketNonce ticketNonce; /* Ticket nonce */
|
||||
#endif
|
||||
#ifdef WOLFSSL_EARLY_DATA
|
||||
word32 maxEarlyDataSz; /* Max size of early data */
|
||||
#endif
|
||||
@ -27604,10 +27570,8 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
|
||||
it.timestamp = TimeNowInMilliseconds();
|
||||
/* Resumption master secret. */
|
||||
XMEMCPY(it.msecret, ssl->session.masterSecret, SECRET_LEN);
|
||||
#ifndef WOLFSSL_TLS13_DRAFT_18
|
||||
XMEMCPY(&it.ticketNonce, &ssl->session.ticketNonce,
|
||||
sizeof(TicketNonce));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -27756,10 +27720,8 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
|
||||
#endif
|
||||
/* Resumption master secret. */
|
||||
XMEMCPY(ssl->session.masterSecret, it->msecret, SECRET_LEN);
|
||||
#ifndef WOLFSSL_TLS13_DRAFT_18
|
||||
XMEMCPY(&ssl->session.ticketNonce, &it->ticketNonce,
|
||||
sizeof(TicketNonce));
|
||||
#endif
|
||||
ssl->session.namedGroup = it->namedGroup;
|
||||
#endif
|
||||
}
|
||||
|
24
src/ssl.c
24
src/ssl.c
@ -12517,10 +12517,8 @@ static int GetDeepCopySession(WOLFSSL* ssl, WOLFSSL_SESSION* copyFrom)
|
||||
copyInto->namedGroup = copyFrom->namedGroup;
|
||||
copyInto->ticketSeen = copyFrom->ticketSeen;
|
||||
copyInto->ticketAdd = copyFrom->ticketAdd;
|
||||
#ifndef WOLFSSL_TLS13_DRAFT_18
|
||||
XMEMCPY(©Into->ticketNonce, ©From->ticketNonce,
|
||||
sizeof(TicketNonce));
|
||||
#endif
|
||||
#ifdef WOLFSSL_EARLY_DATA
|
||||
copyInto->maxEarlyDataSz = copyFrom->maxEarlyDataSz;
|
||||
#endif
|
||||
@ -12829,10 +12827,8 @@ int AddSession(WOLFSSL* ssl)
|
||||
if (error == 0) {
|
||||
session->ticketSeen = ssl->session.ticketSeen;
|
||||
session->ticketAdd = ssl->session.ticketAdd;
|
||||
#ifndef WOLFSSL_TLS13_DRAFT_18
|
||||
XMEMCPY(&session->ticketNonce, &ssl->session.ticketNonce,
|
||||
sizeof(TicketNonce));
|
||||
#endif
|
||||
#ifdef WOLFSSL_EARLY_DATA
|
||||
session->maxEarlyDataSz = ssl->session.maxEarlyDataSz;
|
||||
#endif
|
||||
@ -19291,21 +19287,7 @@ static const char* wolfSSL_internal_get_version(const ProtocolVersion* version)
|
||||
case TLSv1_2_MINOR :
|
||||
return "TLSv1.2";
|
||||
case TLSv1_3_MINOR :
|
||||
#ifdef WOLFSSL_TLS13_DRAFT
|
||||
#ifdef WOLFSSL_TLS13_DRAFT_18
|
||||
return "TLSv1.3 (Draft 18)";
|
||||
#elif defined(WOLFSSL_TLS13_DRAFT_22)
|
||||
return "TLSv1.3 (Draft 22)";
|
||||
#elif defined(WOLFSSL_TLS13_DRAFT_23)
|
||||
return "TLSv1.3 (Draft 23)";
|
||||
#elif defined(WOLFSSL_TLS13_DRAFT_26)
|
||||
return "TLSv1.3 (Draft 26)";
|
||||
#else
|
||||
return "TLSv1.3 (Draft 28)";
|
||||
#endif
|
||||
#else
|
||||
return "TLSv1.3";
|
||||
#endif
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
@ -27041,11 +27023,9 @@ int wolfSSL_i2d_SSL_SESSION(WOLFSSL_SESSION* sess, unsigned char** p)
|
||||
#ifdef WOLFSSL_TLS13
|
||||
/* ticketSeen | ticketAdd */
|
||||
size += OPAQUE32_LEN + OPAQUE32_LEN;
|
||||
#ifndef WOLFSSL_TLS13_DRAFT_18
|
||||
/* ticketNonce */
|
||||
size += OPAQUE8_LEN + sess->ticketNonce.len;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef WOLFSSL_EARLY_DATA
|
||||
size += OPAQUE32_LEN;
|
||||
#endif
|
||||
@ -27109,12 +27089,10 @@ int wolfSSL_i2d_SSL_SESSION(WOLFSSL_SESSION* sess, unsigned char** p)
|
||||
idx += OPAQUE32_LEN;
|
||||
c32toa(sess->ticketAdd, data + idx);
|
||||
idx += OPAQUE32_LEN;
|
||||
#ifndef WOLFSSL_TLS13_DRAFT_18
|
||||
data[idx++] = sess->ticketNonce.len;
|
||||
XMEMCPY(data + idx, sess->ticketNonce.data, sess->ticketNonce.len);
|
||||
idx += sess->ticketNonce.len;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef WOLFSSL_EARLY_DATA
|
||||
c32toa(sess->maxEarlyDataSz, data + idx);
|
||||
idx += OPAQUE32_LEN;
|
||||
@ -27294,7 +27272,6 @@ WOLFSSL_SESSION* wolfSSL_d2i_SSL_SESSION(WOLFSSL_SESSION** sess,
|
||||
idx += OPAQUE32_LEN;
|
||||
ato32(data + idx, &s->ticketAdd);
|
||||
idx += OPAQUE32_LEN;
|
||||
#ifndef WOLFSSL_TLS13_DRAFT_18
|
||||
if (i - idx < OPAQUE8_LEN) {
|
||||
ret = BUFFER_ERROR;
|
||||
goto end;
|
||||
@ -27308,7 +27285,6 @@ WOLFSSL_SESSION* wolfSSL_d2i_SSL_SESSION(WOLFSSL_SESSION** sess,
|
||||
XMEMCPY(s->ticketNonce.data, data + idx, s->ticketNonce.len);
|
||||
idx += s->ticketNonce.len;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef WOLFSSL_EARLY_DATA
|
||||
if (i - idx < OPAQUE32_LEN) {
|
||||
ret = BUFFER_ERROR;
|
||||
|
49
src/tls.c
49
src/tls.c
@ -5912,10 +5912,8 @@ static int TLSX_SupportedVersions_GetSize(void* data, byte msgType, word16* pSz)
|
||||
|
||||
*pSz += (word16)(OPAQUE8_LEN + cnt * OPAQUE16_LEN);
|
||||
}
|
||||
#ifndef WOLFSSL_TLS13_DRAFT_18
|
||||
else if (msgType == server_hello || msgType == hello_retry_request)
|
||||
*pSz += OPAQUE16_LEN;
|
||||
#endif
|
||||
else
|
||||
return SANITY_MSG_E;
|
||||
|
||||
@ -5993,24 +5991,12 @@ static int TLSX_SupportedVersions_Write(void* data, byte* output,
|
||||
|
||||
*pSz += (word16)(OPAQUE8_LEN + *cnt);
|
||||
}
|
||||
#ifndef WOLFSSL_TLS13_DRAFT_18
|
||||
else if (msgType == server_hello || msgType == hello_retry_request) {
|
||||
#ifdef WOLFSSL_TLS13_DRAFT
|
||||
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;
|
||||
}
|
||||
output[0] = ssl->version.major;
|
||||
output[1] = ssl->version.minor;
|
||||
|
||||
*pSz += OPAQUE16_LEN;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
return SANITY_MSG_E;
|
||||
|
||||
@ -6092,9 +6078,7 @@ static int TLSX_SupportedVersions_Parse(WOLFSSL* ssl, byte* input,
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
#ifndef WOLFSSL_TLS13_DRAFT_18
|
||||
TLSX_SetResponse(ssl, TLSX_SUPPORTED_VERSIONS);
|
||||
#endif
|
||||
}
|
||||
if (minor > newMinor) {
|
||||
ssl->version.minor = minor;
|
||||
@ -6115,7 +6099,6 @@ static int TLSX_SupportedVersions_Parse(WOLFSSL* ssl, byte* input,
|
||||
return VERSION_ERROR;
|
||||
}
|
||||
}
|
||||
#ifndef WOLFSSL_TLS13_DRAFT_18
|
||||
else if (msgType == server_hello || msgType == hello_retry_request) {
|
||||
/* Must contain one version. */
|
||||
if (length != OPAQUE16_LEN)
|
||||
@ -6124,13 +6107,6 @@ static int TLSX_SupportedVersions_Parse(WOLFSSL* ssl, byte* input,
|
||||
major = input[0];
|
||||
minor = input[OPAQUE8_LEN];
|
||||
|
||||
#ifdef WOLFSSL_TLS13_DRAFT
|
||||
if (major == TLS_DRAFT_MAJOR && minor == TLS_DRAFT_MINOR) {
|
||||
major = SSLv3_MAJOR;
|
||||
minor = TLSv1_3_MINOR;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (major != pv.major)
|
||||
return VERSION_ERROR;
|
||||
|
||||
@ -6160,7 +6136,6 @@ static int TLSX_SupportedVersions_Parse(WOLFSSL* ssl, byte* input,
|
||||
ssl->version.minor = minor;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else
|
||||
return SANITY_MSG_E;
|
||||
|
||||
@ -6494,7 +6469,6 @@ static int TLSX_SetSignatureAlgorithms(TLSX** extensions, const void* data,
|
||||
/******************************************************************************/
|
||||
|
||||
#ifdef WOLFSSL_TLS13
|
||||
#if !defined(WOLFSSL_TLS13_DRAFT_18) && !defined(WOLFSSL_TLS13_DRAFT_22)
|
||||
/* Return the size of the SignatureAlgorithms extension's data.
|
||||
*
|
||||
* data Unused
|
||||
@ -6581,7 +6555,6 @@ static int TLSX_SetSignatureAlgorithmsCert(TLSX** extensions, const void* data,
|
||||
#define SAC_GET_SIZE TLSX_SignatureAlgorithmsCert_GetSize
|
||||
#define SAC_WRITE TLSX_SignatureAlgorithmsCert_Write
|
||||
#define SAC_PARSE TLSX_SignatureAlgorithmsCert_Parse
|
||||
#endif /* !WOLFSSL_TLS13_DRAFT_18 && !WOLFSSL_TLS13_DRAFT_22 */
|
||||
#endif /* WOLFSSL_TLS13 */
|
||||
|
||||
|
||||
@ -9233,10 +9206,8 @@ void TLSX_FreeAll(TLSX* list, void* heap)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(WOLFSSL_TLS13_DRAFT_18) && !defined(WOLFSSL_TLS13_DRAFT_22)
|
||||
case TLSX_SIGNATURE_ALGORITHMS_CERT:
|
||||
break;
|
||||
#endif
|
||||
|
||||
case TLSX_KEY_SHARE:
|
||||
KS_FREE_ALL((KeyShareEntry*)extension->data, heap);
|
||||
@ -9380,11 +9351,9 @@ static int TLSX_GetSize(TLSX* list, byte* semaphore, byte msgType,
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(WOLFSSL_TLS13_DRAFT_18) && !defined(WOLFSSL_TLS13_DRAFT_22)
|
||||
case TLSX_SIGNATURE_ALGORITHMS_CERT:
|
||||
length += SAC_GET_SIZE(extension->data);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case TLSX_KEY_SHARE:
|
||||
length += KS_GET_SIZE((KeyShareEntry*)extension->data, msgType);
|
||||
@ -9558,12 +9527,10 @@ static int TLSX_Write(TLSX* list, byte* output, byte* semaphore,
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(WOLFSSL_TLS13_DRAFT_18) && !defined(WOLFSSL_TLS13_DRAFT_22)
|
||||
case TLSX_SIGNATURE_ALGORITHMS_CERT:
|
||||
WOLFSSL_MSG("Signature Algorithms extension to write");
|
||||
offset += SAC_WRITE(extension->data, output + offset);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case TLSX_KEY_SHARE:
|
||||
WOLFSSL_MSG("Key Share extension to write");
|
||||
@ -10125,7 +10092,6 @@ int TLSX_PopulateExtensions(WOLFSSL* ssl, byte isServer)
|
||||
}
|
||||
#endif /* (HAVE_ECC || CURVE25519 || CURVE448) && HAVE_SUPPORTED_CURVES */
|
||||
|
||||
#if !defined(WOLFSSL_TLS13_DRAFT_18) && !defined(WOLFSSL_TLS13_DRAFT_22)
|
||||
if (ssl->certHashSigAlgoSz > 0) {
|
||||
WOLFSSL_MSG("Adding signature algorithms cert extension");
|
||||
if ((ret = TLSX_SetSignatureAlgorithmsCert(&ssl->extensions,
|
||||
@ -10133,7 +10099,6 @@ int TLSX_PopulateExtensions(WOLFSSL* ssl, byte isServer)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
#endif /* !WOLFSSL_TLS13_DRAFT_18 && !WOLFSSL_TLS13_DRAFT_22 */
|
||||
|
||||
if (TLSX_Find(ssl->extensions, TLSX_KEY_SHARE) == NULL) {
|
||||
word16 namedGroup;
|
||||
@ -10511,10 +10476,8 @@ int TLSX_GetResponseSize(WOLFSSL* ssl, byte msgType, word16* pLength)
|
||||
#ifdef WOLFSSL_TLS13
|
||||
if (IsAtLeastTLSv1_3(ssl->version)) {
|
||||
XMEMSET(semaphore, 0xff, SEMAPHORE_SIZE);
|
||||
#ifndef WOLFSSL_TLS13_DRAFT_18
|
||||
TURN_OFF(semaphore,
|
||||
TLSX_ToSemaphore(TLSX_SUPPORTED_VERSIONS));
|
||||
#endif
|
||||
if (!ssl->options.noPskDheKe)
|
||||
TURN_OFF(semaphore, TLSX_ToSemaphore(TLSX_KEY_SHARE));
|
||||
#if defined(HAVE_SESSION_TICKET) || !defined(NO_PSK)
|
||||
@ -10533,9 +10496,7 @@ int TLSX_GetResponseSize(WOLFSSL* ssl, byte msgType, word16* pLength)
|
||||
#ifdef WOLFSSL_TLS13
|
||||
case hello_retry_request:
|
||||
XMEMSET(semaphore, 0xff, SEMAPHORE_SIZE);
|
||||
#ifndef WOLFSSL_TLS13_DRAFT_18
|
||||
TURN_OFF(semaphore, TLSX_ToSemaphore(TLSX_SUPPORTED_VERSIONS));
|
||||
#endif
|
||||
if (!ssl->options.noPskDheKe)
|
||||
TURN_OFF(semaphore, TLSX_ToSemaphore(TLSX_KEY_SHARE));
|
||||
TURN_OFF(semaphore, TLSX_ToSemaphore(TLSX_COOKIE));
|
||||
@ -10631,10 +10592,8 @@ int TLSX_WriteResponse(WOLFSSL *ssl, byte* output, byte msgType, word16* pOffset
|
||||
#ifdef WOLFSSL_TLS13
|
||||
if (IsAtLeastTLSv1_3(ssl->version)) {
|
||||
XMEMSET(semaphore, 0xff, SEMAPHORE_SIZE);
|
||||
#ifndef WOLFSSL_TLS13_DRAFT_18
|
||||
TURN_OFF(semaphore,
|
||||
TLSX_ToSemaphore(TLSX_SUPPORTED_VERSIONS));
|
||||
#endif
|
||||
if (!ssl->options.noPskDheKe)
|
||||
TURN_OFF(semaphore, TLSX_ToSemaphore(TLSX_KEY_SHARE));
|
||||
#if defined(HAVE_SESSION_TICKET) || !defined(NO_PSK)
|
||||
@ -10653,9 +10612,7 @@ int TLSX_WriteResponse(WOLFSSL *ssl, byte* output, byte msgType, word16* pOffset
|
||||
#ifdef WOLFSSL_TLS13
|
||||
case hello_retry_request:
|
||||
XMEMSET(semaphore, 0xff, SEMAPHORE_SIZE);
|
||||
#ifndef WOLFSSL_TLS13_DRAFT_18
|
||||
TURN_OFF(semaphore, TLSX_ToSemaphore(TLSX_SUPPORTED_VERSIONS));
|
||||
#endif
|
||||
if (!ssl->options.noPskDheKe)
|
||||
TURN_OFF(semaphore, TLSX_ToSemaphore(TLSX_KEY_SHARE));
|
||||
/* Cookie is written below as last extension. */
|
||||
@ -11182,7 +11139,6 @@ int TLSX_Parse(WOLFSSL* ssl, byte* input, word16 length, byte msgType,
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(WOLFSSL_TLS13_DRAFT_18) && !defined(WOLFSSL_TLS13_DRAFT_22)
|
||||
case TLSX_SIGNATURE_ALGORITHMS_CERT:
|
||||
WOLFSSL_MSG("Signature Algorithms extension received");
|
||||
#ifdef WOLFSSL_DEBUG_TLS
|
||||
@ -11203,7 +11159,6 @@ int TLSX_Parse(WOLFSSL* ssl, byte* input, word16 length, byte msgType,
|
||||
|
||||
ret = SAC_PARSE(ssl, input + offset, size, isRequest);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case TLSX_KEY_SHARE:
|
||||
WOLFSSL_MSG("Key Share extension received");
|
||||
|
632
src/tls13.c
632
src/tls13.c
File diff suppressed because it is too large
Load Diff
@ -1210,19 +1210,6 @@ enum Misc {
|
||||
TLSv1_2_MINOR = 3, /* TLSv1_2 minor version number */
|
||||
TLSv1_3_MINOR = 4, /* TLSv1_3 minor version number */
|
||||
TLS_DRAFT_MAJOR = 0x7f, /* Draft TLS major version number */
|
||||
#ifdef WOLFSSL_TLS13_DRAFT
|
||||
#ifdef WOLFSSL_TLS13_DRAFT_18
|
||||
TLS_DRAFT_MINOR = 0x12, /* Minor version number of TLS draft */
|
||||
#elif defined(WOLFSSL_TLS13_DRAFT_22)
|
||||
TLS_DRAFT_MINOR = 0x16, /* Minor version number of TLS draft */
|
||||
#elif defined(WOLFSSL_TLS13_DRAFT_23)
|
||||
TLS_DRAFT_MINOR = 0x17, /* Minor version number of TLS draft */
|
||||
#elif defined(WOLFSSL_TLS13_DRAFT_26)
|
||||
TLS_DRAFT_MINOR = 0x1a, /* Minor version number of TLS draft */
|
||||
#else
|
||||
TLS_DRAFT_MINOR = 0x1c, /* Minor version number of TLS draft */
|
||||
#endif
|
||||
#endif
|
||||
OLD_HELLO_ID = 0x01, /* SSLv2 Client Hello Indicator */
|
||||
INVALID_BYTE = 0xff, /* Used to initialize cipher specs values */
|
||||
NO_COMPRESSION = 0,
|
||||
@ -2187,12 +2174,8 @@ typedef enum {
|
||||
#ifdef WOLFSSL_POST_HANDSHAKE_AUTH
|
||||
TLSX_POST_HANDSHAKE_AUTH = 0x0031,
|
||||
#endif
|
||||
#if defined(WOLFSSL_TLS13_DRAFT_18) || defined(WOLFSSL_TLS13_DRAFT_22)
|
||||
TLSX_KEY_SHARE = 0x0028,
|
||||
#else
|
||||
TLSX_SIGNATURE_ALGORITHMS_CERT = 0x0032,
|
||||
TLSX_KEY_SHARE = 0x0033,
|
||||
#endif
|
||||
#endif
|
||||
TLSX_RENEGOTIATION_INFO = 0xff01
|
||||
} TLSX_Type;
|
||||
@ -2534,7 +2517,6 @@ WOLFSSL_LOCAL int TLSX_KeyShare_DeriveSecret(WOLFSSL* ssl);
|
||||
|
||||
|
||||
#if defined(HAVE_SESSION_TICKET) || !defined(NO_PSK)
|
||||
#ifndef WOLFSSL_TLS13_DRAFT_18
|
||||
/* Ticket nonce - for deriving PSK.
|
||||
* Length allowed to be: 1..255. Only support 4 bytes.
|
||||
*/
|
||||
@ -2542,7 +2524,6 @@ typedef struct TicketNonce {
|
||||
byte len;
|
||||
byte data[MAX_TICKET_NONCE_SZ];
|
||||
} TicketNonce;
|
||||
#endif
|
||||
|
||||
/* The PreSharedKey extension information - entry in a linked list. */
|
||||
typedef struct PreSharedKey {
|
||||
@ -3169,9 +3150,7 @@ struct WOLFSSL_SESSION {
|
||||
#ifdef WOLFSSL_TLS13
|
||||
word32 ticketSeen; /* Time ticket seen (ms) */
|
||||
word32 ticketAdd; /* Added by client */
|
||||
#ifndef WOLFSSL_TLS13_DRAFT_18
|
||||
TicketNonce ticketNonce; /* Nonce used to derive PSK */
|
||||
#endif
|
||||
#endif
|
||||
#ifdef WOLFSSL_EARLY_DATA
|
||||
word32 maxEarlyDataSz;
|
||||
@ -3983,11 +3962,9 @@ struct WOLFSSL {
|
||||
#endif
|
||||
word16 pssAlgo;
|
||||
#ifdef WOLFSSL_TLS13
|
||||
#if !defined(WOLFSSL_TLS13_DRAFT_18) && !defined(WOLFSSL_TLS13_DRAFT_22)
|
||||
word16 certHashSigAlgoSz; /* SigAlgoCert ext length in bytes */
|
||||
byte certHashSigAlgo[WOLFSSL_MAX_SIGALGO]; /* cert sig/algo to
|
||||
* offer */
|
||||
#endif /* !WOLFSSL_TLS13_DRAFT_18 && !WOLFSSL_TLS13_DRAFT_22 */
|
||||
#endif
|
||||
#ifdef HAVE_NTRU
|
||||
word16 peerNtruKeyLen;
|
||||
@ -4345,12 +4322,8 @@ WOLFSSL_LOCAL int SendTicket(WOLFSSL*);
|
||||
WOLFSSL_LOCAL int DoClientTicket(WOLFSSL*, const byte*, word32);
|
||||
WOLFSSL_LOCAL int SendData(WOLFSSL*, const void*, int);
|
||||
#ifdef WOLFSSL_TLS13
|
||||
#ifdef WOLFSSL_TLS13_DRAFT_18
|
||||
WOLFSSL_LOCAL int SendTls13HelloRetryRequest(WOLFSSL*);
|
||||
#else
|
||||
WOLFSSL_LOCAL int SendTls13ServerHello(WOLFSSL*, byte);
|
||||
#endif
|
||||
#endif
|
||||
WOLFSSL_LOCAL int SendCertificate(WOLFSSL*);
|
||||
WOLFSSL_LOCAL int SendCertificateRequest(WOLFSSL*);
|
||||
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) \
|
||||
|
Loading…
Reference in New Issue
Block a user