Skip to content

Commit 4c836c9

Browse files
aglmattcaswell
authored andcommitted
Remove some duplicate DTLS code.
In |dtls1_process_out_of_seq_message|, we know that |frag_len| <= |msg_hdr->msg_len| so the later tests for |frag_len < msg_hdr->msg_len| can be more clearly written as |frag_len != msg_hdr->msg_len|, since that's the only remaining case. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
1 parent 6e14e7f commit 4c836c9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ssl/d1_both.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ static unsigned long dtls1_max_handshake_message_len(const SSL *s)
593593
}
594594

595595
static int
596-
dtls1_reassemble_fragment(SSL *s, struct hm_header_st* msg_hdr, int *ok)
596+
dtls1_reassemble_fragment(SSL *s, const struct hm_header_st* msg_hdr, int *ok)
597597
{
598598
hm_fragment *frag = NULL;
599599
pitem *item = NULL;
@@ -705,7 +705,7 @@ dtls1_reassemble_fragment(SSL *s, struct hm_header_st* msg_hdr, int *ok)
705705

706706

707707
static int
708-
dtls1_process_out_of_seq_message(SSL *s, struct hm_header_st* msg_hdr, int *ok)
708+
dtls1_process_out_of_seq_message(SSL *s, const struct hm_header_st* msg_hdr, int *ok)
709709
{
710710
int i=-1;
711711
hm_fragment *frag = NULL;
@@ -725,7 +725,7 @@ dtls1_process_out_of_seq_message(SSL *s, struct hm_header_st* msg_hdr, int *ok)
725725
/* If we already have an entry and this one is a fragment,
726726
* don't discard it and rather try to reassemble it.
727727
*/
728-
if (item != NULL && frag_len < msg_hdr->msg_len)
728+
if (item != NULL && frag_len != msg_hdr->msg_len)
729729
item = NULL;
730730

731731
/* Discard the message if sequence number was already there, is
@@ -750,7 +750,7 @@ dtls1_process_out_of_seq_message(SSL *s, struct hm_header_st* msg_hdr, int *ok)
750750
}
751751
else
752752
{
753-
if (frag_len < msg_hdr->msg_len)
753+
if (frag_len != msg_hdr->msg_len)
754754
return dtls1_reassemble_fragment(s, msg_hdr, ok);
755755

756756
if (frag_len > dtls1_max_handshake_message_len(s))

0 commit comments

Comments
 (0)