The MIC Calculator's structure and methods declarations. More...
|
Data Structures | |
| struct | mic_calc |
| ========================== Context Definition =========================== This structure contains the attributes that defines the current state of the MIC key Calculator More... | |
Defines | |
| #define | MIC_END_SIGNATURE (0x0000005A) |
| At the end of the MIC Calculation, a padding is added that consists of the signature byte 0x5A and number of padding bytes that are set to zeroes. | |
| #define | MIC_TID_MASK (0x00000007) |
| Mask to be applied to the received TID value (three lower bits). | |
| #define | ROR32(L, Q) ( ( (uint32_t)(L) >> (Q) ) | ( (uint32_t)(L) << (32-(Q)) ) ) |
| A macro for the right rotation instruction. | |
| #define | ROL32(L, Q) ( ( (uint32_t)(L) << (Q) ) | ( (uint32_t)(L) >> (32-(Q)) ) ) |
| A macro for the right rotation instruction. | |
| #define | XSWAP32(L) |
| A macro for swap operation. | |
| #define | LEN_IN_BITS(X) ( (X) << 3 ) |
| A macro for multiplication by 8. | |
| #define | SHIFTR(X, S) (((S) == 32)? 0 : ((X) >> (S)) ) |
| This macro is used to right shift a value by another value. | |
Functions | |
| static void | michael_block (struct mic_calc *mic_calc_ptr, uint32_t block) |
| Michael block function implementation Implement the Feistel-type Michael block function b as defined in the IEEE standard 802.11-2012 (section 11.4.2.3 - Figure 11-10 and 11-11). | |
| static void | michael_init (struct mic_calc *mic_calc_ptr, uint32_t *mic_key_ptr, uint32_t *aad) |
| Initializes TKIP MIC computation (Software implementation). | |
| static void | michael_calc (struct mic_calc *mic_calc_ptr, uint32_t start_ptr, uint32_t data_len) |
| Continues TKIP MIC computation (Software implementation). | |
| static void | michael_end (struct mic_calc *mic_calc_ptr) |
| Ends TKIP MIC computation (Software implementation). | |
| void | me_mic_init (struct mic_calc *mic_calc_ptr, uint32_t *mic_key_ptr, struct mac_addr *da, struct mac_addr *sa, uint8_t tid) |
| Initializes mic_calc attributes before proceeding with MIC key calculations. | |
| void | me_mic_calc (struct mic_calc *mic_calc_ptr, uint32_t start_ptr, uint32_t data_len) |
| Performs MIC Key calculations over a continuous block in memory with an arbitrary starting point and length. | |
| void | me_mic_end (struct mic_calc *mic_calc_ptr) |
| Used to terminate the MIC calculation session and retrieve the resultant MIC key. | |
Variables | |
| uint32_t | mic_aad [4] |
| Additional Authentication Data vector for MIC computation Must be in SHARED RAM when HSU is used. | |
The MIC Calculator's structure and methods declarations.
| #define LEN_IN_BITS | ( | X | ) | ( (X) << 3 ) |
A macro for multiplication by 8.
This macro is used to convert the lengths from the byte unit to the bit unit
| [in] | X | the length in bytes |
| [in] | X | The number of bytes to be converted in bits |
Definition at line 111 of file me_mic.c.
Referenced by michael_calc(), and michael_end().
| #define MIC_END_SIGNATURE (0x0000005A) |
At the end of the MIC Calculation, a padding is added that consists of the signature byte 0x5A and number of padding bytes that are set to zeroes.
to make sure the over all length of the message can be divided by 4 without remainder.
Definition at line 39 of file me_mic.c.
Referenced by michael_end().
| #define ROL32 | ( | L, | |||
| Q | ) | ( ( (uint32_t)(L) << (Q) ) | ( (uint32_t)(L) >> (32-(Q)) ) ) |
A macro for the right rotation instruction.
Rotates L by Q bits to the right
| [in] | L | The value to be rotated. |
| [in] | Q | The number of bits to rotate L with. |
Definition at line 78 of file me_mic.c.
Referenced by michael_block().
| #define ROR32 | ( | L, | |||
| Q | ) | ( ( (uint32_t)(L) >> (Q) ) | ( (uint32_t)(L) << (32-(Q)) ) ) |
A macro for the right rotation instruction.
Rotates L by Q bits to the right
| [in] | L | The value to be rotated. |
| [in] | Q | The number of bits to rotate L with. |
Definition at line 65 of file me_mic.c.
Referenced by michael_block().
| #define SHIFTR | ( | X, | |||
| S | ) | (((S) == 32)? 0 : ((X) >> (S)) ) |
This macro is used to right shift a value by another value.
| [in] | X | The value to be right shifted |
| [in] | S | The number by which X has to be right shifted |
Definition at line 123 of file me_mic.c.
Referenced by michael_calc().
| #define XSWAP32 | ( | L | ) |
( ( ( L & 0xFF00FF00 ) >> 8 ) | \
( ( L & 0x00FF00FF ) << 8 ) )
A macro for swap operation.
Swaps the 1st and 2nd bytes, and swaps the 3rd and 4th bytes
| [in] | L | The value to apply swap on |
Definition at line 90 of file me_mic.c.
Referenced by michael_block().
| void me_mic_calc | ( | struct mic_calc * | mic_calc_ptr, | |
| uint32_t | start_ptr, | |||
| uint32_t | data_len | |||
| ) |
Performs MIC Key calculations over a continuous block in memory with an arbitrary starting point and length.
| [in,out] | mic_calc_ptr | |
| [in] | start_ptr | Pointer to the data |
| [in] | data_len | Length of the provided data |
Referenced by rxu_cntrl_mic_check(), and txl_buffer_mic_compute().
| void me_mic_end | ( | struct mic_calc * | mic_calc_ptr | ) |
Used to terminate the MIC calculation session and retrieve the resultant MIC key.
As specified in IEEE 802.11-2012 specification, section 11.4.2.3.3, the message is padded at the end with a single octet with value 0x5A, followed by between 4 and 7 zero octets. The padding in not transmitted with the MSDU; it is used to simplify the computation over the final block. By construction M(n-1) = 0 and M(n-2) != 0
| [in,out] | mic_calc_ptr |
Referenced by rxu_cntrl_mic_check(), and txl_buffer_mic_compute().
| void me_mic_init | ( | struct mic_calc * | mic_calc_ptr, | |
| uint32_t * | mic_key_ptr, | |||
| struct mac_addr * | da, | |||
| struct mac_addr * | sa, | |||
| uint8_t | tid | |||
| ) |
Initializes mic_calc attributes before proceeding with MIC key calculations.
As exposed in the IEEE 802.11-2012 specification, section 11.4.2.3.2, figure 11-9, the MIC is computed on a MSDU including the Priority field, 3 reserved octets, SA field and DA field. The total length of these fields is 16 bytes. Hence the MIC generation can be started by providing the 4 first blocks to the Michael block function.
| [in,out] | mic_calc_ptr | |
| [in] | mic_key_ptr | Initial MIC key |
| [in] | da | Destination Address to use as part of the MIC header |
| [in] | sa | Source Address to use as part of the MIC header |
| [in] | tid | Packet priority to use as part of the MIC header |
Referenced by rxu_cntrl_mic_check(), and txl_buffer_mic_compute().
| static void michael_block | ( | struct mic_calc * | mic_calc_ptr, | |
| uint32_t | block | |||
| ) | [static] |
Michael block function implementation Implement the Feistel-type Michael block function b as defined in the IEEE standard 802.11-2012 (section 11.4.2.3 - Figure 11-10 and 11-11).
Input (l, r, M(i)) Output (l, r) b(l, r, M(i)) l <- l XOR M(i) r <- r XOR (l <<< 17) l <- (l + r) mod 2^32 r <- r XOR XSWAP(l) l <- (l + r) mod 2^32 r <- r XOR (l <<< 3) l <- (l + r) mod 2^32 r <- r XOR (l >>> 2) l <- (l + r) mod 2^32 return (l, r)
where <<< denotes the rotate-left operator on 32-bit >>> the rotate-right operator XSWAP a function that swaps the position of the 2 least significant octets.
| [in] | mic_calc_ptr | A pointer to an array of two 32-bit words that holds the MIC key. |
| [in] | block | 32-bit word M(i) on which function has to be applied |
Definition at line 159 of file me_mic.c.
References mic_calc::mic_key_least, mic_calc::mic_key_most, ROL32, ROR32, and XSWAP32.
Referenced by michael_calc(), michael_end(), and michael_init().
| static void michael_calc | ( | struct mic_calc * | mic_calc_ptr, | |
| uint32_t | start_ptr, | |||
| uint32_t | data_len | |||
| ) | [static] |
Continues TKIP MIC computation (Software implementation).
Continue MIC computation with the provided data.
| [in,out] | mic_calc_ptr | Pointer to Mic structure |
| [in] | start_ptr | Address of the data buffer (HW address) |
| [in] | data_len | Length, in bytes, of the data buffer |
Definition at line 215 of file me_mic.c.
References HW2CPU, mic_calc::last_m_i, mic_calc::last_m_i_len, LEN_IN_BITS, michael_block(), and SHIFTR.
| static void michael_end | ( | struct mic_calc * | mic_calc_ptr | ) | [static] |
Ends TKIP MIC computation (Software implementation).
Ends TKIP computation by adding padding data
| [in,out] | mic_calc_ptr | Pointer to Mic structure that will be initialize |
Definition at line 316 of file me_mic.c.
References ASSERT_ERR, mic_calc::last_m_i, mic_calc::last_m_i_len, LEN_IN_BITS, MIC_END_SIGNATURE, and michael_block().
| static void michael_init | ( | struct mic_calc * | mic_calc_ptr, | |
| uint32_t * | mic_key_ptr, | |||
| uint32_t * | aad | |||
| ) | [static] |
Initializes TKIP MIC computation (Software implementation).
| [out] | mic_calc_ptr | Pointer to Mic structure that will be initialize |
| [in] | mic_key_ptr | Key to use for MIC computation |
| [in] | aad | Additional Authentication Data vector (CPU address, 16 bytes long) |
Definition at line 188 of file me_mic.c.
References mic_calc::last_m_i, mic_calc::last_m_i_len, mic_calc::mic_key_least, mic_calc::mic_key_most, and michael_block().
1.6.1