aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ssl-utils.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2017-05-13 19:21:45 +0200
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2017-05-14 21:18:24 +0000
commit6b289a8b76e7a6fec1d5f2d856995bb549907c4f (patch)
tree00ca6591ff1e1ebb21a154670184b5795f440c24 /epan/dissectors/packet-ssl-utils.c
parentaf13668831df07f36a4cf8e2bc242d57a267a367 (diff)
ssl,dtls: fix message hash for extended_master_secret
The handshake_messages for extended master secret start at Client Hello and end at ClientKeyExchange. Previously all handshake messages in a record would be hashed, possibly covering those after CKE. Now it will hash each handshake message separately. For DTLS, the CH and HVR messages must also be ignored. Additionally, DTLS needs special treatment to merge multiple fragments. Bug: 13704 Change-Id: I0c8f19b4c352c0195848ded319b6991d76542720 Reviewed-on: https://code.wireshark.org/review/21625 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-ssl-utils.c')
-rw-r--r--epan/dissectors/packet-ssl-utils.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c
index f3edf9a683..e26926d12e 100644
--- a/epan/dissectors/packet-ssl-utils.c
+++ b/epan/dissectors/packet-ssl-utils.c
@@ -8496,7 +8496,11 @@ ssl_calculate_handshake_hash(SslDecryptSession *ssl_session, tvbuff_t *tvb, guin
guint32 old_length = ssl_session->handshake_data.data_len;
ssl_debug_printf("Calculating hash with offset %d %d\n", offset, length);
ssl_session->handshake_data.data = (guchar *)wmem_realloc(wmem_file_scope(), ssl_session->handshake_data.data, old_length + length);
- tvb_memcpy(tvb, ssl_session->handshake_data.data + old_length, offset, length);
+ if (tvb) {
+ tvb_memcpy(tvb, ssl_session->handshake_data.data + old_length, offset, length);
+ } else {
+ memset(ssl_session->handshake_data.data + old_length, 0, length);
+ }
ssl_session->handshake_data.data_len += length;
}
}