From 49a525a97e68f9ba5b840c3054669a5dd6081010 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Fri, 21 Oct 2016 19:47:11 +0200 Subject: fc00: skip sha512 calculations for glib < 2.36 Our minimum supported version of glib is 2.22 at the moment. SHA512 support was added in glib 2.36. Bring up an expert info if checksum calculation is not supported by our glib version. Change-Id: I116b32f63a4342a7e4198eaae8a35189fcc92edc Reviewed-on: https://code.wireshark.org/review/18391 Reviewed-by: Martin Kaiser Petri-Dish: Martin Kaiser Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/dissectors/packet-fc00.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'epan/dissectors/packet-fc00.c') diff --git a/epan/dissectors/packet-fc00.c b/epan/dissectors/packet-fc00.c index 7a40e97a18..17f889ce5b 100644 --- a/epan/dissectors/packet-fc00.c +++ b/epan/dissectors/packet-fc00.c @@ -27,6 +27,9 @@ #include +#include + +#include #include /* Prototypes */ @@ -51,6 +54,8 @@ static int hf_fc00_authenticator = -1; static int hf_fc00_temp_publicy_key = -1; static int hf_fc00_payload = -1; +static expert_field ei_fc00_chksum_unsupported = EI_INIT; + /* Cjdns constants */ #define SESSION_STATE_OFF 0 #define SESSION_STATE_LEN 4 @@ -174,6 +179,7 @@ dissect_cryptoauth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da proto_tree_add_item(fc00_tree, hf_fc00_random_nonce, tvb, NONCE_OFF, NONCE_LEN, ENC_NA); +#if GLIB_CHECK_VERSION(2, 36, 0) /* sha512 support was added in glib 2.36 */ { GChecksum *hash = g_checksum_new(G_CHECKSUM_SHA512); gsize digest_len = g_checksum_type_get_length(G_CHECKSUM_SHA512); @@ -202,6 +208,9 @@ dissect_cryptoauth(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da proto_tree_add_ipv6(key_tree, hf_fc00_ip_address, tvb, PUBLIC_KEY_OFF, PUBLIC_KEY_LEN, (struct e_in6_addr*)ip_buf); } +#else + proto_tree_add_expert(fc00_tree, pinfo, &ei_fc00_chksum_unsupported, tvb, PUBLIC_KEY_OFF, PUBLIC_KEY_LEN); +#endif proto_tree_add_item(fc00_tree, hf_fc00_authenticator, tvb, POLY_AUTH_OFF, POLY_AUTH_LEN, ENC_NA); @@ -310,16 +319,27 @@ proto_register_fc00(void) } }; + static ei_register_info ei[] = { + { &ei_fc00_chksum_unsupported, + { "fc00.chksum_unsupported", PI_DECRYPTION, PI_NOTE, + "checksum calculation is not supported", + EXPFILL }} + }; + static gint *ett[] = { &ett_fc00, &ett_fc00_auth, &ett_fc00_key }; + expert_module_t *expert_fc00; + proto_fc00 = proto_register_protocol("Fc00 CryptoAuth", "Fc00", "fc00"); proto_register_field_array(proto_fc00, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_fc00 = expert_register_protocol(proto_fc00); + expert_register_field_array(expert_fc00, ei, array_length(ei)); } void -- cgit v1.2.3