Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-zbee-security.h
blob1865ff5db3544b5fb61f1835692a7b84abadd7f3
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
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 #ifndef PACKET_ZBEE_SECURITY_H
14 #define PACKET_ZBEE_SECURITY_H
16 /* Structure containing the fields stored in the Aux Header */
17 typedef 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;
24 uint8_t level;
25 uint8_t key_id; /* needed to decrypt */
26 bool nonce;
27 } zbee_security_packet;
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
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
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
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
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. */
61 /* Program Constants */
62 #define ZBEE_SEC_PC_KEY 0
64 /* Init routine for the Security dissectors. */
65 extern void zbee_security_register (module_t *module, int proto);
67 /* Security Dissector Routine. */
68 extern tvbuff_t *dissect_zbee_secure(tvbuff_t *, packet_info *, proto_tree *, unsigned);
69 extern bool zbee_sec_ccm_decrypt(const char *, const char *, const char *, const char *, char *, unsigned, unsigned, unsigned);
71 /* nwk key ring update */
72 extern void zbee_sec_add_key_to_keyring(packet_info *, const uint8_t *);
74 #endif /* PACKET_ZBEE_SECURITY_H */
77 * Editor modelines - https://www.wireshark.org/tools/modelines.html
79 * Local variables:
80 * c-basic-offset: 4
81 * tab-width: 8
82 * indent-tabs-mode: nil
83 * End:
85 * vi: set shiftwidth=4 tabstop=8 expandtab:
86 * :indentSize=4:tabSize=8:noTabs=true: