1/*- 2 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> |
27__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_crypto_tkip.c 186302 2008-12-18 23:00:09Z sam $"); |
28 29/* 30 * IEEE 802.11i TKIP crypto support. 31 * 32 * Part of this module is derived from similar code in the Host 33 * AP driver. The code is used with the consent of the author and 34 * it's license is included below. 35 */ --- 68 unchanged lines hidden (view full) --- 104/* number of references from net80211 layer */ 105static int nrefs = 0; 106 107static void * 108tkip_attach(struct ieee80211vap *vap, struct ieee80211_key *k) 109{ 110 struct tkip_ctx *ctx; 111 |
112 ctx = (struct tkip_ctx *) malloc(sizeof(struct tkip_ctx), |
113 M_80211_CRYPTO, M_NOWAIT | M_ZERO); 114 if (ctx == NULL) { 115 vap->iv_stats.is_crypto_nomem++; 116 return NULL; 117 } 118 119 ctx->tc_vap = vap; 120 nrefs++; /* NB: we assume caller locking */ 121 return ctx; 122} 123 124static void 125tkip_detach(struct ieee80211_key *k) 126{ 127 struct tkip_ctx *ctx = k->wk_private; 128 |
129 free(ctx, M_80211_CRYPTO); |
130 KASSERT(nrefs > 0, ("imbalanced attach/detach")); 131 nrefs--; /* NB: we assume caller locking */ 132} 133 134static int 135tkip_setkey(struct ieee80211_key *k) 136{ 137 struct tkip_ctx *ctx = k->wk_private; --- 860 unchanged lines hidden --- |