diff options
author | Erik de Jong <erikdejong@gmail.com> | 2017-02-13 19:31:26 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2017-03-02 23:58:05 +0000 |
commit | f1c75cf6ef7e9f9de1ec7fd798df941b972ec71c (patch) | |
tree | 7d7c2f66bf7595e010026d6f4d3b3a53175af824 /epan/dissectors/packet-data.c | |
parent | 4bd3c4d44ddcdf8e98fdf08a425e3a68e9b18395 (diff) |
Rewrite dissectors to use Libgcrypt functions.
As discussed on the mailinglist, rewriting dissectors to use Libgcrypt
functions as Libgcrypt will be mandatory after change 20030.
Removal of following functions:
- crypt_md4
- crypt_rc4*
- aes_cmac_encrypt_*
- md5_*
- sha1_*
- sha256_*
Further candidates:
- aes_*
- rijndael_*
- ...
Added functions:
- ws_hmac_buffer
Added const macros:
- HASH_MD5_LENGTH
- HASH_SHA1_LENGTH
Changes on epan/crypt/* verified with captures from
https://wiki.wireshark.org/HowToDecrypt802.11
Changes on packet-snmp.c and packet-radius.c verified with captures from
https://wiki.wireshark.org/SampleCapture
Changes on packet-tacacs.c verified with capture from
http://ccie-in-3-months.blogspot.nl/2009/04/decoding-login-credentials-regardless.html
Change-Id: Iea6ba2bf207cf0f1bf2117068fb1abcfeaafaa46
Link: https://www.wireshark.org/lists/wireshark-dev/201702/msg00011.html
Reviewed-on: https://code.wireshark.org/review/20095
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'epan/dissectors/packet-data.c')
-rw-r--r-- | epan/dissectors/packet-data.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/epan/dissectors/packet-data.c b/epan/dissectors/packet-data.c index 30247fdc38..0af98910e3 100644 --- a/epan/dissectors/packet-data.c +++ b/epan/dissectors/packet-data.c @@ -28,7 +28,7 @@ #include <epan/packet.h> #include <epan/prefs.h> #include <epan/to_str.h> -#include <wsutil/md5.h> +#include <wsutil/wsgcrypt.h> #include <wsutil/str_util.h> /* proto_data cannot be static because it's referenced in the @@ -90,17 +90,13 @@ dissect_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ if(generate_md5_hash) { const guint8 *cp; - md5_state_t md_ctx; - md5_byte_t digest[16]; + guint8 digest[HASH_MD5_LENGTH]; const gchar *digest_string; cp = tvb_get_ptr(tvb, 0, bytes); - md5_init(&md_ctx); - md5_append(&md_ctx, cp, bytes); - md5_finish(&md_ctx, digest); - - digest_string = bytestring_to_str(wmem_packet_scope(), digest, 16, '\0'); + gcry_md_hash_buffer(GCRY_MD_MD5, digest, cp, bytes); + digest_string = bytestring_to_str(wmem_packet_scope(), digest, HASH_MD5_LENGTH, '\0'); ti = proto_tree_add_string(data_tree, &hfi_data_md5_hash, tvb, 0, 0, digest_string); PROTO_ITEM_SET_GENERATED(ti); } |