diff options
author | Gerald Combs <gerald@wireshark.org> | 2006-12-05 19:24:25 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2006-12-05 19:24:25 +0000 |
commit | a980d047830755406fc27150978511b407d65829 (patch) | |
tree | 523e028d65e71d3531c9e0fdb1da17350e90f91c /airpcap_loader.h | |
parent | 39c29557c743671b4b09308cdd5a6dc7ba791499 (diff) |
From Davide Schiera and Giorgio Tino: Add initial WPA/WPA2 decryption
support.
WEP key preferences have been overloaded to allow WPA keys. The
decryption code currently uses Windows-specific data types, but can be
converted to use glib equivalents.
Add a few text and whitespace fixups.
svn path=/trunk/; revision=20049
Diffstat (limited to 'airpcap_loader.h')
-rw-r--r-- | airpcap_loader.h | 84 |
1 files changed, 66 insertions, 18 deletions
diff --git a/airpcap_loader.h b/airpcap_loader.h index 5260fe0403..70a28465dc 100644 --- a/airpcap_loader.h +++ b/airpcap_loader.h @@ -45,9 +45,51 @@ */ #define WEP_KEY_MAX_BIT_SIZE (WEP_KEY_MAX_SIZE*8) +#define WEP_KEY_MIN_CHAR_SIZE 2 +#define WEP_KEY_MIN_BIT_SIZE 8 + +/* + * XXX - The next #define should probably be moved in airpcap.h, + * near WEP_KEY_MAX_SIZE ... + */ +#define WPA_KEY_MAX_SIZE 63 /* 63 chars followed by a '\0' */ + +#define WPA_KEY_MAX_CHAR_SIZE (WPA_KEY_MAX_SIZE*1) +#define WPA_KEY_MAX_BIT_SIZE (WPA_KEY_MAX_SIZE*8) +#define WPA_KEY_MIN_CHAR_SIZE 8 +#define WPA_KEY_MIN_BIT_SIZE (WPA_KEY_MIN_CHAR_SIZE*8) + +/* + * XXX - The next #define should probably be moved in airpcap.h, + * near WEP_KEY_MAX_SIZE ... + */ +#define WPA_SSID_MAX_SIZE 32 + +#define WPA_SSID_MAX_CHAR_SIZE (WPA_SSID_MAX_SIZE*1) +#define WPA_SSID_MAX_BIT_SIZE (WPA_SSID_MAX_SIZE*8) +#define WPA_SSID_MIN_CHAR_SIZE 0 +#define WPA_SSID_MIN_BIT_SIZE (WPA_SSID_MIN_CHAR_SIZE*8) + +/* + * User can enter the binary PSK, instead of the passphrase+ssid... + */ +#define WPA_PSK_KEY_SIZE 32 /* Fixed size, 32 bytes (256bit) */ +#define WPA_PSK_KEY_CHAR_SIZE (WPA_PSK_KEY_SIZE*2) +#define WPA_PSK_KEY_BIT_SIZE (WPA_PSK_KEY_SIZE*8) + #define AIRPCAP_WEP_KEY_STRING "WEP" -#define AIRPCAP_WPA_KEY_STRING "WPA" -#define AIRPCAP_WPA2_KEY_STRING "WPA2" +/* + * XXX - WPA_PWD is the passphrase+ssid and WPA-PSK is the hexadecimal key + */ +#define AIRPCAP_WPA_PWD_KEY_STRING "WPA-PWD" +#define AIRPCAP_WPA_BIN_KEY_STRING "WPA-PSK" + +/* + * Key string defines + */ +#define STRING_KEY_TYPE_WEP "wep" +#define STRING_KEY_TYPE_WPA_PWD "wpa-pwd" +#define STRING_KEY_TYPE_WPA_PSK "wpa-psk" #define AIRPCAP_DLL_OK 0 #define AIRPCAP_DLL_OLD 1 @@ -110,15 +152,6 @@ typedef struct { } airpcap_if_info_t; /* - * Struct used to store infos to pass to the preferences manager callbacks - */ -typedef struct { - GList *list; - int current_index; - int number_of_keys; -} keys_cb_data_t; - -/* * Struct to store infos about a specific decryption key. */ typedef struct { @@ -128,6 +161,15 @@ typedef struct { guint type; } decryption_key_t; +/* + * Struct used to store infos to pass to the preferences manager callbacks + */ +typedef struct { + GList *list; + int current_index; + int number_of_keys; +} keys_cb_data_t; + /* Airpcap interface list */ extern GList *airpcap_if_list; @@ -145,13 +187,6 @@ extern airpcap_if_info_t *airpcap_if_active; * properly into the airpcap adapter. */ BOOL -load_wlan_wep_keys(airpcap_if_info_t* info_if); - -/* - * Function used to read the Decryption Keys from the preferences and store them - * properly into the airpcap adapter. - */ -BOOL load_wlan_driver_wep_keys(); /* @@ -553,4 +588,17 @@ get_compiled_airpcap_version(GString *str); void get_runtime_airpcap_version(GString *str); +/* + * Returns the decryption_key_t struct given a string describing the key. + * Returns NULL if the key_string cannot be parsed. + */ +decryption_key_t* +parse_key_string(gchar* key_string); + +/* + * Returns a newly allocated string representing the given decryption_key_t struct + */ +gchar* +get_key_string(decryption_key_t* dk); + #endif |