Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / plugins / epan / opcua / opcua_keyset.h
blobfaa1bea6d2d40b8d5197b4b4a64f1d697761b88d
1 /******************************************************************************
2 ** Copyright (C) 2006-2023 ascolab GmbH. All Rights Reserved.
3 ** Web: http://www.ascolab.com
4 **
5 ** SPDX-License-Identifier: GPL-2.0-or-later
6 **
7 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
8 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9 **
10 ** Project: OpcUa Wireshark Plugin
12 ** Description: OpcUa Protocol Decoder.
14 ** Author: Gerhard Gappmeier <gerhard.gappmeier@ascolab.com>
15 ******************************************************************************/
17 #ifndef __OPCUA_KEYSET_H__
18 #define __OPCUA_KEYSET_H__
20 #include <stdint.h>
22 /** symmetric encryption keyset */
23 struct ua_keyset {
24 uint64_t id; /** keyset identifier: combination of securechannel_id and token_id */
25 unsigned char client_iv[16]; /**< Client side IV. Always 128 bit. */
26 unsigned char server_iv[16]; /**< Server side IV. Always 128 bit. */
27 unsigned char client_key[32]; /**< client encryption key */
28 unsigned char server_key[32]; /**< server encryption key */
29 unsigned int client_key_len; /**< AES key length: 16 (AES-128) or 32 (AES-256) */
30 unsigned int server_key_len; /**< AES key length: 16 (AES-128) or 32 (AES-256) */
31 unsigned int client_sig_len; /**< Client side symmetric signature length. */
32 unsigned int server_sig_len; /**< Server side symmetric signature length. */
35 int ua_keysets_init(void);
36 int ua_keysets_clear(void);
38 /**
39 * Creates a unique keyset id from securechannel_id and token_id.
41 * @param securechannel_id Identifies the secure channel to be able to distinguish
42 * different connections. This is a randomly generated id.
43 * @param token_id Identifies the keyset of a channel. This number normally starts with
44 * 1 and gets incremented with every secure channel renew.
46 * @return 64bit Id.
48 static inline uint64_t ua_keyset_id(uint32_t securechannel_id, uint32_t token_id)
50 return ((uint64_t)securechannel_id << 32) | token_id;
53 struct ua_keyset *ua_keysets_add(void);
54 void ua_keysets_sort(void);
55 struct ua_keyset *ua_keysets_lookup(uint64_t id);
56 void ua_keysets_dump(void);
58 #endif /* __OPCUA_KEYSET_H__ */