9#ifndef _DOT11DECRYPT_SYSTEM_H
10#define _DOT11DECRYPT_SYSTEM_H
16#define DOT11DECRYPT_RET_SUCCESS 0
17#define DOT11DECRYPT_RET_UNSUCCESS 1
19#define DOT11DECRYPT_RET_NO_DATA 1
20#define DOT11DECRYPT_RET_WRONG_DATA_SIZE 2
21#define DOT11DECRYPT_RET_REQ_DATA 3
22#define DOT11DECRYPT_RET_NO_VALID_HANDSHAKE 4
23#define DOT11DECRYPT_RET_NO_DATA_ENCRYPTED 5
25#define DOT11DECRYPT_RET_SUCCESS_HANDSHAKE -1
27#define DOT11DECRYPT_MAX_KEYS_NR 64
30#define DOT11DECRYPT_WPA_NONCE_LEN 32
31#define DOT11DECRYPT_WPA_PTK_MAX_LEN 96
32#define DOT11DECRYPT_WPA_MICKEY_MAX_LEN 32
34#define DOT11DECRYPT_WEP_128_KEY_LEN 16
37#define DOT11DECRYPT_MAC_LEN 6
38#define DOT11DECRYPT_RADIOTAP_HEADER_LEN 24
40#define DOT11DECRYPT_EAPOL_MAX_LEN 1024U
42#define DOT11DECRYPT_TK_LEN 16
45#define DOT11DECRYPT_MAX_CAPLEN (12 * 1024)
47#define DOT11DECRYPT_WEP_IVLEN 3
48#define DOT11DECRYPT_WEP_KIDLEN 1
49#define DOT11DECRYPT_WEP_ICV 4
50#define DOT11DECRYPT_WEP_HEADER DOT11DECRYPT_WEP_IVLEN + DOT11DECRYPT_WEP_KIDLEN
51#define DOT11DECRYPT_WEP_TRAILER DOT11DECRYPT_WEP_ICV
60#define DOT11DECRYPT_RSNA_EXTIV 0x20
61#define DOT11DECRYPT_RSNA_EXTIVLEN 4
62#define DOT11DECRYPT_TKIP_MICLEN 8
64#define DOT11DECRYPT_RSNA_HEADER DOT11DECRYPT_WEP_HEADER + DOT11DECRYPT_RSNA_EXTIVLEN
66#define DOT11DECRYPT_CCMP_HEADER DOT11DECRYPT_RSNA_HEADER
67#define DOT11DECRYPT_CCMP_TRAILER 8
68#define DOT11DECRYPT_CCMP_256_TRAILER 16
70#define DOT11DECRYPT_GCMP_HEADER 8
71#define DOT11DECRYPT_GCMP_TRAILER 16
73#define DOT11DECRYPT_TKIP_HEADER DOT11DECRYPT_RSNA_HEADER
74#define DOT11DECRYPT_TKIP_TRAILER DOT11DECRYPT_TKIP_MICLEN + DOT11DECRYPT_WEP_ICV
76#define DOT11DECRYPT_RSNA_MIN_TRAILER 8
78#define DOT11DECRYPT_MAX_MLO_LINKS 3
87#include "ws_symbol_export.h"
99 unsigned char bssid[DOT11DECRYPT_MAC_LEN];
100 unsigned char sta[DOT11DECRYPT_MAC_LEN];
116 unsigned char nonce[DOT11DECRYPT_WPA_NONCE_LEN];
121 unsigned char ptk[DOT11DECRYPT_WPA_PTK_MAX_LEN];
134 struct DOT11DECRYPT_MLO_LINK_INFO {
139 uint8_t sta_mac[DOT11DECRYPT_MAC_LEN];
140 uint8_t ap_mac[DOT11DECRYPT_MAC_LEN];
248 uint8_t
bssid[DOT11DECRYPT_MAC_LEN];
249 uint8_t
sa[DOT11DECRYPT_MAC_LEN];
250 uint8_t
da[DOT11DECRYPT_MAC_LEN];
302 const unsigned data_off,
303 const unsigned data_len,
305 uint32_t *decrypt_len,
331 const unsigned char bssid[DOT11DECRYPT_MAC_LEN],
332 const unsigned char sta[DOT11DECRYPT_MAC_LEN],
333 unsigned char *decrypted_data,
unsigned *decrypted_len,
365 const uint8_t *eapol_raw,
366 const unsigned tot_len,
367 const unsigned char bssid[DOT11DECRYPT_MAC_LEN],
368 const unsigned char sta[DOT11DECRYPT_MAC_LEN])
394 uint8_t *decrypted_gtk,
size_t *decrypted_len,
413 const unsigned tot_len)
486 const size_t keys_nr)
int Dot11DecryptGetKCK(const PDOT11DECRYPT_KEY_ITEM key, const uint8_t **kck)
Definition dot11decrypt.c:564
int Dot11DecryptScanEapolForKeys(PDOT11DECRYPT_CONTEXT ctx, PDOT11DECRYPT_EAPOL_PARSED eapol_parsed, const uint8_t *eapol_raw, const unsigned tot_len, const unsigned char bssid[6], const unsigned char sta[6])
Definition dot11decrypt.c:850
struct _DOT11DECRYPT_SEC_ASSOCIATION_ID DOT11DECRYPT_SEC_ASSOCIATION_ID
Uniquely identifies a security association by the BSSID and station MAC address pair.
struct _DOT11DECRYPT_EAPOL_PARSED DOT11DECRYPT_EAPOL_PARSED
Parsed representation of an EAPOL key frame for WPA/WPA2/WPA3 handshake processing.
_DOT11DECRYPT_HS_MSG_TYPE
EAPOL handshake message type, identifying the step within a 4-Way or Group handshake.
Definition dot11decrypt_system.h:161
@ DOT11DECRYPT_HS_MSG_TYPE_4WHS_4
Definition dot11decrypt_system.h:166
@ DOT11DECRYPT_HS_MSG_TYPE_4WHS_1
Definition dot11decrypt_system.h:163
@ DOT11DECRYPT_HS_MSG_TYPE_GHS_2
Definition dot11decrypt_system.h:168
@ DOT11DECRYPT_HS_MSG_TYPE_4WHS_3
Definition dot11decrypt_system.h:165
@ DOT11DECRYPT_HS_MSG_TYPE_4WHS_2
Definition dot11decrypt_system.h:164
@ DOT11DECRYPT_HS_MSG_TYPE_GHS_1
Definition dot11decrypt_system.h:167
@ DOT11DECRYPT_HS_MSG_TYPE_INVALID
Definition dot11decrypt_system.h:162
WS_DLL_PUBLIC int Dot11DecryptDestroyContext(PDOT11DECRYPT_CONTEXT ctx)
Definition dot11decrypt.c:1213
struct _DOT11DECRYPT_SEC_ASSOCIATION DOT11DECRYPT_SEC_ASSOCIATION
Holds the full cryptographic state of a security association between a STA and an AP.
int Dot11DecryptGetGTK(const PDOT11DECRYPT_KEY_ITEM key, const uint8_t **gtk)
Retrieves the GTK (Group Temporal Key) from a given key item.
Definition dot11decrypt.c:601
enum _DOT11DECRYPT_HS_MSG_TYPE DOT11DECRYPT_HS_MSG_TYPE
EAPOL handshake message type, identifying the step within a 4-Way or Group handshake.
int Dot11DecryptDecryptPacket(PDOT11DECRYPT_CONTEXT ctx, const uint8_t *data, const unsigned data_off, const unsigned data_len, unsigned char *decrypt_data, uint32_t *decrypt_len, PDOT11DECRYPT_KEY_ITEM key)
int Dot11DecryptGetTK(const PDOT11DECRYPT_KEY_ITEM key, const uint8_t **tk)
Retrieves the TK (Temporal Key) from a given key item.
Definition dot11decrypt.c:584
int Dot11DecryptDecryptKeyData(PDOT11DECRYPT_CONTEXT ctx, PDOT11DECRYPT_EAPOL_PARSED eapol_parsed, const unsigned char bssid[6], const unsigned char sta[6], unsigned char *decrypted_data, unsigned *decrypted_len, PDOT11DECRYPT_KEY_ITEM key)
Definition dot11decrypt.c:385
int Dot11DecryptGetKEK(const PDOT11DECRYPT_KEY_ITEM key, const uint8_t **kek)
Retrieves the Key Encryption Key (KEK) for a given decryption key item.
Definition dot11decrypt.c:574
struct _DOT11DECRYPT_ASSOC_PARSED DOT11DECRYPT_ASSOC_PARSED
Parsed representation of an 802.11 association or reassociation frame.
struct _DOT11DECRYPT_CONTEXT DOT11DECRYPT_CONTEXT
Global decryption context holding keys and session state for dot11decrypt.
int Dot11DecryptSetLastSSID(PDOT11DECRYPT_CONTEXT ctx, char *pkt_ssid, size_t pkt_ssid_len)
Definition dot11decrypt.c:1162
struct _DOT11DECRYPT_FTE DOT11DECRYPT_FTE
Parsed fields from an IEEE 802.11r Fast Transition Element (FTE).
int Dot11DecryptSetKeys(PDOT11DECRYPT_CONTEXT ctx, DOT11DECRYPT_KEY_ITEM keys[], const size_t keys_nr)
Definition dot11decrypt.c:1082
WS_DLL_PUBLIC int Dot11DecryptInitContext(PDOT11DECRYPT_CONTEXT ctx)
Definition dot11decrypt.c:1191
int Dot11DecryptScanTdlsForKeys(PDOT11DECRYPT_CONTEXT ctx, const uint8_t *data, const unsigned tot_len)
Definition dot11decrypt.c:618
int Dot11DecryptScanFtAssocForKeys(const PDOT11DECRYPT_CONTEXT ctx, const PDOT11DECRYPT_ASSOC_PARSED assoc_parsed, uint8_t *decrypted_gtk, size_t *decrypted_len, DOT11DECRYPT_KEY_ITEM *used_key)
Definition dot11decrypt.c:1920
Parsed representation of an 802.11 association or reassociation frame.
Definition dot11decrypt_system.h:233
uint8_t group_cipher
Definition dot11decrypt_system.h:235
uint8_t * rsnxe_tag
Definition dot11decrypt_system.h:241
uint8_t * gtk
Definition dot11decrypt_system.h:245
uint8_t * mde_tag
Definition dot11decrypt_system.h:242
uint8_t frame_subtype
Definition dot11decrypt_system.h:234
uint16_t gtk_subelem_key_len
Definition dot11decrypt_system.h:247
uint8_t * rsne_tag
Definition dot11decrypt_system.h:240
uint16_t gtk_len
Definition dot11decrypt_system.h:246
uint8_t * mdid
Definition dot11decrypt_system.h:238
uint8_t * fte_tag
Definition dot11decrypt_system.h:243
uint8_t da[6]
Definition dot11decrypt_system.h:250
uint8_t sa[6]
Definition dot11decrypt_system.h:249
uint8_t cipher
Definition dot11decrypt_system.h:236
uint8_t * rde_tag
Definition dot11decrypt_system.h:244
DOT11DECRYPT_FTE fte
Definition dot11decrypt_system.h:239
uint8_t akm
Definition dot11decrypt_system.h:237
uint8_t bssid[6]
Definition dot11decrypt_system.h:248
Global decryption context holding keys and session state for dot11decrypt.
Definition dot11decrypt_system.h:149
uint8_t pkt_ssid[32]
Definition dot11decrypt_system.h:153
DOT11DECRYPT_KEY_ITEM keys[64]
Definition dot11decrypt_system.h:151
size_t pkt_ssid_len
Definition dot11decrypt_system.h:154
size_t keys_nr
Definition dot11decrypt_system.h:152
GHashTable * sa_hash
Definition dot11decrypt_system.h:150
Per-link Group Temporal Key record for an MLO association.
Definition dot11decrypt_system.h:218
uint8_t * key
Definition dot11decrypt_system.h:220
uint8_t len
Definition dot11decrypt_system.h:221
uint8_t link_id
Definition dot11decrypt_system.h:219
Per-link identity record for an MLO (Multi-Link Operation) association.
Definition dot11decrypt_system.h:211
uint8_t id
Definition dot11decrypt_system.h:212
uint8_t * mac
Definition dot11decrypt_system.h:213
Parsed representation of an EAPOL key frame for WPA/WPA2/WPA3 handshake processing.
Definition dot11decrypt_system.h:190
uint8_t akm
Definition dot11decrypt_system.h:201
uint8_t key_version
Definition dot11decrypt_system.h:194
struct _DOT11DECRYPT_EAPOL_PARSED::DOT11DECRYPT_EAPOL_PARSED_MLO_GTK mlo_gtk[3]
uint8_t key_type
Definition dot11decrypt_system.h:193
uint8_t * mdid
Definition dot11decrypt_system.h:225
uint8_t * mic
Definition dot11decrypt_system.h:203
uint8_t mlo_gtk_count
Definition dot11decrypt_system.h:216
uint8_t cipher
Definition dot11decrypt_system.h:200
DOT11DECRYPT_FTE fte
Definition dot11decrypt_system.h:226
uint8_t group_cipher
Definition dot11decrypt_system.h:199
uint8_t * key_data
Definition dot11decrypt_system.h:197
uint8_t * gtk
Definition dot11decrypt_system.h:205
DOT11DECRYPT_HS_MSG_TYPE msg_type
Definition dot11decrypt_system.h:191
uint16_t gtk_len
Definition dot11decrypt_system.h:206
uint16_t len
Definition dot11decrypt_system.h:192
uint16_t mic_len
Definition dot11decrypt_system.h:204
struct _DOT11DECRYPT_EAPOL_PARSED::DOT11DECRYPT_EAPOL_PARSED_MLO_LINK mlo_link[3]
uint8_t mlo_link_count
Definition dot11decrypt_system.h:209
uint8_t * key_iv
Definition dot11decrypt_system.h:196
uint16_t key_len
Definition dot11decrypt_system.h:195
uint16_t key_data_len
Definition dot11decrypt_system.h:198
uint8_t * nonce
Definition dot11decrypt_system.h:202
uint8_t * mld_mac
Definition dot11decrypt_system.h:207
Parsed fields from an IEEE 802.11r Fast Transition Element (FTE).
Definition dot11decrypt_system.h:175
uint8_t * snonce
Definition dot11decrypt_system.h:179
uint8_t * mic
Definition dot11decrypt_system.h:176
uint8_t * r1kh_id
Definition dot11decrypt_system.h:182
uint8_t r0kh_id_len
Definition dot11decrypt_system.h:181
uint8_t * r0kh_id
Definition dot11decrypt_system.h:180
uint8_t r1kh_id_len
Definition dot11decrypt_system.h:183
uint8_t * anonce
Definition dot11decrypt_system.h:178
uint8_t mic_len
Definition dot11decrypt_system.h:177
Definition dot11decrypt_user.h:87
Uniquely identifies a security association by the BSSID and station MAC address pair.
Definition dot11decrypt_system.h:98
unsigned char bssid[6]
Definition dot11decrypt_system.h:99
unsigned char sta[6]
Definition dot11decrypt_system.h:100
Holds the full cryptographic state of a security association between a STA and an AP.
Definition dot11decrypt_system.h:106
uint8_t ap_mac_set
Definition dot11decrypt_system.h:137
unsigned char nonce[32]
Definition dot11decrypt_system.h:116
int pmk_len
Definition dot11decrypt_system.h:120
struct _DOT11DECRYPT_SEC_ASSOCIATION::@26::DOT11DECRYPT_MLO_LINK_INFO mlo_links[3]
uint8_t id
Definition dot11decrypt_system.h:138
int cipher
Definition dot11decrypt_system.h:118
uint8_t ap_mld_mac_set
Definition dot11decrypt_system.h:126
int ptk_len
Definition dot11decrypt_system.h:122
DOT11DECRYPT_SEC_ASSOCIATION_ID saId
Definition dot11decrypt_system.h:109
uint8_t handshake
Definition dot11decrypt_system.h:111
struct _DOT11DECRYPT_SEC_ASSOCIATION::@26 wpa
DOT11DECRYPT_KEY_ITEM * key
Definition dot11decrypt_system.h:110
int tmp_group_cipher
Definition dot11decrypt_system.h:119
uint8_t validKey
Definition dot11decrypt_system.h:112
uint8_t sta_mld_mac_set
Definition dot11decrypt_system.h:127
unsigned char ptk[96]
Definition dot11decrypt_system.h:121
uint8_t mld
Definition dot11decrypt_system.h:125
struct _DOT11DECRYPT_SEC_ASSOCIATION * next
Definition dot11decrypt_system.h:107
int akm
Definition dot11decrypt_system.h:117
uint8_t sta_mac_set
Definition dot11decrypt_system.h:136
uint8_t ap_mld_mac[6]
Definition dot11decrypt_system.h:128
uint8_t key_ver
Definition dot11decrypt_system.h:115
uint8_t id_set
Definition dot11decrypt_system.h:135
uint8_t sta_mld_mac[6]
Definition dot11decrypt_system.h:129
Definition packet-ike.c:2095