| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
packet-edhoc.h
1/* packet-cose.h
2 * Definitions for Ephemeral Diffie-Hellman Over COSE (EDHOC) dissection
3 * References:
4 * RFC 9528: https://tools.ietf.org/html/rfc9528
5 *
6 * Copyright 2024-2025, Brian Sipos <brian.sipos@gmail.com>
7 *
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
11 *
12 * SPDX-License-Identifier: LGPL-2.1-or-later
13 */
14#ifndef __PACKET_EDHOC_H__
15#define __PACKET_EDHOC_H__
16
17#include "packet-cose.h"
18#include <epan/conversation.h>
19#include <glib.h>
20#include <stdint.h>
21#include <stdbool.h>
22
45 typedef struct edhoc_state_t {
47 conversation_t *conv;
49 bool prepend_cid;
50
52 wmem_list_t *session_list;
54 wmem_tree_t *session_map;
55} edhoc_state_t;
56
61 typedef struct {
63 edhoc_state_t *parent;
65 uint64_t sess_idx;
66
68 bool seen_msg1;
70 uint32_t frame_msg1;
72 bool seen_msg2;
74 uint32_t frame_msg2;
76 bool seen_msg3;
78 uint32_t frame_msg3;
80 bool seen_msg4;
82 uint32_t frame_msg4;
83
84 /* Errors can only be present after #seen_msg1 is true.
85 * But they can be sent from either side of the session.
86 */
88 bool seen_error;
90 uint32_t frame_error;
91
93 int64_t method;
95 int64_t suite;
97 const struct edhoc_cs_s *found_cs;
99 const cose_aead_props_t *aead_props;
101 const cose_hash_props_t *hash_props;
103 const cose_ecc_props_t *ecc_props;
104
106 GBytes *gx_data;
108 GBytes *prk_2e;
110 GBytes *prk_3e2m;
112 GBytes *prk_4e3m;
114 GBytes *prk_out;
116 GBytes *prk_exporter;
117
118} edhoc_session_t;
119
128 edhoc_state_t * edhoc_state_new(conversation_t *conv);
129
133void edhoc_state_free(edhoc_state_t *state);
134
145GBytes * edhoc_exporter_kdf(const edhoc_session_t *sess, int64_t label, GBytes *ctx, size_t length);
146
147#endif /* __PACKET_EDHOC_H__ */
conversation.h
_wmem_list_t
Definition wmem_list.c:23
_wmem_tree_t
Internal representation of a wmem balanced tree.
Definition wmem_tree-int.h:81
conversation
Definition conversation.h:230
cose_aead_props_t
Derived properties of AEAD encryption algorithm.
Definition packet-cose.h:89
cose_ecc_props_t
Derived properties of AEAD encryption algorithm.
Definition packet-cose.h:113
cose_hash_props_t
Derived properties of hash algorithm.
Definition packet-cose.h:68
edhoc_cs_s
Definition packet-edhoc.c:173
edhoc_session_t
Definition packet-edhoc.h:61
edhoc_session_t::sess_idx
uint64_t sess_idx
The session index within the state, starting at zero.
Definition packet-edhoc.h:65
edhoc_session_t::seen_msg3
bool seen_msg3
True if message 3 has been seen.
Definition packet-edhoc.h:76
edhoc_session_t::frame_msg3
uint32_t frame_msg3
The frame of message 3 if seen_msg3 is true.
Definition packet-edhoc.h:78
edhoc_session_t::aead_props
const cose_aead_props_t * aead_props
Lookup into COSE table for AEAD properties.
Definition packet-edhoc.h:99
edhoc_session_t::seen_error
bool seen_error
True if an EDHOC error message has been seen so far.
Definition packet-edhoc.h:88
edhoc_session_t::prk_exporter
GBytes * prk_exporter
Pointer to derived data owned by this session.
Definition packet-edhoc.h:116
edhoc_session_t::hash_props
const cose_hash_props_t * hash_props
Lookup into COSE table for hash properties.
Definition packet-edhoc.h:101
edhoc_session_t::gx_data
GBytes * gx_data
Pointer to extracted message 1 G_X owned by this session.
Definition packet-edhoc.h:106
edhoc_session_t::seen_msg1
bool seen_msg1
True if message 1 has been seen.
Definition packet-edhoc.h:68
edhoc_session_t::frame_msg1
uint32_t frame_msg1
The frame of message 1 if seen_msg1 is true.
Definition packet-edhoc.h:70
edhoc_session_t::ecc_props
const cose_ecc_props_t * ecc_props
Lookup into COSE table for ECC properties.
Definition packet-edhoc.h:103
edhoc_session_t::prk_out
GBytes * prk_out
Pointer to derived data owned by this session.
Definition packet-edhoc.h:114
edhoc_session_t::frame_error
uint32_t frame_error
The frame of the first error if seen_error is true.
Definition packet-edhoc.h:90
edhoc_session_t::frame_msg4
uint32_t frame_msg4
The frame of message 4 if seen_msg4 is true.
Definition packet-edhoc.h:82
edhoc_session_t::frame_msg2
uint32_t frame_msg2
The frame of message 2 if seen_msg2 is true.
Definition packet-edhoc.h:74
edhoc_session_t::prk_3e2m
GBytes * prk_3e2m
Pointer to external keyfile PRK data.
Definition packet-edhoc.h:110
edhoc_session_t::seen_msg4
bool seen_msg4
True if message 4 has been seen.
Definition packet-edhoc.h:80
edhoc_session_t::seen_msg2
bool seen_msg2
True if message 2 has been seen.
Definition packet-edhoc.h:72
edhoc_session_t::parent
edhoc_state_t * parent
The parent protocol state.
Definition packet-edhoc.h:63
edhoc_session_t::prk_2e
GBytes * prk_2e
Pointer to external keyfile PRK data.
Definition packet-edhoc.h:108
edhoc_session_t::suite
int64_t suite
The selected cipher suite from message 1.
Definition packet-edhoc.h:95
edhoc_session_t::found_cs
const struct edhoc_cs_s * found_cs
Lookup into a static table for suite.
Definition packet-edhoc.h:97
edhoc_session_t::method
int64_t method
The selected method from message 1.
Definition packet-edhoc.h:93
edhoc_session_t::prk_4e3m
GBytes * prk_4e3m
Pointer to external keyfile PRK data.
Definition packet-edhoc.h:112
edhoc_state_t
State of one or more sessions within a conversation.
Definition packet-edhoc.h:45
edhoc_state_t::conv
conversation_t * conv
Parent conversation for these sessions.
Definition packet-edhoc.h:47
edhoc_state_t::session_map
wmem_tree_t * session_map
Sessions organized by frame number ranges which they cover.
Definition packet-edhoc.h:54
edhoc_state_t::prepend_cid
bool prepend_cid
An indicator of whether a CID is expected to be prepended.
Definition packet-edhoc.h:49
edhoc_state_t::session_list
wmem_list_t * session_list
Sessions in this state, values are edhoc_session_t *.
Definition packet-edhoc.h:52