Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-knxip_decrypt.h
blob6b240cb381009461a7dee32af042a76f806b89da
1 /* packet-knxip_decrypt.h
2 * Decryption keys and decryption functions for KNX/IP Dissector
3 * Copyright 2018, ise GmbH <Ralf.Nasilowski@ise.de>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
11 #ifndef KNXIP_CRYPT_H
12 #define KNXIP_CRYPT_H
14 #define KNX_KEY_LENGTH 16
16 // Calculate MAC for KNX IP Security or KNX Data Security
17 void 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 ] );
21 // Calculate MAC for KNX IP Security
22 void 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 );
26 // Encrypt for KNX IP Security or KNX Data Security
27 uint8_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);
30 // Encrypt for KNX IP Security
31 uint8_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 );
34 // Decrypt for KNX IP Security
35 uint8_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 );
38 // For importing keyring.XML file exported from ETS:
40 struct knx_keyring_mca_keys
42 struct knx_keyring_mca_keys* next;
43 uint8_t mca[ 4 ]; // IP multicast address
44 uint8_t key[ KNX_KEY_LENGTH ]; // encryption key
47 struct knx_keyring_ga_keys
49 struct knx_keyring_ga_keys* next;
50 uint16_t ga; // KNX GA
51 uint8_t key[ KNX_KEY_LENGTH ]; // encryption key
54 struct knx_keyring_ga_senders
56 struct knx_keyring_ga_senders* next;
57 uint16_t ga; // KNX GA
58 uint16_t ia; // sending KNX IA
61 struct knx_keyring_ia_keys
63 struct knx_keyring_ia_keys* next;
64 uint16_t ia; // KNX IA
65 uint8_t key[ KNX_KEY_LENGTH ]; // encryption key
68 struct knx_keyring_ia_seqs
70 struct knx_keyring_ia_seqs* next;
71 uint16_t ia; // KNX IA
72 uint64_t seq; // 6-byte sequence number
75 extern struct knx_keyring_mca_keys* knx_keyring_mca_keys;
76 extern struct knx_keyring_ga_keys* knx_keyring_ga_keys;
77 extern struct knx_keyring_ga_senders* knx_keyring_ga_senders;
78 extern struct knx_keyring_ia_keys* knx_keyring_ia_keys;
79 extern struct knx_keyring_ia_seqs* knx_keyring_ia_seqs;
81 // Read KNX security keys from keyring XML file (exported from ETS)
82 void read_knx_keyring_xml_file( const char* key_file, const char* password, const char* key_info_file );
84 #endif // KNXIP_CRYPT_H
87 * Editor modelines - https://www.wireshark.org/tools/modelines.html
89 * Local variables:
90 * c-basic-offset: 2
91 * tab-width: 8
92 * indent-tabs-mode: nil
93 * End:
95 * vi: set shiftwidth=2 tabstop=8 expandtab:
96 * :indentSize=2:tabSize=8:noTabs=true: