Wireshark  4.3.0
The Wireshark network protocol analyzer
packet-oscore.h
1 /* packet-oscore.h
2  *
3  * Wireshark - Network traffic analyzer
4  * By Gerald Combs <gerald@wireshark.org>
5  * Copyright 1998 Gerald Combs
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9 
10 #ifndef __PACKET_OSCORE_H__
11 #define __PACKET_OSCORE_H__
12 
13 /* OSCORE uses AEAD algorithms defined in RFC8152 (COSE)
14  * We only implement the default algorithm which corresponds to CCM*
15  * */
16 typedef enum {
17  COSE_AES_CCM_16_64_128 = 10,
18 } cose_aead_alg_t;
19 
20 typedef enum {
21  STATUS_ERROR_DECRYPT_FAILED = 0,
22  STATUS_ERROR_CBCMAC_FAILED,
23  STATUS_ERROR_TAG_CHECK_FAILED,
24  STATUS_ERROR_MESSAGE_TOO_SMALL,
25  STATUS_SUCCESS_DECRYPTED_TAG_TRUNCATED,
26  STATUS_SUCCESS_DECRYPTED_TAG_CHECKED,
27 } oscore_decryption_status_t;
28 
29 /* Structure containing information regarding all necessary OSCORE message fields. */
30 typedef struct oscore_context {
31  /* Pre-Shared Parameters as Strings */
32  gchar *master_secret_prefs;
33  gchar *master_salt_prefs;
34  gchar *id_context_prefs;
35  gchar *sender_id_prefs;
36  gchar *recipient_id_prefs;
37  cose_aead_alg_t algorithm;
38  /* Pre-Shared Parameters as Byte Arrays */
39  GByteArray *master_secret;
40  GByteArray *master_salt;
41  GByteArray *id_context;
42  GByteArray *sender_id;
43  GByteArray *recipient_id;
44  /* Derived Parameters */
45  GByteArray *request_decryption_key;
46  GByteArray *response_decryption_key;
47  GByteArray *common_iv; /* IV used to generate the nonce */
49 
50 /* Data from the lower layer (CoAP/HTTP) necessary for OSCORE to decrypt the packet */
51 typedef struct oscore_info {
52  guint8 *kid;
53  guint8 kid_len;
54  guint8 *kid_context;
55  guint8 kid_context_len;
56  guint8 *piv;
57  guint8 piv_len;
58  guint8 *request_piv;
59  guint8 request_piv_len;
60  gboolean response;
62 
63 #endif /* __PACKET_OSCORE_H__ */
64 
65 /*
66  * Editor modelines - https://www.wireshark.org/tools/modelines.html
67  *
68  * Local variables:
69  * c-basic-offset: 4
70  * tab-width: 8
71  * indent-tabs-mode: nil
72  * End:
73  *
74  * vi: set shiftwidth=4 tabstop=8 expandtab:
75  * :indentSize=4:tabSize=8:noTabs=true:
76  */
Definition: packet-oscore.h:30
Definition: packet-oscore.h:51