Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
packet-zbee-security.h
1/* packet-zbee-security.h
2 * Dissector helper routines for encrypted ZigBee frames.
3 * By Owen Kirby <[email protected]>
4 * Copyright 2009 Exegin Technologies Limited
5 *
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <[email protected]>
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 */
17typedef struct{
18 /* The fields of the Aux Header */
19 uint8_t control; /* needed to decrypt */
20 uint32_t counter; /* needed to decrypt */
21 uint64_t src64; /* needed to decrypt */
22 uint8_t key_seqno;
23
24 uint8_t level;
25 uint8_t key_id; /* needed to decrypt */
26 bool nonce;
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#define ZBEE_SEC_CONTROL_VERIFIED_FC 0x40
34
35/* ZigBee security levels. */
36#define ZBEE_SEC_NONE 0x00
37#define ZBEE_SEC_MIC32 0x01
38#define ZBEE_SEC_MIC64 0x02
39#define ZBEE_SEC_MIC128 0x03
40#define ZBEE_SEC_ENC 0x04
41#define ZBEE_SEC_ENC_MIC32 0x05
42#define ZBEE_SEC_ENC_MIC64 0x06
43#define ZBEE_SEC_ENC_MIC128 0x07
44
45/* ZigBee Key Types */
46#define ZBEE_SEC_KEY_LINK 0x00
47#define ZBEE_SEC_KEY_NWK 0x01
48#define ZBEE_SEC_KEY_TRANSPORT 0x02
49#define ZBEE_SEC_KEY_LOAD 0x03
50
51/* ZigBee Security Constants. */
52#define ZBEE_SEC_CONST_L 2
53#define ZBEE_SEC_CONST_NONCE_LEN (ZBEE_SEC_CONST_BLOCKSIZE-ZBEE_SEC_CONST_L-1)
54#define ZBEE_SEC_CONST_BLOCKSIZE 16
55
56/* CCM* Flags */
57#define ZBEE_SEC_CCM_FLAG_L 0x01 /* 3-bit encoding of (L-1). */
58#define ZBEE_SEC_CCM_FLAG_M(m) ((((m-2)/2) & 0x7)<<3) /* 3-bit encoding of (M-2)/2 shifted 3 bits. */
59#define ZBEE_SEC_CCM_FLAG_ADATA(l_a) ((l_a>0)?0x40:0x00) /* Adata flag. */
60
61/* Program Constants */
62#define ZBEE_SEC_PC_KEY 0
63
64/* Init routine for the Security dissectors. */
65extern void zbee_security_register (module_t *module, int proto);
66
67/* Security Dissector Routine. */
68extern tvbuff_t *dissect_zbee_secure(tvbuff_t *, packet_info *, proto_tree *, unsigned);
69extern bool zbee_sec_ccm_decrypt(const char *, const char *, const char *, const char *, char *, unsigned, unsigned, unsigned);
70
71/* nwk key ring update */
72extern void zbee_sec_add_key_to_keyring(packet_info *, const uint8_t *);
73
74#endif /* PACKET_ZBEE_SECURITY_H */
75
76/*
77 * Editor modelines - https://www.wireshark.org/tools/modelines.html
78 *
79 * Local variables:
80 * c-basic-offset: 4
81 * tab-width: 8
82 * indent-tabs-mode: nil
83 * End:
84 *
85 * vi: set shiftwidth=4 tabstop=8 expandtab:
86 * :indentSize=4:tabSize=8:noTabs=true:
87 */
Definition packet_info.h:43
Definition proto.h:903
Definition prefs-int.h:27
Definition tvbuff-int.h:35
Definition packet-zbee-security.h:17