Lines Matching refs:ctx

104 	struct tkip_ctx *ctx;
106 ctx = kmem_zalloc(sizeof (struct tkip_ctx), KM_SLEEP);
107 if (ctx == NULL)
110 ctx->tc_ic = ic;
111 return (ctx);
117 struct tkip_ctx *ctx = k->wk_private;
119 if (ctx != NULL)
120 kmem_free(ctx, sizeof (struct tkip_ctx));
139 struct tkip_ctx *ctx = k->wk_private;
140 struct ieee80211com *ic = ctx->tc_ic;
170 if (!tkip_encrypt(ctx, k, mp, hdrlen))
195 struct tkip_ctx *ctx = k->wk_private;
196 struct ieee80211com *ic = ctx->tc_ic;
219 ctx->rx_rsc = pn;
220 if (ctx->rx_rsc <= k->wk_keyrsc)
237 if (!tkip_decrypt(ctx, k, mp, hdrlen))
257 struct tkip_ctx *ctx = k->wk_private;
263 hdrlen = ieee80211_hdrspace(ctx->tc_ic, mp->b_rptr);
271 michael_mic(ctx, k->wk_txmic, mp, (hdrlen + tkip.ic_header),
285 struct tkip_ctx *ctx = k->wk_private;
288 int hdrlen = ieee80211_hdrspace(ctx->tc_ic, mp->b_rptr);
292 michael_mic(ctx, k->wk_rxmic,
310 k->wk_keyrsc = ctx->rx_rsc;
505 crypto_context_t ctx;
508 ctx = NULL;
509 rv = rc4_init(&ctx, (const uint8_t *)key, 16);
517 (void) rc4_crypt(ctx, mp->b_rptr + off, mp->b_rptr + off, data_len);
521 (void) rc4_crypt(ctx, crcbuf, icv, IEEE80211_WEP_CRCLEN);
523 (void) rc4_final(ctx, icv, IEEE80211_WEP_CRCLEN);
534 crypto_context_t ctx;
537 ctx = NULL;
538 rv = rc4_init(&ctx, (const uint8_t *)key, 16);
543 (void) rc4_crypt(ctx, mp->b_rptr + off, mp->b_rptr + off, data_len);
550 (void) rc4_crypt(ctx, icv, crcbuf, IEEE80211_WEP_CRCLEN);
551 (void) rc4_final(ctx, crcbuf, IEEE80211_WEP_CRCLEN);
652 michael_mic(struct tkip_ctx *ctx, const uint8_t *key,
712 tkip_encrypt(struct tkip_ctx *ctx, struct ieee80211_key *key,
719 if (!ctx->tx_phase1_done) {
720 tkip_mixing_phase1(ctx->tx_ttak, key->wk_key, wh->i_addr2,
722 ctx->tx_phase1_done = 1;
724 tkip_mixing_phase2(ctx->tx_rc4key, key->wk_key, ctx->tx_ttak,
730 (void) wep_encrypt(ctx->tx_rc4key,
738 ctx->tx_phase1_done = 0;
743 tkip_decrypt(struct tkip_ctx *ctx, struct ieee80211_key *key,
752 iv16 = (uint16_t)ctx->rx_rsc;
753 iv32 = (uint32_t)(ctx->rx_rsc >> 16);
755 if (iv32 != (uint32_t)(key->wk_keyrsc >> 16) || !ctx->rx_phase1_done) {
756 tkip_mixing_phase1(ctx->rx_ttak, key->wk_key,
758 ctx->rx_phase1_done = 0; /* DHCP */
760 tkip_mixing_phase2(ctx->rx_rc4key, key->wk_key, ctx->rx_ttak, iv16);
763 if (!wep_decrypt(ctx->rx_rc4key,
772 ctx->rx_phase1_done = 0;