net80211: get rid of tx_phase1_done flag (ieee80211_crypto_tkip.c).
Submitted by: <s3erios@gmail.com> Differential Revision: https://reviews.freebsd.org/D3596
This commit is contained in:
parent
056e398239
commit
483755be00
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=288525
@ -84,7 +84,6 @@ struct tkip_ctx {
|
||||
struct ieee80211vap *tc_vap; /* for diagnostics+statistics */
|
||||
|
||||
u16 tx_ttak[5];
|
||||
int tx_phase1_done;
|
||||
u8 tx_rc4key[16]; /* XXX for test module; make locals? */
|
||||
|
||||
u16 rx_ttak[5];
|
||||
@ -143,7 +142,6 @@ tkip_setkey(struct ieee80211_key *k)
|
||||
__func__, k->wk_keylen, 128/NBBY);
|
||||
return 0;
|
||||
}
|
||||
k->wk_keytsc = 1; /* TSC starts at 1 */
|
||||
ctx->rx_phase1_done = 0;
|
||||
return 1;
|
||||
}
|
||||
@ -188,6 +186,7 @@ tkip_encap(struct ieee80211_key *k, struct mbuf *m)
|
||||
|
||||
keyid = ieee80211_crypto_get_keyid(vap, k) << 6;
|
||||
|
||||
k->wk_keytsc++;
|
||||
ivp[0] = k->wk_keytsc >> 8; /* TSC1 */
|
||||
ivp[1] = (ivp[0] | 0x20) & 0x7f; /* WEP seed */
|
||||
ivp[2] = k->wk_keytsc >> 0; /* TSC0 */
|
||||
@ -200,12 +199,9 @@ tkip_encap(struct ieee80211_key *k, struct mbuf *m)
|
||||
/*
|
||||
* Finally, do software encrypt if needed.
|
||||
*/
|
||||
if (k->wk_flags & IEEE80211_KEY_SWENCRYPT) {
|
||||
if (!tkip_encrypt(ctx, k, m, hdrlen))
|
||||
return 0;
|
||||
/* NB: tkip_encrypt handles wk_keytsc */
|
||||
} else
|
||||
k->wk_keytsc++;
|
||||
if ((k->wk_flags & IEEE80211_KEY_SWENCRYPT) &&
|
||||
!tkip_encrypt(ctx, k, m, hdrlen))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -934,10 +930,9 @@ tkip_encrypt(struct tkip_ctx *ctx, struct ieee80211_key *key,
|
||||
ctx->tc_vap->iv_stats.is_crypto_tkip++;
|
||||
|
||||
wh = mtod(m, struct ieee80211_frame *);
|
||||
if (!ctx->tx_phase1_done) {
|
||||
if ((u16)(key->wk_keytsc) == 0 || key->wk_keytsc == 1) {
|
||||
tkip_mixing_phase1(ctx->tx_ttak, key->wk_key, wh->i_addr2,
|
||||
(u32)(key->wk_keytsc >> 16));
|
||||
ctx->tx_phase1_done = 1;
|
||||
}
|
||||
tkip_mixing_phase2(ctx->tx_rc4key, key->wk_key, ctx->tx_ttak,
|
||||
(u16) key->wk_keytsc);
|
||||
@ -948,9 +943,6 @@ tkip_encrypt(struct tkip_ctx *ctx, struct ieee80211_key *key,
|
||||
icv);
|
||||
(void) m_append(m, IEEE80211_WEP_CRCLEN, icv); /* XXX check return */
|
||||
|
||||
key->wk_keytsc++;
|
||||
if ((u16)(key->wk_keytsc) == 0)
|
||||
ctx->tx_phase1_done = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user