Skip to content

Commit 6e3c357

Browse files
committed
Refactor the crazy conditional in VerifyForDtlsMsgPoolSend
1 parent c5c968a commit 6e3c357

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

src/internal.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9199,13 +9199,21 @@ int VerifyForDtlsMsgPoolSend(WOLFSSL* ssl, byte type, word32 fragOffset)
91999199
* to be used for triggering retransmission of whole DtlsMsgPool.
92009200
* change cipher suite type is not verified here
92019201
*/
9202-
return ((fragOffset == 0) &&
9203-
(((ssl->options.side == WOLFSSL_SERVER_END) &&
9204-
((type == client_hello) ||
9205-
((ssl->options.verifyPeer) && (type == certificate)) ||
9206-
((!ssl->options.verifyPeer) && (type == client_key_exchange)))) ||
9207-
((ssl->options.side == WOLFSSL_CLIENT_END) &&
9208-
(type == hello_request || type == server_hello))));
9202+
if (fragOffset == 0) {
9203+
if (ssl->options.side == WOLFSSL_SERVER_END) {
9204+
if (type == client_hello)
9205+
return 1;
9206+
else if (ssl->options.verifyPeer && type == certificate)
9207+
return 1;
9208+
else if (!ssl->options.verifyPeer && type == client_key_exchange)
9209+
return 1;
9210+
}
9211+
else {
9212+
if (type == hello_request || type == server_hello)
9213+
return 1;
9214+
}
9215+
}
9216+
return 0;
92099217
}
92109218

92119219

0 commit comments

Comments
 (0)