Lines Matching refs:tkey

286 	struct lib80211_tkip_data *tkey = priv;  in lib80211_tkip_hdr()  local
298 if (!tkey->tx_phase1_done) { in lib80211_tkip_hdr()
299 tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, in lib80211_tkip_hdr()
300 tkey->tx_iv32); in lib80211_tkip_hdr()
301 tkey->tx_phase1_done = 1; in lib80211_tkip_hdr()
303 tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); in lib80211_tkip_hdr()
312 *pos++ = (tkey->key_idx << 6) | (1 << 5) /* Ext IV included */ ; in lib80211_tkip_hdr()
313 *pos++ = tkey->tx_iv32 & 0xff; in lib80211_tkip_hdr()
314 *pos++ = (tkey->tx_iv32 >> 8) & 0xff; in lib80211_tkip_hdr()
315 *pos++ = (tkey->tx_iv32 >> 16) & 0xff; in lib80211_tkip_hdr()
316 *pos++ = (tkey->tx_iv32 >> 24) & 0xff; in lib80211_tkip_hdr()
318 tkey->tx_iv16++; in lib80211_tkip_hdr()
319 if (tkey->tx_iv16 == 0) { in lib80211_tkip_hdr()
320 tkey->tx_phase1_done = 0; in lib80211_tkip_hdr()
321 tkey->tx_iv32++; in lib80211_tkip_hdr()
329 struct lib80211_tkip_data *tkey = priv; in lib80211_tkip_encrypt() local
334 if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { in lib80211_tkip_encrypt()
357 arc4_setkey(&tkey->tx_ctx_arc4, rc4key, 16); in lib80211_tkip_encrypt()
358 arc4_crypt(&tkey->tx_ctx_arc4, pos, pos, len + 4); in lib80211_tkip_encrypt()
378 struct lib80211_tkip_data *tkey = priv; in lib80211_tkip_decrypt() local
390 if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { in lib80211_tkip_decrypt()
407 if (tkey->key_idx != keyidx) { in lib80211_tkip_decrypt()
409 tkey->key_idx, keyidx); in lib80211_tkip_decrypt()
412 if (!tkey->key_set) { in lib80211_tkip_decrypt()
421 if (tkip_replay_check(iv32, iv16, tkey->rx_iv32, tkey->rx_iv16)) { in lib80211_tkip_decrypt()
424 hdr->addr2, tkey->rx_iv32, tkey->rx_iv16, in lib80211_tkip_decrypt()
427 tkey->dot11RSNAStatsTKIPReplays++; in lib80211_tkip_decrypt()
431 if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) { in lib80211_tkip_decrypt()
432 tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32); in lib80211_tkip_decrypt()
433 tkey->rx_phase1_done = 1; in lib80211_tkip_decrypt()
435 tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16); in lib80211_tkip_decrypt()
439 arc4_setkey(&tkey->rx_ctx_arc4, rc4key, 16); in lib80211_tkip_decrypt()
440 arc4_crypt(&tkey->rx_ctx_arc4, pos, pos, plen + 4); in lib80211_tkip_decrypt()
448 if (iv32 != tkey->rx_iv32) { in lib80211_tkip_decrypt()
451 tkey->rx_phase1_done = 0; in lib80211_tkip_decrypt()
457 tkey->dot11RSNAStatsTKIPICVErrors++; in lib80211_tkip_decrypt()
463 tkey->rx_iv32_new = iv32; in lib80211_tkip_decrypt()
464 tkey->rx_iv16_new = iv16; in lib80211_tkip_decrypt()
544 struct lib80211_tkip_data *tkey = priv; in lib80211_michael_mic_add() local
554 michael_mic_hdr(skb, tkey->tx_hdr); in lib80211_michael_mic_add()
556 if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr, in lib80211_michael_mic_add()
587 struct lib80211_tkip_data *tkey = priv; in lib80211_michael_mic_verify() local
590 if (!tkey->key_set) in lib80211_michael_mic_verify()
593 michael_mic_hdr(skb, tkey->rx_hdr); in lib80211_michael_mic_verify()
594 if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr, in lib80211_michael_mic_verify()
606 tkey->dot11RSNAStatsTKIPLocalMICFailures++; in lib80211_michael_mic_verify()
612 tkey->rx_iv32 = tkey->rx_iv32_new; in lib80211_michael_mic_verify()
613 tkey->rx_iv16 = tkey->rx_iv16_new; in lib80211_michael_mic_verify()
622 struct lib80211_tkip_data *tkey = priv; in lib80211_tkip_set_key() local
624 struct crypto_shash *tfm = tkey->tx_tfm_michael; in lib80211_tkip_set_key()
625 struct arc4_ctx *tfm2 = &tkey->tx_ctx_arc4; in lib80211_tkip_set_key()
626 struct crypto_shash *tfm3 = tkey->rx_tfm_michael; in lib80211_tkip_set_key()
627 struct arc4_ctx *tfm4 = &tkey->rx_ctx_arc4; in lib80211_tkip_set_key()
629 keyidx = tkey->key_idx; in lib80211_tkip_set_key()
630 memset(tkey, 0, sizeof(*tkey)); in lib80211_tkip_set_key()
631 tkey->key_idx = keyidx; in lib80211_tkip_set_key()
632 tkey->tx_tfm_michael = tfm; in lib80211_tkip_set_key()
633 tkey->tx_ctx_arc4 = *tfm2; in lib80211_tkip_set_key()
634 tkey->rx_tfm_michael = tfm3; in lib80211_tkip_set_key()
635 tkey->rx_ctx_arc4 = *tfm4; in lib80211_tkip_set_key()
637 memcpy(tkey->key, key, TKIP_KEY_LEN); in lib80211_tkip_set_key()
638 tkey->key_set = 1; in lib80211_tkip_set_key()
639 tkey->tx_iv16 = 1; /* TSC is initialized to 1 */ in lib80211_tkip_set_key()
641 tkey->rx_iv32 = (seq[5] << 24) | (seq[4] << 16) | in lib80211_tkip_set_key()
643 tkey->rx_iv16 = (seq[1] << 8) | seq[0]; in lib80211_tkip_set_key()
646 tkey->key_set = 0; in lib80211_tkip_set_key()
655 struct lib80211_tkip_data *tkey = priv; in lib80211_tkip_get_key() local
660 if (!tkey->key_set) in lib80211_tkip_get_key()
662 memcpy(key, tkey->key, TKIP_KEY_LEN); in lib80211_tkip_get_key()
666 u16 iv16 = tkey->tx_iv16; in lib80211_tkip_get_key()
667 u32 iv32 = tkey->tx_iv32; in lib80211_tkip_get_key()
671 seq[0] = tkey->tx_iv16; in lib80211_tkip_get_key()
672 seq[1] = tkey->tx_iv16 >> 8; in lib80211_tkip_get_key()
673 seq[2] = tkey->tx_iv32; in lib80211_tkip_get_key()
674 seq[3] = tkey->tx_iv32 >> 8; in lib80211_tkip_get_key()
675 seq[4] = tkey->tx_iv32 >> 16; in lib80211_tkip_get_key()
676 seq[5] = tkey->tx_iv32 >> 24; in lib80211_tkip_get_key()