Lines Matching defs:tkey

255 	struct rtllib_tkip_data *tkey = priv;
272 if (!tkey->tx_phase1_done) {
273 tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
274 tkey->tx_iv32);
275 tkey->tx_phase1_done = 1;
277 tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak,
278 tkey->tx_iv16);
280 tkey->tx_phase1_done = 1;
289 *pos++ = Hi8(tkey->tx_iv16);
290 *pos++ = (Hi8(tkey->tx_iv16) | 0x20) & 0x7F;
291 *pos++ = Lo8(tkey->tx_iv16);
298 *pos++ = (tkey->key_idx << 6) | (1 << 5) /* Ext IV included */;
299 *pos++ = tkey->tx_iv32 & 0xff;
300 *pos++ = (tkey->tx_iv32 >> 8) & 0xff;
301 *pos++ = (tkey->tx_iv32 >> 16) & 0xff;
302 *pos++ = (tkey->tx_iv32 >> 24) & 0xff;
312 arc4_setkey(&tkey->tx_ctx_arc4, rc4key, 16);
313 arc4_crypt(&tkey->tx_ctx_arc4, pos, pos, len + 4);
316 tkey->tx_iv16++;
317 if (tkey->tx_iv16 == 0) {
318 tkey->tx_phase1_done = 0;
319 tkey->tx_iv32++;
329 struct rtllib_tkip_data *tkey = priv;
356 if (tkey->key_idx != keyidx) {
358 "RX tkey->key_idx=%d frame keyidx=%d priv=%p\n",
359 tkey->key_idx, keyidx, priv);
362 if (!tkey->key_set) {
375 if ((iv32 < tkey->rx_iv32 ||
376 (iv32 == tkey->rx_iv32 && iv16 <= tkey->rx_iv16)) &&
377 tkey->initialized) {
381 hdr->addr2, tkey->rx_iv32,
382 tkey->rx_iv16, iv32, iv16);
384 tkey->dot11RSNAStatsTKIPReplays++;
387 tkey->initialized = true;
389 if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
390 tkip_mixing_phase1(tkey->rx_ttak, tkey->key,
392 tkey->rx_phase1_done = 1;
394 tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
398 arc4_setkey(&tkey->rx_ctx_arc4, rc4key, 16);
399 arc4_crypt(&tkey->rx_ctx_arc4, pos, pos, plen + 4);
408 if (iv32 != tkey->rx_iv32) {
413 tkey->rx_phase1_done = 0;
420 tkey->dot11RSNAStatsTKIPICVErrors++;
428 tkey->rx_iv32_new = iv32;
429 tkey->rx_iv16_new = iv16;
502 struct rtllib_tkip_data *tkey = priv;
515 michael_mic_hdr(skb, tkey->tx_hdr);
518 tkey->tx_hdr[12] = *(skb->data + hdr_len - 2) & 0x07;
520 if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr,
551 struct rtllib_tkip_data *tkey = priv;
557 if (!tkey->key_set)
560 michael_mic_hdr(skb, tkey->rx_hdr);
562 tkey->rx_hdr[12] = *(skb->data + hdr_len - 2) & 0x07;
564 if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
581 tkey->dot11RSNAStatsTKIPLocalMICFailures++;
588 tkey->rx_iv32 = tkey->rx_iv32_new;
589 tkey->rx_iv16 = tkey->rx_iv16_new;
598 struct rtllib_tkip_data *tkey = priv;
600 struct crypto_shash *tfm = tkey->tx_tfm_michael;
601 struct crypto_shash *tfm3 = tkey->rx_tfm_michael;
603 keyidx = tkey->key_idx;
604 memset(tkey, 0, sizeof(*tkey));
605 tkey->key_idx = keyidx;
606 tkey->tx_tfm_michael = tfm;
607 tkey->rx_tfm_michael = tfm3;
610 memcpy(tkey->key, key, TKIP_KEY_LEN);
611 tkey->key_set = 1;
612 tkey->tx_iv16 = 1; /* TSC is initialized to 1 */
614 tkey->rx_iv32 = (seq[5] << 24) | (seq[4] << 16) |
616 tkey->rx_iv16 = (seq[1] << 8) | seq[0];
619 tkey->key_set = 0;
629 struct rtllib_tkip_data *tkey = priv;
634 if (!tkey->key_set)
636 memcpy(key, tkey->key, TKIP_KEY_LEN);
640 u16 iv16 = tkey->tx_iv16;
641 u32 iv32 = tkey->tx_iv32;
646 seq[0] = tkey->tx_iv16;
647 seq[1] = tkey->tx_iv16 >> 8;
648 seq[2] = tkey->tx_iv32;
649 seq[3] = tkey->tx_iv32 >> 8;
650 seq[4] = tkey->tx_iv32 >> 16;
651 seq[5] = tkey->tx_iv32 >> 24;