Refactor the crazy conditional in VerifyForDtlsMsgPoolSend

This commit is contained in:
Juliusz Sosinowicz
2023-08-24 19:24:40 +02:00
parent c5c968aae3
commit 6e3c3577f5

View File

@@ -9199,13 +9199,21 @@ int VerifyForDtlsMsgPoolSend(WOLFSSL* ssl, byte type, word32 fragOffset)
* to be used for triggering retransmission of whole DtlsMsgPool. * to be used for triggering retransmission of whole DtlsMsgPool.
* change cipher suite type is not verified here * change cipher suite type is not verified here
*/ */
return ((fragOffset == 0) && if (fragOffset == 0) {
(((ssl->options.side == WOLFSSL_SERVER_END) && if (ssl->options.side == WOLFSSL_SERVER_END) {
((type == client_hello) || if (type == client_hello)
((ssl->options.verifyPeer) && (type == certificate)) || return 1;
((!ssl->options.verifyPeer) && (type == client_key_exchange)))) || else if (ssl->options.verifyPeer && type == certificate)
((ssl->options.side == WOLFSSL_CLIENT_END) && return 1;
(type == hello_request || type == server_hello)))); else if (!ssl->options.verifyPeer && type == client_key_exchange)
return 1;
}
else {
if (type == hello_request || type == server_hello)
return 1;
}
}
return 0;
} }