Refactor SendStatelessReply 1.3 branch into new function

This commit is contained in:
Juliusz Sosinowicz
2023-01-23 16:06:06 +01:00
parent 2f31cdef69
commit c15043b191

View File

@@ -470,15 +470,16 @@ static void FindPskSuiteFromExt(const WOLFSSL* ssl, TLSX* extensions,
} }
#endif #endif
static int SendStatelessReply(const WOLFSSL* ssl, WolfSSL_CH* ch, byte isTls13, #ifdef WOLFSSL_DTLS13
#ifndef WOLFSSL_SEND_HRR_COOKIE
#error "WOLFSSL_SEND_HRR_COOKIE has to be defined to use DTLS 1.3 server"
#endif
static int SendStatelessReplyDtls13(const WOLFSSL* ssl, WolfSSL_CH* ch,
PskInfo* pskInfo) PskInfo* pskInfo)
{ {
int ret; int ret = -1;
(void)isTls13;
(void)pskInfo;
#ifdef WOLFSSL_DTLS13
if (isTls13) {
#ifdef WOLFSSL_SEND_HRR_COOKIE
if (ch->cookie.size == 0) { if (ch->cookie.size == 0) {
TLSX* parsedExts = NULL; TLSX* parsedExts = NULL;
WolfSSL_ConstVector tlsx; WolfSSL_ConstVector tlsx;
@@ -699,9 +700,19 @@ dtls13_cleanup:
} }
else else
ret = SendAlert((WOLFSSL*)ssl, alert_fatal, illegal_parameter); ret = SendAlert((WOLFSSL*)ssl, alert_fatal, illegal_parameter);
#else return ret;
#error "WOLFSSL_SEND_HRR_COOKIE has to be defined to use DTLS 1.3 server" }
#endif #endif
static int SendStatelessReply(const WOLFSSL* ssl, WolfSSL_CH* ch, byte isTls13,
PskInfo* pskInfo)
{
int ret;
(void)isTls13;
(void)pskInfo;
#ifdef WOLFSSL_DTLS13
if (isTls13) {
ret = SendStatelessReplyDtls13(ssl, ch, pskInfo);
} }
else else
#endif #endif