| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
Functions
dot11decrypt_util.h File Reference
`#include "dot11decrypt_int.h"`

Go to the source code of this file.

## Functions
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.
bool | dot11decrypt_prf (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)
| IEEE 802.11-2016 12.7.1.2 PRF (Pseudo Random Function).
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)
| Perform a KDF (Key Derivation Function) using the specified parameters.
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])
| Derive PMK-R0 using the provided parameters.
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)
| Derive PMK-R1 from PMK-R0 using a key derivation function.
bool | dot11decrypt_derive_ft_ptk (const uint8_t *pmk_r1, size_t pmk_r1_len, const uint8_t *pmk_r1_name, const uint8_t *snonce, const uint8_t *anonce, const uint8_t *bssid, const uint8_t *sta_addr, int hash_algo, uint8_t *ptk, const size_t ptk_len, uint8_t *ptk_name)
| Derive the FT PTK using the provided parameters.

## Detailed Description

Copyright (c) 2002-2005 Sam Leffler, Errno Consulting Copyright (c) 2006 CACE Technologies, Davis (California) All rights reserved.

SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)

## Function Documentation

## ◆ dot11decrypt_construct_aad()

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.

Parameters

  wh | Pointer to the DOT11DECRYPT_MAC_FRAME structure containing the MAC header.
  A1 | Pointer to the first address field of the MAC frame.
  A2 | Pointer to the second address field of the MAC frame.
  A3 | Pointer to the third address field of the MAC frame.
  aad | Buffer to store the constructed AAD.
  aad_len | Pointer to store the length of the constructed AAD.

## ◆ dot11decrypt_derive_ft_ptk()

bool dot11decrypt_derive_ft_ptk | ( | const uint8_t * | pmk_r1,
|  | size_t | pmk_r1_len,
|  | const uint8_t * | pmk_r1_name,
|  | const uint8_t * | snonce,
|  | const uint8_t * | anonce,
|  | const uint8_t * | bssid,
|  | const uint8_t * | sta_addr,
|  | int | hash_algo,
|  | uint8_t * | ptk,
|  | const size_t | ptk_len,
|  | uint8_t * | ptk_name )

Derive the FT PTK using the provided parameters.

Derive PTK for FT AKMS. See IEE 802.11-2016 12.7.1.7.5 PTK

PTK = KDF-Hash-Length(PMK-R1, "FT-PTK", SNonce || ANonce || BSSID || STA-ADDR) PTKName = Truncate-128( SHA-256(PMKR1Name || "FT-PTKN" || SNonce || ANonce || BSSID || STA-ADDR))

Parameters

  pmk_r1 | Pointer to the PMK_R1 value.
  pmk_r1_len | Length of the PMK_R1 value.
  pmk_r1_name | Name associated with the PMK_R1.
  snonce | Session nonce.
  anonce | Authenticator nonce.
  bssid | Base station address.
  sta_addr | Station address.
  hash_algo | Hash algorithm to use.
  ptk | Pointer to store the derived PTK.
  ptk_len | Length of the PTK buffer.
  ptk_name | Name associated with the PTK.

Returns
  void

## ◆ dot11decrypt_derive_pmk_r0()

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] )

Derive PMK-R0 using the provided parameters.

Derive PMK-R0 and PMKR0Name. See IEEE 802.11-2016 12.7.1.7.3 PMK-R0

Parameters

  | xxkey | PSK / MPMK or certain part of MSK.
  | xxkey_len | Length of xxkey in bytes.
  | ssid | SSID
  | ssid_len | Length of SSID in bytes.
  | mdid | MDID (Mobility Domain Identifier).
  | r0kh_id | PMK-R0 key holder identifier in the Authenticator.
  | r0kh_id_len | Length of r0kh_id in bytes.
  | s0kh_id | PMK-R0 key holder in the Supplicant (STA mac address)
  | hash_algo | Hash algorithm to use for the KDF. See gcrypt available hash algorithms: https://gnupg.org/documentation/manuals/gcrypt/Available-hash-algorithms.html
  [out] | pmk_r0 | Pairwise master key, first level
  | pmk_r0_len | Length of pmk_r0 in bytes.
  [out] | pmk_r0_name | Pairwise master key (PMK) R0 name.

## ◆ dot11decrypt_derive_pmk_r1()

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 )

Derive PMK-R1 from PMK-R0 using a key derivation function.

Derive PMK-R1 and PMKR1Name. See IEEE 802.11-2016 12.7.1.7.4 PMK-R1

Parameters

  pmk_r0 | Pointer to the PMK-R0 buffer.
  pmk_r0_len | Length of the PMK-R0 buffer.
  pmk_r0_name | Name associated with PMK-R0.
  r1kh_id | R1KH ID for the key derivation.
  s1kh_id | S1KH ID for the key derivation.
  hash_algo | Hash algorithm to use for the key derivation.
  pmk_r1 | Pointer to the buffer where the derived PMK-R1 will be stored.
  pmk_r1_len | Pointer to the length of the PMK-R1 buffer, which will be updated with the actual length of the derived PMK-R1.
  pmk_r1_name | Pointer to the buffer where the name for the derived PMK-R1 will be stored.

Returns
  true if the derivation was successful, false otherwise.

Derive PMK-R1 and PMKR1Name. See IEEE 802.11-2016 12.7.1.7.4 PMK-R1

## ◆ dot11decrypt_kdf()

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 )

Perform a KDF (Key Derivation Function) using the specified parameters.

Reference: IEEE 802.11-2016 12.7.1.7.2 Key derivation function (KDF)

Parameters

  | key | Derivation input key.
  | key_len | Length of the key in bytes.
  | label | A string identifying the purpose of the keys derived using this KDF.
  | context | Provides context to identify the derived key.
  | context_len | Length of context in bytes.
  | hash_algo | Hash algorithm to use for the KDF. See gcrypt available hash algorithms: https://gnupg.org/documentation/manuals/gcrypt/Available-hash-algorithms.html
  [out] | output | Derived key.
  | output_len | Length of derived key in bytes.

Returns
  false on error

12.7.1.7.2 Key derivation function (KDF)

Parameters

  | key | Derivation input key.
  | key_len | Length of the key in bytes.
  | label | A string identifying the purpose of the keys derived using this KDF.
  | context | Provides context to identify the derived key.
  | context_len | Length of context in bytes.
  | hash_algo | Hash algorithm to use for the KDF. See gcrypt available hash algorithms: https://gnupg.org/documentation/manuals/gcrypt/Available-hash-algorithms.html
  [out] | output | Derived key.
  | output_len | Length of derived key in bytes.

Returns
  false on error

## ◆ dot11decrypt_prf()

bool dot11decrypt_prf | ( | 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 )

IEEE 802.11-2016 12.7.1.2 PRF (Pseudo Random Function).

Parameters

  | key | Derivation input key.
  | key_len | Length of the key in bytes.
  | label | Unique label for each different purpose of the PRF (named 'A' in the standard).
  | context | Provides context to identify the derived key (named 'B' in the standard).
  | context_len | Length of context in bytes.
  | hash_algo | Hash algorithm to use for the PRF. See gcrypt available hash algorithms: https://gnupg.org/documentation/manuals/gcrypt/Available-hash-algorithms.html
  [out] | output | Derived key.
  | output_len | Length of derived key in bytes.

Returns
  false on error