Lines Matching +full:data +full:- +full:transfer

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
21 switch (key->cipher) { in rt2x00crypto_key_to_cipher()
40 struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; in rt2x00crypto_create_tx_descriptor()
45 __set_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags); in rt2x00crypto_create_tx_descriptor()
47 txdesc->cipher = rt2x00crypto_key_to_cipher(hw_key); in rt2x00crypto_create_tx_descriptor()
49 if (hw_key->flags & IEEE80211_KEY_FLAG_PAIRWISE) in rt2x00crypto_create_tx_descriptor()
50 __set_bit(ENTRY_TXD_ENCRYPT_PAIRWISE, &txdesc->flags); in rt2x00crypto_create_tx_descriptor()
52 txdesc->key_idx = hw_key->hw_key_idx; in rt2x00crypto_create_tx_descriptor()
53 txdesc->iv_offset = txdesc->header_length; in rt2x00crypto_create_tx_descriptor()
54 txdesc->iv_len = hw_key->iv_len; in rt2x00crypto_create_tx_descriptor()
56 if (!(hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV)) in rt2x00crypto_create_tx_descriptor()
57 __set_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags); in rt2x00crypto_create_tx_descriptor()
59 if (!(hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) in rt2x00crypto_create_tx_descriptor()
60 __set_bit(ENTRY_TXD_ENCRYPT_MMIC, &txdesc->flags); in rt2x00crypto_create_tx_descriptor()
67 struct ieee80211_key_conf *key = tx_info->control.hw_key; in rt2x00crypto_tx_overhead()
78 overhead += key->icv_len; in rt2x00crypto_tx_overhead()
80 if (!(key->flags & IEEE80211_KEY_FLAG_GENERATE_IV)) in rt2x00crypto_tx_overhead()
81 overhead += key->iv_len; in rt2x00crypto_tx_overhead()
83 if (!(key->flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) { in rt2x00crypto_tx_overhead()
84 if (key->cipher == WLAN_CIPHER_SUITE_TKIP) in rt2x00crypto_tx_overhead()
95 if (unlikely(!txdesc->iv_len)) in rt2x00crypto_tx_copy_iv()
98 /* Copy IV/EIV data */ in rt2x00crypto_tx_copy_iv()
99 memcpy(skbdesc->iv, skb->data + txdesc->iv_offset, txdesc->iv_len); in rt2x00crypto_tx_copy_iv()
106 if (unlikely(!txdesc->iv_len)) in rt2x00crypto_tx_remove_iv()
109 /* Copy IV/EIV data */ in rt2x00crypto_tx_remove_iv()
110 memcpy(skbdesc->iv, skb->data + txdesc->iv_offset, txdesc->iv_len); in rt2x00crypto_tx_remove_iv()
113 memmove(skb->data + txdesc->iv_len, skb->data, txdesc->iv_offset); in rt2x00crypto_tx_remove_iv()
116 skb_pull(skb, txdesc->iv_len); in rt2x00crypto_tx_remove_iv()
117 txdesc->length -= txdesc->iv_len; in rt2x00crypto_tx_remove_iv()
119 /* IV/EIV data has officially been stripped */ in rt2x00crypto_tx_remove_iv()
120 skbdesc->flags |= SKBDESC_IV_STRIPPED; in rt2x00crypto_tx_remove_iv()
127 ((!!(skbdesc->iv[0])) * 4) + ((!!(skbdesc->iv[1])) * 4); in rt2x00crypto_tx_insert_iv()
129 if (!(skbdesc->flags & SKBDESC_IV_STRIPPED)) in rt2x00crypto_tx_insert_iv()
135 memmove(skb->data, skb->data + iv_len, header_length); in rt2x00crypto_tx_insert_iv()
137 /* Copy IV/EIV data */ in rt2x00crypto_tx_insert_iv()
138 memcpy(skb->data + header_length, skbdesc->iv, iv_len); in rt2x00crypto_tx_insert_iv()
140 /* IV/EIV data has returned into the frame */ in rt2x00crypto_tx_insert_iv()
141 skbdesc->flags &= ~SKBDESC_IV_STRIPPED; in rt2x00crypto_tx_insert_iv()
148 unsigned int payload_len = rxdesc->size - header_length; in rt2x00crypto_rx_insert_iv()
152 unsigned int transfer = 0; in rt2x00crypto_rx_insert_iv() local
159 switch (rxdesc->cipher) { in rt2x00crypto_rx_insert_iv()
179 * Make room for new data. There are 2 possibilities in rt2x00crypto_rx_insert_iv()
184 * for the iv data. in rt2x00crypto_rx_insert_iv()
189 if (rxdesc->dev_flags & RXDONE_L2PAD) { in rt2x00crypto_rx_insert_iv()
190 skb_push(skb, iv_len - align); in rt2x00crypto_rx_insert_iv()
194 memmove(skb->data + transfer, in rt2x00crypto_rx_insert_iv()
195 skb->data + transfer + (iv_len - align), in rt2x00crypto_rx_insert_iv()
197 transfer += header_length; in rt2x00crypto_rx_insert_iv()
200 skb_put(skb, icv_len - align); in rt2x00crypto_rx_insert_iv()
203 memmove(skb->data + transfer, in rt2x00crypto_rx_insert_iv()
204 skb->data + transfer + iv_len + align, in rt2x00crypto_rx_insert_iv()
206 transfer += header_length; in rt2x00crypto_rx_insert_iv()
209 /* Copy IV/EIV data */ in rt2x00crypto_rx_insert_iv()
210 memcpy(skb->data + transfer, rxdesc->iv, iv_len); in rt2x00crypto_rx_insert_iv()
211 transfer += iv_len; in rt2x00crypto_rx_insert_iv()
217 if (!(rxdesc->dev_flags & RXDONE_L2PAD)) { in rt2x00crypto_rx_insert_iv()
218 memmove(skb->data + transfer, in rt2x00crypto_rx_insert_iv()
219 skb->data + transfer + align, in rt2x00crypto_rx_insert_iv()
226 * for determining the correct offset for the ICV data. in rt2x00crypto_rx_insert_iv()
228 transfer += payload_len; in rt2x00crypto_rx_insert_iv()
231 * Copy ICV data in rt2x00crypto_rx_insert_iv()
236 memcpy(skb->data + transfer, &rxdesc->icv, 4); in rt2x00crypto_rx_insert_iv()
237 transfer += icv_len; in rt2x00crypto_rx_insert_iv()
240 rxdesc->size = transfer; in rt2x00crypto_rx_insert_iv()
241 rxdesc->flags &= ~RX_FLAG_IV_STRIPPED; in rt2x00crypto_rx_insert_iv()