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
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #ifndef PACKET_ZBEE_SECURITY_H
28 #define PACKET_ZBEE_SECURITY_H
30 /* Structure containing the fields stored in the Aux Header */
32 /* The fields of the Aux Header */
33 guint8 control
; /* needed to decrypt */
34 guint32 counter
; /* needed to decrypt */
35 guint64 src64
; /* needed to decrypt */
39 guint8 key_id
; /* needed to decrypt */
41 } zbee_security_packet
;
43 /* Bit masks for the Security Control Field. */
44 #define ZBEE_SEC_CONTROL_LEVEL 0x07
45 #define ZBEE_SEC_CONTROL_KEY 0x18
46 #define ZBEE_SEC_CONTROL_NONCE 0x20
48 /* ZigBee security levels. */
49 #define ZBEE_SEC_NONE 0x00
50 #define ZBEE_SEC_MIC32 0x01
51 #define ZBEE_SEC_MIC64 0x02
52 #define ZBEE_SEC_MIC128 0x03
53 #define ZBEE_SEC_ENC 0x04
54 #define ZBEE_SEC_ENC_MIC32 0x05
55 #define ZBEE_SEC_ENC_MIC64 0x06
56 #define ZBEE_SEC_ENC_MIC128 0x07
58 /* ZigBee Key Types */
59 #define ZBEE_SEC_KEY_LINK 0x00
60 #define ZBEE_SEC_KEY_NWK 0x01
61 #define ZBEE_SEC_KEY_TRANSPORT 0x02
62 #define ZBEE_SEC_KEY_LOAD 0x03
64 /* ZigBee Security Constants. */
65 #define ZBEE_SEC_CONST_L 2
66 #define ZBEE_SEC_CONST_NONCE_LEN (ZBEE_SEC_CONST_BLOCKSIZE-ZBEE_SEC_CONST_L-1)
67 #define ZBEE_SEC_CONST_BLOCKSIZE 16
70 #define ZBEE_SEC_CCM_FLAG_L 0x01 /* 3-bit encoding of (L-1). */
71 #define ZBEE_SEC_CCM_FLAG_M(m) ((((m-2)/2) & 0x7)<<3) /* 3-bit encoding of (M-2)/2 shifted 3 bits. */
72 #define ZBEE_SEC_CCM_FLAG_ADATA(l_a) ((l_a>0)?0x40:0x00) /* Adata flag. */
74 /* Program Constants */
75 #define ZBEE_SEC_PC_KEY 0
77 /* Init routine for the Security dissectors. */
78 extern void zbee_security_register (module_t
*module
, int proto
);
79 extern void zbee_security_handoff (void);
81 /* Security Dissector Routine. */
82 extern tvbuff_t
*dissect_zbee_secure(tvbuff_t
*, packet_info
*, proto_tree
*, guint
);
84 #endif /* PACKET_ZBEE_SECURITY_H */