From a67082d35438cd02cf5d75b0c1e8c7410c580ec9 Mon Sep 17 00:00:00 2001 From: Robert Sauter Date: Wed, 28 Mar 2018 22:49:58 +0200 Subject: IEEE 802.15.4: fix decryption results based on uninitialized data Refactor ieee802154_set_mac_key to return the number of keys set and only try to decrypt with the alt_key if actually provided Bug: 14522 Change-Id: I40802dff8c08f7f82b792fb16f5f91aa3b9e20cc Reviewed-on: https://code.wireshark.org/review/26677 Reviewed-by: Peter Wu Petri-Dish: Peter Wu Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-ieee802154.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'epan/dissectors/packet-ieee802154.h') diff --git a/epan/dissectors/packet-ieee802154.h b/epan/dissectors/packet-ieee802154.h index 43be02d328..5d828c370f 100644 --- a/epan/dissectors/packet-ieee802154.h +++ b/epan/dissectors/packet-ieee802154.h @@ -542,19 +542,19 @@ typedef struct { ieee802154_decrypt_status* status; } ieee802154_decrypt_info_t; -/** Fill key and alt_key based on the provided information from the frame and an IEEE 802.15.4 preference table entry */ -typedef gboolean (*ieee802154_set_key_func) (ieee802154_packet * packet, unsigned char* key, unsigned char* alt_key, ieee802154_key_t* key_info); +/** Fill key and alt_key based on the provided information from the frame and an IEEE 802.15.4 preference table entry + * and return the number of keys set (0: none, 1: just key, 2: key and alt_key) */ +typedef guint (*ieee802154_set_key_func) (ieee802154_packet *packet, unsigned char *key, unsigned char *alt_key, ieee802154_key_t *uat_key); /** Decrypt the payload with the provided information */ typedef tvbuff_t* (*ieee802154_decrypt_func) (tvbuff_t *, guint, packet_info *, ieee802154_packet *, ieee802154_decrypt_info_t*); /** Loop over the keys specified in the IEEE 802.15.4 preferences, try to use them with the specified set_key_func * and try to decrypt with the specified decrypt_func */ -tvbuff_t *decrypt_ieee802154_payload(tvbuff_t * tvb, guint offset, packet_info * pinfo, proto_tree* key_tree, ieee802154_packet * packet, - ieee802154_decrypt_info_t* decrypt_info, ieee802154_set_key_func set_key_func, ieee802154_decrypt_func decrypt_func); +tvbuff_t *decrypt_ieee802154_payload(tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *key_tree, ieee802154_packet *packet, + ieee802154_decrypt_info_t *decrypt_info, ieee802154_set_key_func set_key_func, ieee802154_decrypt_func decrypt_func); -typedef gboolean (*ieee802154_set_mac_key_func) (ieee802154_packet * packet, unsigned char* key, unsigned char* alt_key, ieee802154_key_t* uat_key); -extern void register_ieee802154_mac_key_hash_handler(guint hash_identifier, ieee802154_set_mac_key_func key_func); +extern void register_ieee802154_mac_key_hash_handler(guint hash_identifier, ieee802154_set_key_func key_func); /* Short to Extended Address Prototypes */ extern ieee802154_map_rec *ieee802154_addr_update(ieee802154_map_tab_t *, guint16, guint16, guint64, -- cgit v1.2.3