Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
dot11decrypt_util.h
Go to the documentation of this file.
1
10#ifndef _DOT11DECRYPT_UTIL_H
11#define _DOT11DECRYPT_UTIL_H
12
13#include "dot11decrypt_int.h"
14
27 const uint8_t *A1,
28 const uint8_t *A2,
29 const uint8_t *A3,
30 uint8_t *aad,
31 size_t *aad_len);
32
47static inline void dot11decrypt_get_nonce_aad_addrs(
49 const uint8_t *ap_mld_mac,
50 const uint8_t *sta_mld_mac,
51 const uint8_t **A1,
52 const uint8_t **A2,
53 const uint8_t **A3
54)
55{
56 *A1 = wh->addr1;
57 *A2 = wh->addr2;
58 *A3 = wh->addr3;
59
60 if (ap_mld_mac && !(wh->addr1[0] & 1) &&
61 DOT11DECRYPT_TYPE(wh->fc[0]) == DOT11DECRYPT_TYPE_DATA) {
62 uint8_t ds = wh->fc[1] & DOT11DECRYPT_FC1_DIR_MASK;
63 if (ds == IEEE80211_FC1_DIR_TODS) {
64 *A1 = ap_mld_mac;
65 *A2 = sta_mld_mac;
66 } else if (ds == IEEE80211_FC1_DIR_FROMDS) {
67 *A1 = sta_mld_mac;
68 *A2 = ap_mld_mac;
69 }
70 // TODO 4 addr support
71
72 if (DOT11DECRYPT_IS_QOS_DATA(wh)) {
74 // The MPDU is an A-MSDU.
75 // A3 is BSSID and shall be set to MLD MAC of the AP MLD when building AAD.
76 if (qwh->qos[0] & 0x80)
77 *A3 = ap_mld_mac;
78 }
79 }
80}
81
97bool
98dot11decrypt_prf(const uint8_t *key, size_t key_len,
99 const char *label,
100 const uint8_t *context, size_t context_len,
101 int hash_algo,
102 uint8_t *output, size_t output_len);
103
122bool
123dot11decrypt_kdf(const uint8_t *key, size_t key_len,
124 const char *label,
125 const uint8_t *context, size_t context_len,
126 int hash_algo,
127 uint8_t *output, size_t output_len);
128
149bool
150dot11decrypt_derive_pmk_r0(const uint8_t *xxkey, size_t xxkey_len,
151 const uint8_t *ssid, size_t ssid_len,
152 const uint8_t mdid[2],
153 const uint8_t *r0kh_id, size_t r0kh_id_len,
154 const uint8_t s0kh_id[DOT11DECRYPT_MAC_LEN],
155 int hash_algo,
156 uint8_t *pmk_r0,
157 size_t *pmk_r0_len,
158 uint8_t pmk_r0_name[16]);
159
176bool
177dot11decrypt_derive_pmk_r1(const uint8_t *pmk_r0, size_t pmk_r0_len,
178 const uint8_t *pmk_r0_name,
179 const uint8_t *r1kh_id, const uint8_t *s1kh_id,
180 int hash_algo,
181 uint8_t *pmk_r1, size_t *pmk_r1_len,
182 uint8_t *pmk_r1_name);
183
206bool
207dot11decrypt_derive_ft_ptk(const uint8_t *pmk_r1, size_t pmk_r1_len,
208 const uint8_t *pmk_r1_name,
209 const uint8_t *snonce, const uint8_t *anonce,
210 const uint8_t *bssid, const uint8_t *sta_addr,
211 int hash_algo,
212 uint8_t *ptk, const size_t ptk_len, uint8_t *ptk_name);
213#endif /* _DOT11DECRYPT_UTIL_H */
214
215/*
216 * Editor modelines
217 *
218 * Local Variables:
219 * c-basic-offset: 4
220 * tab-width: 8
221 * indent-tabs-mode: nil
222 * End:
223 *
224 * ex: set shiftwidth=4 tabstop=8 expandtab:
225 * :indentSize=4:tabSize=8:noTabs=true:
226 */
#define DOT11DECRYPT_TYPE(FrameControl_0)
Definition dot11decrypt_int.h:82
bool dot11decrypt_derive_ft_ptk(const uint8_t *pmk_r1, size_t pmk_r1_len, const uint8_t *pmk_r1_name, const uint8_t *snonce, const uint8_t *anonce, const uint8_t *bssid, const uint8_t *sta_addr, int hash_algo, uint8_t *ptk, const size_t ptk_len, uint8_t *ptk_name)
Derive the FT PTK using the provided parameters.
bool dot11decrypt_kdf(const uint8_t *key, size_t key_len, const char *label, const uint8_t *context, size_t context_len, int hash_algo, uint8_t *output, size_t output_len)
Perform a KDF (Key Derivation Function) using the specified parameters.
Definition dot11decrypt_util.c:175
bool dot11decrypt_derive_pmk_r1(const uint8_t *pmk_r0, size_t pmk_r0_len, const uint8_t *pmk_r0_name, const uint8_t *r1kh_id, const uint8_t *s1kh_id, int hash_algo, uint8_t *pmk_r1, size_t *pmk_r1_len, uint8_t *pmk_r1_name)
Derive PMK-R1 from PMK-R0 using a key derivation function.
Definition dot11decrypt_util.c:327
void dot11decrypt_construct_aad(PDOT11DECRYPT_MAC_FRAME wh, const uint8_t *A1, const uint8_t *A2, const uint8_t *A3, uint8_t *aad, size_t *aad_len)
Constructs the AAD (Additional Authentication Data) for a 802.11 MAC frame.
Definition dot11decrypt_util.c:35
bool dot11decrypt_derive_pmk_r0(const uint8_t *xxkey, size_t xxkey_len, const uint8_t *ssid, size_t ssid_len, const uint8_t mdid[2], const uint8_t *r0kh_id, size_t r0kh_id_len, const uint8_t s0kh_id[6], int hash_algo, uint8_t *pmk_r0, size_t *pmk_r0_len, uint8_t pmk_r0_name[16])
Derive PMK-R0 using the provided parameters.
Definition dot11decrypt_util.c:261
bool dot11decrypt_prf(const uint8_t *key, size_t key_len, const char *label, const uint8_t *context, size_t context_len, int hash_algo, uint8_t *output, size_t output_len)
IEEE 802.11-2016 12.7.1.2 PRF (Pseudo Random Function)
Definition dot11decrypt_util.c:118
IEEE 802.11 MAC frame header without Address 4 field, with QoS Control field (QoS data frames).
Definition dot11decrypt_int.h:169
unsigned char qos[2]
Definition dot11decrypt_int.h:176
IEEE 802.11 MAC frame header without Address 4 field.
Definition dot11decrypt_int.h:144
unsigned char addr2[6]
Definition dot11decrypt_int.h:148
unsigned char addr1[6]
Definition dot11decrypt_int.h:147
unsigned char fc[2]
Definition dot11decrypt_int.h:145
unsigned char addr3[6]
Definition dot11decrypt_int.h:149