Lines Matching refs:tkey

303 	struct lib80211_tkip_data *tkey = priv;  in lib80211_tkip_hdr()  local
315 if (!tkey->tx_phase1_done) { in lib80211_tkip_hdr()
316 tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, in lib80211_tkip_hdr()
317 tkey->tx_iv32); in lib80211_tkip_hdr()
318 tkey->tx_phase1_done = 1; in lib80211_tkip_hdr()
320 tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); in lib80211_tkip_hdr()
329 *pos++ = (tkey->key_idx << 6) | (1 << 5) /* Ext IV included */ ; in lib80211_tkip_hdr()
330 *pos++ = tkey->tx_iv32 & 0xff; in lib80211_tkip_hdr()
331 *pos++ = (tkey->tx_iv32 >> 8) & 0xff; in lib80211_tkip_hdr()
332 *pos++ = (tkey->tx_iv32 >> 16) & 0xff; in lib80211_tkip_hdr()
333 *pos++ = (tkey->tx_iv32 >> 24) & 0xff; in lib80211_tkip_hdr()
335 tkey->tx_iv16++; in lib80211_tkip_hdr()
336 if (tkey->tx_iv16 == 0) { in lib80211_tkip_hdr()
337 tkey->tx_phase1_done = 0; in lib80211_tkip_hdr()
338 tkey->tx_iv32++; in lib80211_tkip_hdr()
346 struct lib80211_tkip_data *tkey = priv; in lib80211_tkip_encrypt() local
347 SKCIPHER_REQUEST_ON_STACK(req, tkey->tx_tfm_arc4); in lib80211_tkip_encrypt()
354 if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { in lib80211_tkip_encrypt()
377 crypto_skcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); in lib80211_tkip_encrypt()
379 skcipher_request_set_tfm(req, tkey->tx_tfm_arc4); in lib80211_tkip_encrypt()
402 struct lib80211_tkip_data *tkey = priv; in lib80211_tkip_decrypt() local
403 SKCIPHER_REQUEST_ON_STACK(req, tkey->rx_tfm_arc4); in lib80211_tkip_decrypt()
417 if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { in lib80211_tkip_decrypt()
434 if (tkey->key_idx != keyidx) { in lib80211_tkip_decrypt()
436 tkey->key_idx, keyidx); in lib80211_tkip_decrypt()
439 if (!tkey->key_set) { in lib80211_tkip_decrypt()
448 if (tkip_replay_check(iv32, iv16, tkey->rx_iv32, tkey->rx_iv16)) { in lib80211_tkip_decrypt()
451 hdr->addr2, tkey->rx_iv32, tkey->rx_iv16, in lib80211_tkip_decrypt()
454 tkey->dot11RSNAStatsTKIPReplays++; in lib80211_tkip_decrypt()
458 if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) { in lib80211_tkip_decrypt()
459 tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32); in lib80211_tkip_decrypt()
460 tkey->rx_phase1_done = 1; in lib80211_tkip_decrypt()
462 tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16); in lib80211_tkip_decrypt()
466 crypto_skcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); in lib80211_tkip_decrypt()
468 skcipher_request_set_tfm(req, tkey->rx_tfm_arc4); in lib80211_tkip_decrypt()
485 if (iv32 != tkey->rx_iv32) { in lib80211_tkip_decrypt()
488 tkey->rx_phase1_done = 0; in lib80211_tkip_decrypt()
494 tkey->dot11RSNAStatsTKIPICVErrors++; in lib80211_tkip_decrypt()
500 tkey->rx_iv32_new = iv32; in lib80211_tkip_decrypt()
501 tkey->rx_iv16_new = iv16; in lib80211_tkip_decrypt()
582 struct lib80211_tkip_data *tkey = priv; in lib80211_michael_mic_add() local
592 michael_mic_hdr(skb, tkey->tx_hdr); in lib80211_michael_mic_add()
594 if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr, in lib80211_michael_mic_add()
625 struct lib80211_tkip_data *tkey = priv; in lib80211_michael_mic_verify() local
628 if (!tkey->key_set) in lib80211_michael_mic_verify()
631 michael_mic_hdr(skb, tkey->rx_hdr); in lib80211_michael_mic_verify()
632 if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr, in lib80211_michael_mic_verify()
644 tkey->dot11RSNAStatsTKIPLocalMICFailures++; in lib80211_michael_mic_verify()
650 tkey->rx_iv32 = tkey->rx_iv32_new; in lib80211_michael_mic_verify()
651 tkey->rx_iv16 = tkey->rx_iv16_new; in lib80211_michael_mic_verify()
660 struct lib80211_tkip_data *tkey = priv; in lib80211_tkip_set_key() local
662 struct crypto_shash *tfm = tkey->tx_tfm_michael; in lib80211_tkip_set_key()
663 struct crypto_skcipher *tfm2 = tkey->tx_tfm_arc4; in lib80211_tkip_set_key()
664 struct crypto_shash *tfm3 = tkey->rx_tfm_michael; in lib80211_tkip_set_key()
665 struct crypto_skcipher *tfm4 = tkey->rx_tfm_arc4; in lib80211_tkip_set_key()
667 keyidx = tkey->key_idx; in lib80211_tkip_set_key()
668 memset(tkey, 0, sizeof(*tkey)); in lib80211_tkip_set_key()
669 tkey->key_idx = keyidx; in lib80211_tkip_set_key()
670 tkey->tx_tfm_michael = tfm; in lib80211_tkip_set_key()
671 tkey->tx_tfm_arc4 = tfm2; in lib80211_tkip_set_key()
672 tkey->rx_tfm_michael = tfm3; in lib80211_tkip_set_key()
673 tkey->rx_tfm_arc4 = tfm4; in lib80211_tkip_set_key()
675 memcpy(tkey->key, key, TKIP_KEY_LEN); in lib80211_tkip_set_key()
676 tkey->key_set = 1; in lib80211_tkip_set_key()
677 tkey->tx_iv16 = 1; /* TSC is initialized to 1 */ in lib80211_tkip_set_key()
679 tkey->rx_iv32 = (seq[5] << 24) | (seq[4] << 16) | in lib80211_tkip_set_key()
681 tkey->rx_iv16 = (seq[1] << 8) | seq[0]; in lib80211_tkip_set_key()
684 tkey->key_set = 0; in lib80211_tkip_set_key()
693 struct lib80211_tkip_data *tkey = priv; in lib80211_tkip_get_key() local
698 if (!tkey->key_set) in lib80211_tkip_get_key()
700 memcpy(key, tkey->key, TKIP_KEY_LEN); in lib80211_tkip_get_key()
704 u16 iv16 = tkey->tx_iv16; in lib80211_tkip_get_key()
705 u32 iv32 = tkey->tx_iv32; in lib80211_tkip_get_key()
709 seq[0] = tkey->tx_iv16; in lib80211_tkip_get_key()
710 seq[1] = tkey->tx_iv16 >> 8; in lib80211_tkip_get_key()
711 seq[2] = tkey->tx_iv32; in lib80211_tkip_get_key()
712 seq[3] = tkey->tx_iv32 >> 8; in lib80211_tkip_get_key()
713 seq[4] = tkey->tx_iv32 >> 16; in lib80211_tkip_get_key()
714 seq[5] = tkey->tx_iv32 >> 24; in lib80211_tkip_get_key()