diff options
author | Robert Cragie <Robert.Cragie@arm.com> | 2017-03-14 11:27:04 +0000 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2017-03-14 15:40:54 +0000 |
commit | 096dd7946589d155b30148da2faad34d5698416c (patch) | |
tree | 63df1b0ad6ecc03c9b6a5b11b9bfc4ad07ae8ebb /epan/dissectors | |
parent | c899dd57ffb81075e6f20f4af83daf99ef4e8b0c (diff) |
DTLS: Cookie formatting fix for HVR
Cookie format for HelloVerifyRequest inconsistent with that in
ClientHello. Changed to be consistent.
Change-Id: I79809ebc4bd4a1c5b43b44a21f58ad5b5d5a1bcf
Reviewed-on: https://code.wireshark.org/review/20544
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-dtls.c | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/epan/dissectors/packet-dtls.c b/epan/dissectors/packet-dtls.c index c871c0838e..526a080c54 100644 --- a/epan/dissectors/packet-dtls.c +++ b/epan/dissectors/packet-dtls.c @@ -341,10 +341,9 @@ static void dissect_dtls_heartbeat(tvbuff_t *tvb, packet_info *pinfo, const SslSession *session, guint32 record_length, gboolean decrypted); -static int dissect_dtls_hnd_hello_verify_request(tvbuff_t *tvb, - proto_tree *tree, - guint32 offset, - SslDecryptSession* ssl); +static int dissect_dtls_hnd_hello_verify_request(ssl_common_dissect_t *hf, tvbuff_t *tvb, + packet_info *pinfo, proto_tree *tree, + guint32 offset, guint32 offset_end); /* * Support Functions @@ -1269,7 +1268,8 @@ dissect_dtls_handshake(tvbuff_t *tvb, packet_info *pinfo, break; case SSL_HND_HELLO_VERIFY_REQUEST: - dissect_dtls_hnd_hello_verify_request(sub_tvb, ssl_hand_tree, 0, ssl); + dissect_dtls_hnd_hello_verify_request(&dissect_dtls_hf, sub_tvb, pinfo, + ssl_hand_tree, 0, length); break; case SSL_HND_NEWSESSION_TICKET: @@ -1426,8 +1426,9 @@ dissect_dtls_heartbeat(tvbuff_t *tvb, packet_info *pinfo, } static int -dissect_dtls_hnd_hello_verify_request(tvbuff_t *tvb, proto_tree *tree, - guint32 offset, SslDecryptSession* ssl _U_) +dissect_dtls_hnd_hello_verify_request(ssl_common_dissect_t *hf, tvbuff_t *tvb, + packet_info *pinfo, proto_tree *tree, + guint32 offset, guint32 offset_end) { /* * struct { @@ -1436,29 +1437,24 @@ dissect_dtls_hnd_hello_verify_request(tvbuff_t *tvb, proto_tree *tree, * } HelloVerifyRequest; */ - guint8 cookie_length; + guint32 cookie_length; /* show the client version */ proto_tree_add_item(tree, dissect_dtls_hf.hf.hs_server_version, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; - - /* look for a cookie */ - cookie_length = tvb_get_guint8(tvb, offset); - - proto_tree_add_uint(tree, dtls_hfs.hf_dtls_handshake_cookie_len, - tvb, offset, 1, cookie_length); - offset ++; /* skip opaque length */ + if (!ssl_add_vector(hf, tvb, pinfo, tree, offset, offset_end, &cookie_length, + dtls_hfs.hf_dtls_handshake_cookie_len, 0, 32)) { + return offset; + } + offset++; if (cookie_length > 0) { - proto_tree_add_bytes_format(tree, dtls_hfs.hf_dtls_handshake_cookie, - tvb, offset, cookie_length, - NULL, "Cookie (%u byte%s)", - cookie_length, - plurality(cookie_length, "", "s")); - offset += cookie_length; + proto_tree_add_item(tree, dtls_hfs.hf_dtls_handshake_cookie, + tvb, offset, cookie_length, ENC_NA); + offset += cookie_length; } return offset; |