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
82bool
83dot11decrypt_prf(const uint8_t *key, size_t key_len,
84 const char *label,
85 const uint8_t *context, size_t context_len,
86 int hash_algo,
87 uint8_t *output, size_t output_len);
88
89bool
90dot11decrypt_kdf(const uint8_t *key, size_t key_len,
91 const char *label,
92 const uint8_t *context, size_t context_len,
93 int hash_algo,
94 uint8_t *output, size_t output_len);
95
96bool
97dot11decrypt_derive_pmk_r0(const uint8_t *xxkey, size_t xxkey_len,
98 const uint8_t *ssid, size_t ssid_len,
99 const uint8_t mdid[2],
100 const uint8_t *r0kh_id, size_t r0kh_id_len,
101 const uint8_t s0kh_id[DOT11DECRYPT_MAC_LEN],
102 int hash_algo,
103 uint8_t *pmk_r0,
104 size_t *pmk_r0_len,
105 uint8_t pmk_r0_name[16]);
106
107bool
108dot11decrypt_derive_pmk_r1(const uint8_t *pmk_r0, size_t pmk_r0_len,
109 const uint8_t *pmk_r0_name,
110 const uint8_t *r1kh_id, const uint8_t *s1kh_id,
111 int hash_algo,
112 uint8_t *pmk_r1, size_t *pmk_r1_len,
113 uint8_t *pmk_r1_name);
114
115bool
116dot11decrypt_derive_ft_ptk(const uint8_t *pmk_r1, size_t pmk_r1_len,
117 const uint8_t *pmk_r1_name,
118 const uint8_t *snonce, const uint8_t *anonce,
119 const uint8_t *bssid, const uint8_t *sta_addr,
120 int hash_algo,
121 uint8_t *ptk, const size_t ptk_len, uint8_t *ptk_name);
122#endif /* _DOT11DECRYPT_UTIL_H */
123
124/*
125 * Editor modelines
126 *
127 * Local Variables:
128 * c-basic-offset: 4
129 * tab-width: 8
130 * indent-tabs-mode: nil
131 * End:
132 *
133 * ex: set shiftwidth=4 tabstop=8 expandtab:
134 * :indentSize=4:tabSize=8:noTabs=true:
135 */
#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
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])
Definition dot11decrypt_util.c:261
Definition dot11decrypt_int.h:163
Definition dot11decrypt_int.h:142