Merge pull request #2726 from ejohnstown/maint-ren

Maintenance: Secure Renegotiation
This commit is contained in:
toddouska
2020-01-09 14:54:13 -08:00
committed by GitHub

View File

@@ -16528,6 +16528,23 @@ int SendCertificateStatus(WOLFSSL* ssl)
#endif /* WOLFSSL_NO_TLS12 */
/* If secure renegotiation is disabled, this will always return false.
* Otherwise it checks to see if we are currently renegotiating. */
static WC_INLINE int IsSCR(WOLFSSL* ssl)
{
#ifndef HAVE_SECURE_RENEGOTIATION
(void)ssl;
#else /* HAVE_SECURE_RENEGOTIATION */
if (ssl->secure_renegotiation &&
ssl->secure_renegotiation->enabled &&
ssl->options.handShakeState != HANDSHAKE_DONE)
return 1;
#endif /* HAVE_SECURE_RENEGOTIATION */
return 0;
}
int SendData(WOLFSSL* ssl, const void* data, int sz)
{
int sent = 0, /* plainText size */
@@ -16569,7 +16586,7 @@ int SendData(WOLFSSL* ssl, const void* data, int sz)
}
else
#endif
if (ssl->options.handShakeState != HANDSHAKE_DONE) {
if (ssl->options.handShakeState != HANDSHAKE_DONE && !IsSCR(ssl)) {
int err;
WOLFSSL_MSG("handshake not complete, trying to finish");
if ( (err = wolfSSL_negotiate(ssl)) != WOLFSSL_SUCCESS) {