libwifi 0.0.3
An 802.11 Frame Parsing and Generation library in C
security.h File Reference
#include "../../core/frame/management/common.h"
#include "../../core/misc/security.h"
#include <stdint.h>

Go to the source code of this file.

Macros

#define LIBWIFI_SECURITY_BUF_LEN   256
 

Functions

int libwifi_get_rsn_info (struct libwifi_rsn_info *info, const unsigned char *tag_data, const unsigned char *tag_end)
 Get the RSN related information and store it in a libwifi_rsn_info. More...
 
void libwifi_enumerate_rsn_suites (struct libwifi_rsn_info *rsn_info, struct libwifi_bss *bss)
 Enumerate the RSN cipher suites in a libwifi_rsn_info. More...
 
int libwifi_get_wpa_info (struct libwifi_wpa_info *info, const unsigned char *tag_data, const unsigned char *tag_end)
 Get the WPA related information and store it in a libwifi_wpa_info. More...
 
void libwifi_enumerate_wpa_suites (struct libwifi_wpa_info *wpa_info, struct libwifi_bss *bss)
 Enumerate the WPA cipher suites in a libwifi_wpa_info. More...
 
void libwifi_get_security_type (struct libwifi_bss *bss, char *buf)
 Enumerate the security types (WEP, WPA, WPA2, WPA3, etc) in a given libwifi_bss, formatted into the given buffer. More...
 
void libwifi_get_group_ciphers (struct libwifi_bss *bss, char *buf)
 Enumerate the group ciphers (CCMP, GCMP128, etc) in a given libwifi_bss, formatted into the given buffer. More...
 
void libwifi_get_pairwise_ciphers (struct libwifi_bss *bss, char *buf)
 Enumerate the pairwise ciphers (GROUP, CCMP, BIP_CMAC128, etc) in a given libwifi_bss, formatted into the given buffer. More...
 
void libwifi_get_auth_key_suites (struct libwifi_bss *bss, char *buf)
 Enumerate the auth key management suites in a given libwifi_bss, formatted into the given buffer. More...
 
void _libwifi_add_sec_item (char *buf, int *offset, int *append, char *item)
 Internal function for adding a formatted string to a buffer for use with libwifi_get_* security functions. More...
 

Macro Definition Documentation

◆ LIBWIFI_SECURITY_BUF_LEN

#define LIBWIFI_SECURITY_BUF_LEN   256

Definition at line 24 of file security.h.

Function Documentation

◆ _libwifi_add_sec_item()

void _libwifi_add_sec_item ( char *  buf,
int *  offset,
int *  append,
char *  item 
)

Internal function for adding a formatted string to a buffer for use with libwifi_get_* security functions.

Parameters
bufA buffer of length LIBWIFI_SECURITY_BUF_LEN
offsetA pointer to the current buffer offset variable
appendA pointer to the append state variable
itemA pointer to the string to append to the given buf

Definition at line 677 of file security.c.

◆ libwifi_enumerate_rsn_suites()

void libwifi_enumerate_rsn_suites ( struct libwifi_rsn_info rsn_info,
struct libwifi_bss bss 
)

Enumerate the RSN cipher suites in a libwifi_rsn_info.

This function can be used to fill a libwifi_bss struct with information related to the cipher suites and AKM suites in the specified libwifi_rsn_info.

Parameters
rsn_infoA libwifi_rsn_info
libwifi_bssA libwifi_bss

Enumerate the RSN cipher suites in a libwifi_rsn_info.

  • Group Cipher Suite
  • Up to 3 Pairwise Cipher Suites
  • Up to 3 Auth Key Management Suites
  • The WPA Type (WPA2 or WPA3)

The bss->encryption_info field is a 64-bit wide bitmask. The larger length is required to accomodate the different types of cipher suites without having any overlap between group cipher and pairwise cipher.

Definition at line 123 of file security.c.

◆ libwifi_enumerate_wpa_suites()

void libwifi_enumerate_wpa_suites ( struct libwifi_wpa_info wpa_info,
struct libwifi_bss bss 
)

Enumerate the WPA cipher suites in a libwifi_wpa_info.

This function can be used to fill a libwifi_bss struct with information related to the cipher suites and AKM suites in the specified libwifi_wpa_info.

Parameters
wpa_infoA libwifi_wpa_info
libwifi_bssA libwifi_bss

Enumerate the WPA cipher suites in a libwifi_wpa_info.

  • Multicast Cipher Suite
  • Up to 3 Unicast Cipher Suites
  • Up to 3 Auth Key Management Suites

The bss->encryption_info field is a 64-bit wide bitmask. The larger length is required to accomodate the different types of cipher suites without having any overlap between group cipher and pairwise cipher.

Definition at line 399 of file security.c.

◆ libwifi_get_auth_key_suites()

void libwifi_get_auth_key_suites ( struct libwifi_bss bss,
char *  buf 
)

Enumerate the auth key management suites in a given libwifi_bss, formatted into the given buffer.

Parameters
bssA libwifi_bss struct
bufA buffer of length LIBWIFI_SECURITY_BUF_LEN

Definition at line 601 of file security.c.

◆ libwifi_get_group_ciphers()

void libwifi_get_group_ciphers ( struct libwifi_bss bss,
char *  buf 
)

Enumerate the group ciphers (CCMP, GCMP128, etc) in a given libwifi_bss, formatted into the given buffer.

Parameters
bssA libwifi_bss struct
bufA buffer of length LIBWIFI_SECURITY_BUF_LEN

Definition at line 494 of file security.c.

◆ libwifi_get_pairwise_ciphers()

void libwifi_get_pairwise_ciphers ( struct libwifi_bss bss,
char *  buf 
)

Enumerate the pairwise ciphers (GROUP, CCMP, BIP_CMAC128, etc) in a given libwifi_bss, formatted into the given buffer.

Parameters
bssA libwifi_bss struct
bufA buffer of length LIBWIFI_SECURITY_BUF_LEN

Definition at line 546 of file security.c.

◆ libwifi_get_rsn_info()

int libwifi_get_rsn_info ( struct libwifi_rsn_info info,
const unsigned char *  tag_data,
const unsigned char *  tag_end 
)

Get the RSN related information and store it in a libwifi_rsn_info.

This function will detect and enumerate cipher suites, and AKM suites, and the RSN capabilities from a specified RSN IE.

Parameters
infoA libwifi_rsn_info
tag_dataAn RSN IE tag
tag_endThe end of the specified RSN IE tag
Returns

Get the RSN related information and store it in a libwifi_rsn_info.

The supplied data is then "walked" through as a pointer to extract the details of the tag and write them into a struct libwifi_rsn_info.

libwifi supports a maximum of 3 Pairwise Cipher Suites and 3 Auth Key Management Suites. The Version, Group Cipher Suite and Capabilities fields are all required.

Definition at line 32 of file security.c.

◆ libwifi_get_security_type()

void libwifi_get_security_type ( struct libwifi_bss bss,
char *  buf 
)

Enumerate the security types (WEP, WPA, WPA2, WPA3, etc) in a given libwifi_bss, formatted into the given buffer.

Parameters
bssA libwifi_bss struct
bufA buffer of length LIBWIFI_SECURITY_BUF_LEN

Definition at line 469 of file security.c.

◆ libwifi_get_wpa_info()

int libwifi_get_wpa_info ( struct libwifi_wpa_info info,
const unsigned char *  tag_data,
const unsigned char *  tag_end 
)

Get the WPA related information and store it in a libwifi_wpa_info.

This function will detect and enumerate cipher suites and AKM suites from a specified WPA IE.

Parameters
infoA libwifi_wpa_info
tag_dataA WPA IE tag
tag_endThe end of the specified WPA IE tag
Returns

Get the WPA related information and store it in a libwifi_wpa_info.

The supplied data is then "walked" through as a pointer to extract the details of the tag and write them into a struct libwifi_wpa_info.

libwifi supports a maximum of 3 Unicast Cipher Suites and 3 Auth Key Management Suites. The Version and Multicast Cipher Suite fields are required.

Definition at line 315 of file security.c.