internal: return from wolfSSL_Peek() with sz 0 if we don't have data

This way we can use wolfSSL_Peek() invoked with sz == 0 to process pending
records and, if none of this records is an application data record, we will not
block.
This commit is contained in:
Marco Oliverio
2022-05-20 10:00:18 +02:00
committed by David Garske
parent dfc9873c0f
commit e2abdf23a7

View File

@ -21193,6 +21193,17 @@ startScr:
}
}
#endif
#ifdef WOLFSSL_DTLS13
/* if wolfSSL_Peek() is invoked with sz == 0 it will not block (but
* it processes pending non-application records) */
if (ssl->options.dtls && IsAtLeastTLSv1_3(ssl->version) && peek &&
sz == 0 && ssl->buffers.inputBuffer.idx
- ssl->buffers.inputBuffer.length == 0) {
return 0;
}
#endif /* WOLFSSL_DTLS13 */
#ifndef WOLFSSL_TLS13_NO_PEEK_HANDSHAKE_DONE
#ifdef WOLFSSL_TLS13
if (IsAtLeastTLSv1_3(ssl->version) && ssl->options.handShakeDone &&