diff options
author | Peter Wu <peter@lekensteyn.nl> | 2015-06-28 07:31:18 -0700 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-07-03 23:38:26 +0000 |
commit | 3ad976896a983178fc42a0794f137983f528cde7 (patch) | |
tree | 14da052397719898848caadd0c77facbb416a0a6 /epan/dissectors/packet-ssl-utils.c | |
parent | ba9aa3015f29f07bf81cdfebdfab54fdc379b94d (diff) |
ssl,dtls: split init/cleanup routines
Minor functional change: instead of an empty hash table, now the
ssl_session_hash and ssl_crandom_hash structures point will be set to
NULL when files are closed.
API change: drop the ssl_keylog_file parameter from ssl_common_init,
add a new ssl_common_cleanup parameter instead.
Change-Id: I65efe71f8347fe9685359f8ed70cfb9673712421
Reviewed-on: https://code.wireshark.org/review/9226
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-ssl-utils.c')
-rw-r--r-- | epan/dissectors/packet-ssl-utils.c | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c index a1fe2903e7..4cd7415e08 100644 --- a/epan/dissectors/packet-ssl-utils.c +++ b/epan/dissectors/packet-ssl-utils.c @@ -4367,34 +4367,28 @@ ssl_get_data_info(int proto, packet_info *pinfo, gint key) /* initialize/reset per capture state data (ssl sessions cache) */ void -ssl_common_init(ssl_master_key_map_t *mk_map, FILE **ssl_keylog_file, +ssl_common_init(ssl_master_key_map_t *mk_map, StringInfo *decrypted_data, StringInfo *compressed_data) { - if (mk_map->session) - g_hash_table_remove_all(mk_map->session); - else - mk_map->session = g_hash_table_new(ssl_hash, ssl_equal); - - if (mk_map->crandom) - g_hash_table_remove_all(mk_map->crandom); - else - mk_map->crandom = g_hash_table_new(ssl_hash, ssl_equal); - - if (mk_map->pre_master) - g_hash_table_remove_all(mk_map->pre_master); - else - mk_map->pre_master = g_hash_table_new(ssl_hash, ssl_equal); + mk_map->session = g_hash_table_new(ssl_hash, ssl_equal); + mk_map->crandom = g_hash_table_new(ssl_hash, ssl_equal); + mk_map->pre_master = g_hash_table_new(ssl_hash, ssl_equal); + mk_map->pms = g_hash_table_new(ssl_hash, ssl_equal); + ssl_data_alloc(decrypted_data, 32); + ssl_data_alloc(compressed_data, 32); +} - if (mk_map->pms) - g_hash_table_remove_all(mk_map->pms); - else - mk_map->pms = g_hash_table_new(ssl_hash, ssl_equal); +void +ssl_common_cleanup(ssl_master_key_map_t *mk_map, FILE **ssl_keylog_file, + StringInfo *decrypted_data, StringInfo *compressed_data) +{ + g_hash_table_destroy(mk_map->session); + g_hash_table_destroy(mk_map->crandom); + g_hash_table_destroy(mk_map->pre_master); + g_hash_table_destroy(mk_map->pms); g_free(decrypted_data->data); - ssl_data_alloc(decrypted_data, 32); - g_free(compressed_data->data); - ssl_data_alloc(compressed_data, 32); /* close the previous keylog file now that the cache are cleared, this * allows the cache to be filled with the full keylog file contents. */ |