ieee80211_crypto.h (93badfa1f2c7f97efac0842c59cccac862dfe112) | ieee80211_crypto.h (ee9d294b3669bc8cbe3d782967bb547c73429f2f) |
---|---|
1/*- 2 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 59 unchanged lines hidden (view full) --- 68 * the cipher is expected to honor this and do the necessary work. 69 * Ciphers such as TKIP may also support mixed hardware/software 70 * encrypt/decrypt and MIC processing. 71 */ 72typedef uint16_t ieee80211_keyix; /* h/w key index */ 73 74struct ieee80211_key { 75 uint8_t wk_keylen; /* key length in bytes */ | 1/*- 2 * Copyright (c) 2001 Atsushi Onoe 3 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 59 unchanged lines hidden (view full) --- 68 * the cipher is expected to honor this and do the necessary work. 69 * Ciphers such as TKIP may also support mixed hardware/software 70 * encrypt/decrypt and MIC processing. 71 */ 72typedef uint16_t ieee80211_keyix; /* h/w key index */ 73 74struct ieee80211_key { 75 uint8_t wk_keylen; /* key length in bytes */ |
76 uint8_t wk_pad; 77 uint16_t wk_flags; 78#define IEEE80211_KEY_XMIT 0x0001 /* key used for xmit */ 79#define IEEE80211_KEY_RECV 0x0002 /* key used for recv */ 80#define IEEE80211_KEY_GROUP 0x0004 /* key used for WPA group operation */ 81#define IEEE80211_KEY_NOREPLAY 0x0008 /* ignore replay failures */ 82#define IEEE80211_KEY_SWENCRYPT 0x0010 /* host-based encrypt */ 83#define IEEE80211_KEY_SWDECRYPT 0x0020 /* host-based decrypt */ 84#define IEEE80211_KEY_SWENMIC 0x0040 /* host-based enmic */ 85#define IEEE80211_KEY_SWDEMIC 0x0080 /* host-based demic */ 86#define IEEE80211_KEY_DEVKEY 0x0100 /* device key request completed */ 87#define IEEE80211_KEY_CIPHER0 0x1000 /* cipher-specific action 0 */ 88#define IEEE80211_KEY_CIPHER1 0x2000 /* cipher-specific action 1 */ | 76 uint8_t wk_pad; /* .. some drivers use this. Fix that. */ 77 uint8_t wk_pad1[2]; 78 uint32_t wk_flags; 79#define IEEE80211_KEY_XMIT 0x00000001 /* key used for xmit */ 80#define IEEE80211_KEY_RECV 0x00000002 /* key used for recv */ 81#define IEEE80211_KEY_GROUP 0x00000004 /* key used for WPA group operation */ 82#define IEEE80211_KEY_NOREPLAY 0x00000008 /* ignore replay failures */ 83#define IEEE80211_KEY_SWENCRYPT 0x00000010 /* host-based encrypt */ 84#define IEEE80211_KEY_SWDECRYPT 0x00000020 /* host-based decrypt */ 85#define IEEE80211_KEY_SWENMIC 0x00000040 /* host-based enmic */ 86#define IEEE80211_KEY_SWDEMIC 0x00000080 /* host-based demic */ 87#define IEEE80211_KEY_DEVKEY 0x00000100 /* device key request completed */ 88#define IEEE80211_KEY_CIPHER0 0x00001000 /* cipher-specific action 0 */ 89#define IEEE80211_KEY_CIPHER1 0x00002000 /* cipher-specific action 1 */ 90#define IEEE80211_KEY_NOIV 0x00004000 /* don't insert IV/MIC for !mgmt */ 91#define IEEE80211_KEY_NOIVMGT 0x00008000 /* don't insert IV/MIC for mgmt */ 92#define IEEE80211_KEY_NOMIC 0x00010000 /* don't insert MIC for !mgmt */ 93#define IEEE80211_KEY_NOMICMGT 0x00020000 /* don't insert MIC for mgmt */ 94 |
89 ieee80211_keyix wk_keyix; /* h/w key index */ 90 ieee80211_keyix wk_rxkeyix; /* optional h/w rx key index */ 91 uint8_t wk_key[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE]; 92#define wk_txmic wk_key+IEEE80211_KEYBUF_SIZE+0 /* XXX can't () right */ 93#define wk_rxmic wk_key+IEEE80211_KEYBUF_SIZE+8 /* XXX can't () right */ 94 /* key receive sequence counter */ 95 uint64_t wk_keyrsc[IEEE80211_TID_SIZE]; 96 uint64_t wk_keytsc; /* key transmit sequence counter */ --- 101 unchanged lines hidden (view full) --- 198uint8_t ieee80211_crypto_get_keyid(struct ieee80211vap *vap, 199 struct ieee80211_key *k); 200struct ieee80211_key *ieee80211_crypto_get_txkey(struct ieee80211_node *, 201 struct mbuf *); 202struct ieee80211_key *ieee80211_crypto_encap(struct ieee80211_node *, 203 struct mbuf *); 204struct ieee80211_key *ieee80211_crypto_decap(struct ieee80211_node *, 205 struct mbuf *, int); | 95 ieee80211_keyix wk_keyix; /* h/w key index */ 96 ieee80211_keyix wk_rxkeyix; /* optional h/w rx key index */ 97 uint8_t wk_key[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE]; 98#define wk_txmic wk_key+IEEE80211_KEYBUF_SIZE+0 /* XXX can't () right */ 99#define wk_rxmic wk_key+IEEE80211_KEYBUF_SIZE+8 /* XXX can't () right */ 100 /* key receive sequence counter */ 101 uint64_t wk_keyrsc[IEEE80211_TID_SIZE]; 102 uint64_t wk_keytsc; /* key transmit sequence counter */ --- 101 unchanged lines hidden (view full) --- 204uint8_t ieee80211_crypto_get_keyid(struct ieee80211vap *vap, 205 struct ieee80211_key *k); 206struct ieee80211_key *ieee80211_crypto_get_txkey(struct ieee80211_node *, 207 struct mbuf *); 208struct ieee80211_key *ieee80211_crypto_encap(struct ieee80211_node *, 209 struct mbuf *); 210struct ieee80211_key *ieee80211_crypto_decap(struct ieee80211_node *, 211 struct mbuf *, int); |
206 | 212int ieee80211_crypto_demic(struct ieee80211vap *vap, struct ieee80211_key *k, 213 struct mbuf *, int); |
207/* | 214/* |
208 * Check and remove any MIC. 209 */ 210static __inline int 211ieee80211_crypto_demic(struct ieee80211vap *vap, struct ieee80211_key *k, 212 struct mbuf *m, int force) 213{ 214 const struct ieee80211_cipher *cip = k->wk_cipher; 215 return (cip->ic_miclen > 0 ? cip->ic_demic(k, m, force) : 1); 216} 217 218/* | |
219 * Add any MIC. 220 */ 221static __inline int 222ieee80211_crypto_enmic(struct ieee80211vap *vap, 223 struct ieee80211_key *k, struct mbuf *m, int force) 224{ 225 const struct ieee80211_cipher *cip = k->wk_cipher; 226 return (cip->ic_miclen > 0 ? cip->ic_enmic(k, m, force) : 1); --- 27 unchanged lines hidden --- | 215 * Add any MIC. 216 */ 217static __inline int 218ieee80211_crypto_enmic(struct ieee80211vap *vap, 219 struct ieee80211_key *k, struct mbuf *m, int force) 220{ 221 const struct ieee80211_cipher *cip = k->wk_cipher; 222 return (cip->ic_miclen > 0 ? cip->ic_enmic(k, m, force) : 1); --- 27 unchanged lines hidden --- |