diff options
author | Gerald Combs <gerald@wireshark.org> | 2018-02-23 09:43:29 -0800 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2018-02-24 11:56:18 +0000 |
commit | e73e3580f6050e98cf5affa8f23d941845e77ecc (patch) | |
tree | 65a35621213c262373b3fad9bab5022a45e82348 /epan/crypt/dot11decrypt_int.h | |
parent | 3785f53089eb4197d93574ebe7ff8eba51bc7266 (diff) |
Rename airpdcap to dot11decrypt.
Our 802.11 decryption code isn't tied to any specific product. Change
the file and API names to dot11decrypt.
Change-Id: I14fd951be3ae9b656a4e1959067fc0bdcc681ee2
Reviewed-on: https://code.wireshark.org/review/26058
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/crypt/dot11decrypt_int.h')
-rw-r--r-- | epan/crypt/dot11decrypt_int.h | 172 |
1 files changed, 172 insertions, 0 deletions
diff --git a/epan/crypt/dot11decrypt_int.h b/epan/crypt/dot11decrypt_int.h new file mode 100644 index 0000000000..8ac919fdbe --- /dev/null +++ b/epan/crypt/dot11decrypt_int.h @@ -0,0 +1,172 @@ +/* airpcap_int.h + * + * Copyright (c) 2006 CACE Technologies, Davis (California) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _DOT11DECRYPT_INT_H +#define _DOT11DECRYPT_INT_H + +/****************************************************************************/ +/* File includes */ + +#include "dot11decrypt_interop.h" +#include "dot11decrypt_system.h" + +/****************************************************************************/ + +/****************************************************************************/ +/* Definitions */ + +/* IEEE 802.11 packet type values */ +#define DOT11DECRYPT_TYPE_MANAGEMENT 0 +#define DOT11DECRYPT_TYPE_CONTROL 1 +#define DOT11DECRYPT_TYPE_DATA 2 + +/* IEEE 802.11 packet subtype values */ +#define DOT11DECRYPT_SUBTYPE_ASSOC_REQ 0 +#define DOT11DECRYPT_SUBTYPE_ASSOC_RESP 1 +#define DOT11DECRYPT_SUBTYPE_REASSOC_REQ 2 +#define DOT11DECRYPT_SUBTYPE_REASSOC_RESP 3 +#define DOT11DECRYPT_SUBTYPE_PROBE_REQ 4 +#define DOT11DECRYPT_SUBTYPE_PROBE_RESP 5 +#define DOT11DECRYPT_SUBTYPE_MEASUREMENT_PILOT 6 +#define DOT11DECRYPT_SUBTYPE_BEACON 8 +#define DOT11DECRYPT_SUBTYPE_ATIM 9 +#define DOT11DECRYPT_SUBTYPE_DISASS 10 +#define DOT11DECRYPT_SUBTYPE_AUTHENTICATION 11 +#define DOT11DECRYPT_SUBTYPE_DEAUTHENTICATION 12 +#define DOT11DECRYPT_SUBTYPE_ACTION 13 +#define DOT11DECRYPT_SUBTYPE_ACTION_NO_ACK 14 + +/* Min length of encrypted data (TKIP=21bytes, CCMP=17bytes) */ +#define DOT11DECRYPT_CRYPTED_DATA_MINLEN 17 + +#define DOT11DECRYPT_TA_OFFSET 10 + +/* */ +/****************************************************************************/ + +/****************************************************************************/ +/* Macro definitions */ + +/** + * Macros to get various bits of a 802.11 control frame + */ +#define DOT11DECRYPT_TYPE(FrameControl_0) (UINT8)((FrameControl_0 >> 2) & 0x3) +#define DOT11DECRYPT_SUBTYPE(FrameControl_0) (UINT8)((FrameControl_0 >> 4) & 0xF) +#define DOT11DECRYPT_DS_BITS(FrameControl_1) (UINT8)(FrameControl_1 & 0x3) +#define DOT11DECRYPT_TO_DS(FrameControl_1) (UINT8)(FrameControl_1 & 0x1) +#define DOT11DECRYPT_FROM_DS(FrameControl_1) (UINT8)((FrameControl_1 >> 1) & 0x1) +#define DOT11DECRYPT_WEP(FrameControl_1) (UINT8)((FrameControl_1 >> 6) & 0x1) + +/** + * Get the Key ID from the Initialization Vector (last byte) + */ +#define DOT11DECRYPT_EXTIV(KeyID) ((KeyID >> 5) & 0x1) + +#define DOT11DECRYPT_KEY_INDEX(KeyID) ((KeyID >> 6) & 0x3) /** Used to determine TKIP group key from unicast (group = 1, unicast = 0) */ + +/* Macros to get various bits of an EAPOL frame */ +#define DOT11DECRYPT_EAP_KEY_DESCR_VER(KeyInfo_1) ((UCHAR)(KeyInfo_1 & 0x3)) +#define DOT11DECRYPT_EAP_KEY(KeyInfo_1) ((KeyInfo_1 >> 3) & 0x1) +#define DOT11DECRYPT_EAP_INST(KeyInfo_1) ((KeyInfo_1 >> 6) & 0x1) +#define DOT11DECRYPT_EAP_ACK(KeyInfo_1) ((KeyInfo_1 >> 7) & 0x1) +#define DOT11DECRYPT_EAP_MIC(KeyInfo_0) (KeyInfo_0 & 0x1) +#define DOT11DECRYPT_EAP_SEC(KeyInfo_0) ((KeyInfo_0 >> 1) & 0x1) + +/****************************************************************************/ + +/****************************************************************************/ +/* Structure definitions */ + +/* + * XXX - According to the thread at + * http://www.wireshark.org/lists/wireshark-dev/200612/msg00384.html we + * shouldn't have to worry about packing our structs, since the largest + * elements are 8 bits wide. + */ +#ifdef _MSC_VER /* MS Visual C++ */ +#pragma pack(push) +#pragma pack(1) +#endif + +/* Definition of IEEE 802.11 frame (without the address 4) */ +typedef struct _DOT11DECRYPT_MAC_FRAME { + UCHAR fc[2]; + UCHAR dur[2]; + UCHAR addr1[DOT11DECRYPT_MAC_LEN]; + UCHAR addr2[DOT11DECRYPT_MAC_LEN]; + UCHAR addr3[DOT11DECRYPT_MAC_LEN]; + UCHAR seq[2]; +} DOT11DECRYPT_MAC_FRAME, *PDOT11DECRYPT_MAC_FRAME; + +/* Definition of IEEE 802.11 frame (with the address 4) */ +typedef struct _DOT11DECRYPT_MAC_FRAME_ADDR4 { + UCHAR fc[2]; + UCHAR dur[2]; + UCHAR addr1[DOT11DECRYPT_MAC_LEN]; + UCHAR addr2[DOT11DECRYPT_MAC_LEN]; + UCHAR addr3[DOT11DECRYPT_MAC_LEN]; + UCHAR seq[2]; + UCHAR addr4[DOT11DECRYPT_MAC_LEN]; +} DOT11DECRYPT_MAC_FRAME_ADDR4, *PDOT11DECRYPT_MAC_FRAME_ADDR4; + +/* Definition of IEEE 802.11 frame (without the address 4, with QOS) */ +typedef struct _DOT11DECRYPT_MAC_FRAME_QOS { + UCHAR fc[2]; + UCHAR dur[2]; + UCHAR addr1[DOT11DECRYPT_MAC_LEN]; + UCHAR addr2[DOT11DECRYPT_MAC_LEN]; + UCHAR addr3[DOT11DECRYPT_MAC_LEN]; + UCHAR seq[2]; + UCHAR qos[2]; +} DOT11DECRYPT_MAC_FRAME_QOS, *PDOT11DECRYPT_MAC_FRAME_QOS; + +/* Definition of IEEE 802.11 frame (with the address 4 and QOS) */ +typedef struct _DOT11DECRYPT_MAC_FRAME_ADDR4_QOS { + UCHAR fc[2]; + UCHAR dur[2]; + UCHAR addr1[DOT11DECRYPT_MAC_LEN]; + UCHAR addr2[DOT11DECRYPT_MAC_LEN]; + UCHAR addr3[DOT11DECRYPT_MAC_LEN]; + UCHAR seq[2]; + UCHAR addr4[DOT11DECRYPT_MAC_LEN]; + UCHAR qos[2]; +} DOT11DECRYPT_MAC_FRAME_ADDR4_QOS, *PDOT11DECRYPT_MAC_FRAME_ADDR4_QOS; + +#ifdef _MSC_VER /* MS Visual C++ */ +#pragma pack(pop) +#endif + +/******************************************************************************/ + +#endif |