aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Langley <agl@imperialviolet.org>2014-06-06 14:47:07 -0700
committerMatt Caswell <matt@openssl.org>2014-08-06 22:02:00 +0100
commit4c836c96c4ec507040ed9149acacddc40399155d (patch)
treee9b476f955d6ede58d008fd1ccd2aae0fa0f1631
parent6e14e7fc19ab8c16ec7e7cb69404b96cf591a575 (diff)
downloadopenssl-4c836c96c4ec507040ed9149acacddc40399155d.tar.gz
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>
-rw-r--r--ssl/d1_both.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ssl/d1_both.c b/ssl/d1_both.c
index 3a4819f0e9..d2bbb6b053 100644
--- a/ssl/d1_both.c
+++ b/ssl/d1_both.c
@@ -593,7 +593,7 @@ static unsigned long dtls1_max_handshake_message_len(const SSL *s)
}
static int
-dtls1_reassemble_fragment(SSL *s, struct hm_header_st* msg_hdr, int *ok)
+dtls1_reassemble_fragment(SSL *s, const struct hm_header_st* msg_hdr, int *ok)
{
hm_fragment *frag = NULL;
pitem *item = NULL;
@@ -705,7 +705,7 @@ err:
static int
-dtls1_process_out_of_seq_message(SSL *s, struct hm_header_st* msg_hdr, int *ok)
+dtls1_process_out_of_seq_message(SSL *s, const struct hm_header_st* msg_hdr, int *ok)
{
int i=-1;
hm_fragment *frag = NULL;
@@ -725,7 +725,7 @@ dtls1_process_out_of_seq_message(SSL *s, struct hm_header_st* msg_hdr, int *ok)
/* If we already have an entry and this one is a fragment,
* don't discard it and rather try to reassemble it.
*/
- if (item != NULL && frag_len < msg_hdr->msg_len)
+ if (item != NULL && frag_len != msg_hdr->msg_len)
item = NULL;
/* 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)
}
else
{
- if (frag_len < msg_hdr->msg_len)
+ if (frag_len != msg_hdr->msg_len)
return dtls1_reassemble_fragment(s, msg_hdr, ok);
if (frag_len > dtls1_max_handshake_message_len(s))