Merge pull request #1061 from SparkiDev/tls13_leantls

Fixes for LEANTLS and TLS13 builds
pull/1027/head
dgarske 2017-07-25 21:01:00 -07:00 committed by GitHub
commit 05ed5cafc2
5 changed files with 30 additions and 12 deletions

View File

@ -274,7 +274,11 @@ fi
if test "$ENABLED_TLS13" = "yes" if test "$ENABLED_TLS13" = "yes"
then then
AM_CFLAGS="-DWOLFSSL_TLS13 -DHAVE_TLS_EXTENSIONS -DHAVE_FFDHE_2048 $AM_CFLAGS" AM_CFLAGS="-DWOLFSSL_TLS13 -DHAVE_TLS_EXTENSIONS $AM_CFLAGS"
if test "$ENABLED_DH" = "yes"
then
AM_CFLAGS="-DHAVE_FFDHE_2048 $AM_CFLAGS"
fi
fi fi
# check if TLS v1.3 was enabled for conditionally running tls13.test script # check if TLS v1.3 was enabled for conditionally running tls13.test script
@ -671,7 +675,8 @@ AC_ARG_ENABLE([aesgcm],
) )
# leanpsk and leantls don't need gcm # leanpsk and leantls don't need gcm
if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes" if test "$ENABLED_LEANPSK" = "yes" || ( test "$ENABLED_LEANTLS" = "yes" &&
test "$ENABLED_TLS13" = "no")
then then
ENABLED_AESGCM=no ENABLED_AESGCM=no
fi fi

View File

@ -225,9 +225,14 @@ static int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port,
#endif #endif
#ifdef WOLFSSL_TLS13 #ifdef WOLFSSL_TLS13
#ifdef HAVE_CURVE25519 #ifdef HAVE_CURVE25519
else if (useX25519) { #ifndef NO_SESSION_CACHE
if (benchResume) {
}
else
#endif
if (useX25519) {
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_X25519) if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_X25519)
!= SSL_SUCCESS) { != SSL_SUCCESS) {
err_sys("unable to use curve x25519"); err_sys("unable to use curve x25519");
} }
} }
@ -1707,14 +1712,18 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
} }
#endif #endif
#ifdef HAVE_ECC #ifdef HAVE_ECC
#if defined(HAVE_ECC256) || defined(HAVE_ALL_CURVES)
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SECP256R1) if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SECP256R1)
!= SSL_SUCCESS) { != SSL_SUCCESS) {
err_sys("unable to use curve secp256r1"); err_sys("unable to use curve secp256r1");
} }
#endif
#if defined(HAVE_ECC384) || defined(HAVE_ALL_CURVES)
if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SECP384R1) if (wolfSSL_UseKeyShare(ssl, WOLFSSL_ECC_SECP384R1)
!= SSL_SUCCESS) { != SSL_SUCCESS) {
err_sys("unable to use curve secp384r1"); err_sys("unable to use curve secp384r1");
} }
#endif
#endif #endif
} }
if (onlyKeyShare == 0 || onlyKeyShare == 1) { if (onlyKeyShare == 0 || onlyKeyShare == 1) {

View File

@ -54,6 +54,10 @@ dist_noinst_SCRIPTS+= scripts/pkcallbacks.test
scripts/pkcallbacks.log: scripts/resume.log scripts/pkcallbacks.log: scripts/resume.log
endif endif
if BUILD_TLS13
dist_noinst_SCRIPTS+= scripts/tls13.test
endif
endif # end of BUILD_EXAMPLE_SERVERS endif # end of BUILD_EXAMPLE_SERVERS
if BUILD_EXAMPLE_CLIENTS if BUILD_EXAMPLE_CLIENTS
@ -64,10 +68,6 @@ dist_noinst_SCRIPTS+= scripts/openssl.test
endif endif
endif endif
if BUILD_TLS13
dist_noinst_SCRIPTS+= scripts/tls13.test
endif
EXTRA_DIST += scripts/testsuite.pcap \ EXTRA_DIST += scripts/testsuite.pcap \
scripts/ping.test scripts/ping.test

View File

@ -5253,6 +5253,8 @@ static int TLSX_KeyShare_ProcessDh(WOLFSSL* ssl, KeyShareEntry* keyShareEntry)
return ret; return ret;
#else #else
(void)ssl;
(void)keyShareEntry;
return PEER_KEY_ERROR; return PEER_KEY_ERROR;
#endif #endif
} }

View File

@ -1503,6 +1503,7 @@ static INLINE void BuildTls13Nonce(WOLFSSL* ssl, byte* nonce, const byte* iv,
nonce[i] ^= iv[i]; nonce[i] ^= iv[i];
} }
#ifdef HAVE_CHACHA
/* Encrypt with ChaCha20 and create authenication tag with Poly1305. /* Encrypt with ChaCha20 and create authenication tag with Poly1305.
* *
* ssl The SSL/TLS object. * ssl The SSL/TLS object.
@ -1550,6 +1551,7 @@ static int ChaCha20Poly1305_Encrypt(WOLFSSL* ssl, byte* output,
return ret; return ret;
} }
#endif
/* Encrypt data for TLS v1.3. /* Encrypt data for TLS v1.3.
* *
@ -1694,6 +1696,7 @@ static int EncryptTls13(WOLFSSL* ssl, byte* output, const byte* input,
return ret; return ret;
} }
#ifdef HAVE_CHACHA
/* Decrypt with ChaCha20 and check authenication tag with Poly1305. /* Decrypt with ChaCha20 and check authenication tag with Poly1305.
* *
* ssl The SSL/TLS object. * ssl The SSL/TLS object.
@ -1747,6 +1750,7 @@ static int ChaCha20Poly1305_Decrypt(WOLFSSL* ssl, byte* output,
return ret; return ret;
} }
#endif
/* Decrypt data for TLS v1.3. /* Decrypt data for TLS v1.3.
* *
@ -3951,18 +3955,14 @@ static int CreateSigData(WOLFSSL* ssl, byte* sigData, word16* sigDataSz,
XMEMSET(sigData, SIGNING_DATA_PREFIX_BYTE, SIGNING_DATA_PREFIX_SZ); XMEMSET(sigData, SIGNING_DATA_PREFIX_BYTE, SIGNING_DATA_PREFIX_SZ);
idx = SIGNING_DATA_PREFIX_SZ; idx = SIGNING_DATA_PREFIX_SZ;
#ifndef NO_WOLFSSL_SERVER
if ((side == WOLFSSL_SERVER_END && check) || if ((side == WOLFSSL_SERVER_END && check) ||
(side == WOLFSSL_CLIENT_END && !check)) { (side == WOLFSSL_CLIENT_END && !check)) {
XMEMCPY(&sigData[idx], clientCertVfyLabel, CERT_VFY_LABEL_SZ); XMEMCPY(&sigData[idx], clientCertVfyLabel, CERT_VFY_LABEL_SZ);
} }
#endif
#ifndef NO_WOLFSSL_CLIENT
if ((side == WOLFSSL_CLIENT_END && check) || if ((side == WOLFSSL_CLIENT_END && check) ||
(side == WOLFSSL_SERVER_END && !check)) { (side == WOLFSSL_SERVER_END && !check)) {
XMEMCPY(&sigData[idx], serverCertVfyLabel, CERT_VFY_LABEL_SZ); XMEMCPY(&sigData[idx], serverCertVfyLabel, CERT_VFY_LABEL_SZ);
} }
#endif
idx += CERT_VFY_LABEL_SZ; idx += CERT_VFY_LABEL_SZ;
ret = GetMsgHash(ssl, &sigData[idx]); ret = GetMsgHash(ssl, &sigData[idx]);
@ -6849,6 +6849,7 @@ int wolfSSL_request_certificate(WOLFSSL* ssl)
} }
#endif /* !NO_CERTS && WOLFSSL_POST_HANDSHAKE_AUTH */ #endif /* !NO_CERTS && WOLFSSL_POST_HANDSHAKE_AUTH */
#ifndef NO_WOLFSSL_SERVER
/* The server accepting a connection from a client. /* The server accepting a connection from a client.
* The protocol version is expecting to be TLS v1.3. * The protocol version is expecting to be TLS v1.3.
* If the client downgrades, and older versions of the protocol are compiled * If the client downgrades, and older versions of the protocol are compiled
@ -7099,6 +7100,7 @@ int wolfSSL_accept_TLSv13(WOLFSSL* ssl)
return SSL_FATAL_ERROR; return SSL_FATAL_ERROR;
} }
} }
#endif
#ifdef WOLFSSL_EARLY_DATA #ifdef WOLFSSL_EARLY_DATA
/* Sets the maximum amount of early data that can be seen by server when using /* Sets the maximum amount of early data that can be seen by server when using