Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

packet-zbee-security.h
1 /* packet-zbee-security.h
2 * Dissector helper routines for encrypted ZigBee frames.
3 * By Owen Kirby <osk@exegin.com>
4 * Copyright 2009 Exegin Technologies Limited
5 *
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
9 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
11 */
12
13 #ifndef PACKET_ZBEE_SECURITY_H
14 #define PACKET_ZBEE_SECURITY_H
15
16 /* Structure containing the fields stored in the Aux Header */
17 typedef struct{
18 /* The fields of the Aux Header */
19 guint8 control; /* needed to decrypt */
20 guint32 counter; /* needed to decrypt */
21 guint64 src64; /* needed to decrypt */
22 guint8 key_seqno;
23
24 guint8 level;
25 guint8 key_id; /* needed to decrypt */
26 gboolean nonce;
27 } zbee_security_packet;
28
29 /* Bit masks for the Security Control Field. */
30 #define ZBEE_SEC_CONTROL_LEVEL 0x07
31 #define ZBEE_SEC_CONTROL_KEY 0x18
32 #define ZBEE_SEC_CONTROL_NONCE 0x20
33
34 /* ZigBee security levels. */
35 #define ZBEE_SEC_NONE 0x00
36 #define ZBEE_SEC_MIC32 0x01
37 #define ZBEE_SEC_MIC64 0x02
38 #define ZBEE_SEC_MIC128 0x03
39 #define ZBEE_SEC_ENC 0x04
40 #define ZBEE_SEC_ENC_MIC32 0x05
41 #define ZBEE_SEC_ENC_MIC64 0x06
42 #define ZBEE_SEC_ENC_MIC128 0x07
43
44 /* ZigBee Key Types */
45 #define ZBEE_SEC_KEY_LINK 0x00
46 #define ZBEE_SEC_KEY_NWK 0x01
47 #define ZBEE_SEC_KEY_TRANSPORT 0x02
48 #define ZBEE_SEC_KEY_LOAD 0x03
49
50 /* ZigBee Security Constants. */
51 #define ZBEE_SEC_CONST_L 2
52 #define ZBEE_SEC_CONST_NONCE_LEN (ZBEE_SEC_CONST_BLOCKSIZE-ZBEE_SEC_CONST_L-1)
53 #define ZBEE_SEC_CONST_BLOCKSIZE 16
54
55 /* CCM* Flags */
56 #define ZBEE_SEC_CCM_FLAG_L 0x01 /* 3-bit encoding of (L-1). */
57 #define ZBEE_SEC_CCM_FLAG_M(m) ((((m-2)/2) & 0x7)<<3) /* 3-bit encoding of (M-2)/2 shifted 3 bits. */
58 #define ZBEE_SEC_CCM_FLAG_ADATA(l_a) ((l_a>0)?0x40:0x00) /* Adata flag. */
59
60 /* Program Constants */
61 #define ZBEE_SEC_PC_KEY 0
62
63 /* Init routine for the Security dissectors. */
64 extern void zbee_security_register (module_t *module, int proto);
65
66 /* Security Dissector Routine. */
67 extern tvbuff_t *dissect_zbee_secure(tvbuff_t *, packet_info *, proto_tree *, guint);
68 extern gboolean zbee_sec_ccm_decrypt(const gchar *, const gchar *, const gchar *, const gchar *, gchar *, guint, guint, guint);
69
70 /* nwk key ring update */
71 extern void zbee_sec_add_key_to_keyring(packet_info *, const guint8 *);
72
73 #endif /* PACKET_ZBEE_SECURITY_H */
74
75 /*
76 * Editor modelines - http://www.wireshark.org/tools/modelines.html
77 *
78 * Local variables:
79 * c-basic-offset: 4
80 * tab-width: 8
81 * indent-tabs-mode: nil
82 * End:
83 *
84 * vi: set shiftwidth=4 tabstop=8 expandtab:
85 * :indentSize=4:tabSize=8:noTabs=true:
86 */
_packet_info
Definition: packet_info.h:44
pref_module
Definition: prefs-int.h:27
tvbuff
Definition: tvbuff-int.h:35
zbee_security_packet
Definition: packet-zbee-security.h:17
_proto_node
Definition: proto.h:759