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
15void dot11decrypt_construct_aad(
17 const uint8_t *A1,
18 const uint8_t *A2,
19 const uint8_t *A3,
20 uint8_t *aad,
21 size_t *aad_len);
22
23/*
24 * Reference: IEEE 802.11-2024 12.5.4.3.3 Construct AAD,
25 * IEEE 802.11be-2024 12.5.2.3.3 Construct AAD, 12.5.2.3.4 Construct CCM nonce,
26 * 12.5.4.3.4 Construct GCM nonce.
27 */
28static inline void dot11decrypt_get_nonce_aad_addrs(
30 const uint8_t *ap_mld_mac,
31 const uint8_t *sta_mld_mac,
32 const uint8_t **A1,
33 const uint8_t **A2,
34 const uint8_t **A3
35)
36{
37 *A1 = wh->addr1;
38 *A2 = wh->addr2;
39 *A3 = wh->addr3;
40
41 if (ap_mld_mac && !(wh->addr1[0] & 1) &&
42 DOT11DECRYPT_TYPE(wh->fc[0]) == DOT11DECRYPT_TYPE_DATA) {
43 uint8_t ds = wh->fc[1] & DOT11DECRYPT_FC1_DIR_MASK;
44 if (ds == IEEE80211_FC1_DIR_TODS) {
45 *A1 = ap_mld_mac;
46 *A2 = sta_mld_mac;
47 } else if (ds == IEEE80211_FC1_DIR_FROMDS) {
48 *A1 = sta_mld_mac;
49 *A2 = ap_mld_mac;
50 }
51 // TODO 4 addr support
52
53 if (DOT11DECRYPT_IS_QOS_DATA(wh)) {
55 // The MPDU is an A-MSDU.
56 // A3 is BSSID and shall be set to MLD MAC of the AP MLD when building AAD.
57 if (qwh->qos[0] & 0x80)
58 *A3 = ap_mld_mac;
59 }
60 }
61}
62
63bool
64dot11decrypt_prf(const uint8_t *key, size_t key_len,
65 const char *label,
66 const uint8_t *context, size_t context_len,
67 int hash_algo,
68 uint8_t *output, size_t output_len);
69
70bool
71dot11decrypt_kdf(const uint8_t *key, size_t key_len,
72 const char *label,
73 const uint8_t *context, size_t context_len,
74 int hash_algo,
75 uint8_t *output, size_t output_len);
76
77bool
78dot11decrypt_derive_pmk_r0(const uint8_t *xxkey, size_t xxkey_len,
79 const uint8_t *ssid, size_t ssid_len,
80 const uint8_t mdid[2],
81 const uint8_t *r0kh_id, size_t r0kh_id_len,
82 const uint8_t s0kh_id[DOT11DECRYPT_MAC_LEN],
83 int hash_algo,
84 uint8_t *pmk_r0,
85 size_t *pmk_r0_len,
86 uint8_t pmk_r0_name[16]);
87
88bool
89dot11decrypt_derive_pmk_r1(const uint8_t *pmk_r0, size_t pmk_r0_len,
90 const uint8_t *pmk_r0_name,
91 const uint8_t *r1kh_id, const uint8_t *s1kh_id,
92 int hash_algo,
93 uint8_t *pmk_r1, size_t *pmk_r1_len,
94 uint8_t *pmk_r1_name);
95
96bool
97dot11decrypt_derive_ft_ptk(const uint8_t *pmk_r1, size_t pmk_r1_len,
98 const uint8_t *pmk_r1_name,
99 const uint8_t *snonce, const uint8_t *anonce,
100 const uint8_t *bssid, const uint8_t *sta_addr,
101 int hash_algo,
102 uint8_t *ptk, const size_t ptk_len, uint8_t *ptk_name);
103#endif /* _DOT11DECRYPT_UTIL_H */
104
105/*
106 * Editor modelines
107 *
108 * Local Variables:
109 * c-basic-offset: 4
110 * tab-width: 8
111 * indent-tabs-mode: nil
112 * End:
113 *
114 * ex: set shiftwidth=4 tabstop=8 expandtab:
115 * :indentSize=4:tabSize=8:noTabs=true:
116 */
#define DOT11DECRYPT_TYPE(FrameControl_0)
Definition dot11decrypt_int.h:82
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)
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)
Definition dot11decrypt_util.c:327
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])
Definition dot11decrypt_util.c:261
Definition dot11decrypt_int.h:163
Definition dot11decrypt_int.h:142