Merge pull request #1802 from SparkiDev/tls13_0rtt_ch

Group Early Data message with ClientHello for faster delivery
This commit is contained in:
toddouska
2018-09-04 15:39:14 -07:00
committed by GitHub
3 changed files with 20 additions and 2 deletions

View File

@ -2794,6 +2794,13 @@ AC_ARG_ENABLE([earlydata],
[ ENABLED_TLS13_EARLY_DATA=$enableval ],
[ ENABLED_TLS13_EARLY_DATA=no ]
)
if test "$ENABLED_TLS13_EARLY_DATA" = "group"
then
ENABLED_TLS13_EARLY_DATA="yes"
# Group EarlyData with ClientHello
AM_CFLAGS="-DWOLFSSL_EARLY_DATA_GROUP $AM_CFLAGS"
fi
if test "$ENABLED_TLS13_EARLY_DATA" = "yes"
then
if test "x$ENABLED_TLS13" = "xno"
@ -2812,6 +2819,7 @@ then
AM_CFLAGS="$AM_CFLAGS -DNO_SESSION_CACHE"
fi
# PKCS7
AC_ARG_ENABLE([pkcs7],
[AS_HELP_STRING([--enable-pkcs7],[Enable PKCS7 (default: disabled)])],

View File

@ -14739,6 +14739,7 @@ int SendData(WOLFSSL* ssl, const void* data, int sz)
sendSz,
ret,
dtlsExtra = 0;
int groupMsgs = 0;
if (ssl->error == WANT_WRITE
#ifdef WOLFSSL_ASYNC_CRYPT
@ -14763,6 +14764,9 @@ int SendData(WOLFSSL* ssl, const void* data, int sz)
WOLFSSL_MSG("handshake complete, trying to send early data");
return BUILD_MSG_ERROR;
}
#ifdef WOLFSSL_EARLY_DATA_GROUP
groupMsgs = 1;
#endif
}
else
#endif
@ -14781,7 +14785,7 @@ int SendData(WOLFSSL* ssl, const void* data, int sz)
}
/* last time system socket output buffer was full, try again to send */
if (ssl->buffers.outputBuffer.length > 0) {
if (!groupMsgs && ssl->buffers.outputBuffer.length > 0) {
WOLFSSL_MSG("output buffer was full, trying to send again");
if ( (ssl->error = SendBuffered(ssl)) < 0) {
WOLFSSL_ERROR(ssl->error);

View File

@ -42,6 +42,8 @@
* and key generation input and output.
* WOLFSSL_EARLY_DATA
* Allow 0-RTT Handshake using Early Data extensions and handshake message
* WOLFSSL_EARLY_DATA_GROUP
* Group EarlyData message with ClientHello when sending
* WOLFSSL_NO_SERVER_GROUPS_EXT
* Do not send the server's groups in an extension when the server's top
* preference is not in client's list.
@ -2670,7 +2672,11 @@ int SendTls13ClientHello(WOLFSSL* ssl)
ssl->buffers.outputBuffer.length += sendSz;
ret = SendBuffered(ssl);
#ifdef WOLFSSL_EARLY_DATA_GROUP
if (ssl->earlyData == no_early_data)
#endif
ret = SendBuffered(ssl);
WOLFSSL_LEAVE("SendTls13ClientHello", ret);
WOLFSSL_END(WC_FUNC_CLIENT_HELLO_SEND);