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
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)
{
int ret;
(void)isTls13;
(void)pskInfo;
#ifdef WOLFSSL_DTLS13
if (isTls13) {
#ifdef WOLFSSL_SEND_HRR_COOKIE
int ret = -1;
if (ch->cookie.size == 0) {
TLSX* parsedExts = NULL;
WolfSSL_ConstVector tlsx;
@ -699,9 +700,19 @@ dtls13_cleanup:
}
else
ret = SendAlert((WOLFSSL*)ssl, alert_fatal, illegal_parameter);
#else
#error "WOLFSSL_SEND_HRR_COOKIE has to be defined to use DTLS 1.3 server"
return ret;
}
#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
#endif