Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
packet-knxip_decrypt.h
1/* packet-knxip_decrypt.h
2 * Decryption keys and decryption functions for KNX/IP Dissector
3 * Copyright 2018, ise GmbH <[email protected]>
4 *
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <[email protected]>
7 * Copyright 1998 Gerald Combs
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11#ifndef KNXIP_CRYPT_H
12#define KNXIP_CRYPT_H
13
14#define KNX_KEY_LENGTH 16
15
16// Calculate MAC for KNX IP Security or KNX Data Security
17void knx_ccm_calc_cbc_mac( uint8_t p_mac[ KNX_KEY_LENGTH ], const uint8_t key[ KNX_KEY_LENGTH ],
18 const uint8_t* a_bytes, int a_length, const uint8_t* p_bytes, int p_length,
19 const uint8_t b_0[ KNX_KEY_LENGTH ] );
20
21// Calculate MAC for KNX IP Security
22void knxip_ccm_calc_cbc_mac( uint8_t p_mac[ KNX_KEY_LENGTH ], const uint8_t key[ KNX_KEY_LENGTH ],
23 const uint8_t* a_bytes, int a_length, const uint8_t* p_bytes, int p_length,
24 const uint8_t* nonce, uint8_t nonce_length );
25
26// Encrypt for KNX IP Security or KNX Data Security
27uint8_t* knx_ccm_encrypt( uint8_t* p_result, const uint8_t key[ KNX_KEY_LENGTH ], const uint8_t* p_bytes, int p_length,
28 const uint8_t* mac, uint8_t mac_length, const uint8_t ctr_0[ KNX_KEY_LENGTH ], uint8_t s0_bytes_used_for_mac);
29
30// Encrypt for KNX IP Security
31uint8_t* knxip_ccm_encrypt( uint8_t* p_result, const uint8_t key[ KNX_KEY_LENGTH ], const uint8_t* p_bytes, int p_length,
32 const uint8_t mac[ KNX_KEY_LENGTH ], const uint8_t* nonce, uint8_t nonce_length );
33
34// Decrypt for KNX IP Security
35uint8_t* knxip_ccm_decrypt( uint8_t* p_result, const uint8_t key[ KNX_KEY_LENGTH ], const uint8_t* crypt, int crypt_length,
36 const uint8_t* nonce, uint8_t nonce_length );
37
38// For importing keyring.XML file exported from ETS:
39
41{
42 struct knx_keyring_mca_keys* next;
43 uint8_t mca[ 4 ]; // IP multicast address
44 uint8_t key[ KNX_KEY_LENGTH ]; // encryption key
45};
46
48{
49 struct knx_keyring_ga_keys* next;
50 uint16_t ga; // KNX GA
51 uint8_t key[ KNX_KEY_LENGTH ]; // encryption key
52};
53
55{
56 struct knx_keyring_ga_senders* next;
57 uint16_t ga; // KNX GA
58 uint16_t ia; // sending KNX IA
59};
60
62{
63 struct knx_keyring_ia_keys* next;
64 uint16_t ia; // KNX IA
65 uint8_t key[ KNX_KEY_LENGTH ]; // encryption key
66};
67
69{
70 struct knx_keyring_ia_seqs* next;
71 uint16_t ia; // KNX IA
72 uint64_t seq; // 6-byte sequence number
73};
74
80
81// Read KNX security keys from keyring XML file (exported from ETS)
82void read_knx_keyring_xml_file( const char* key_file, const char* password, const char* key_info_file );
83
84#endif // KNXIP_CRYPT_H
85
86/*
87 * Editor modelines - https://www.wireshark.org/tools/modelines.html
88 *
89 * Local variables:
90 * c-basic-offset: 2
91 * tab-width: 8
92 * indent-tabs-mode: nil
93 * End:
94 *
95 * vi: set shiftwidth=2 tabstop=8 expandtab:
96 * :indentSize=2:tabSize=8:noTabs=true:
97 */
Definition packet-knxip_decrypt.h:48
Definition packet-knxip_decrypt.h:55
Definition packet-knxip_decrypt.h:62
Definition packet-knxip_decrypt.h:69
Definition packet-knxip_decrypt.h:41