Deleted Added
full compact
ieee80211_crypto_tkip.c (184210) ieee80211_crypto_tkip.c (186302)
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>
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 184210 2008-10-23 19:57:13Z des $");
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
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 MALLOC(ctx, struct tkip_ctx *, sizeof(struct tkip_ctx),
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
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);
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 ---
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 ---