33 #include <linux/types.h>
34 #include <linux/kernel.h>
36 #include <linux/usb/ch9.h>
69 #define WUIE_ELT_MAX 4
83 static const struct wusb_ckhdid wusb_ckhdid_zero = { .data = { 0 } };
85 #define WUSB_CKHDID_STRSIZE (3 * sizeof(struct wusb_ckhdid) + 1)
208 static inline int wusb_dn_connect_prev_dev_addr(
const struct wusb_dn_connect *
dn)
213 static inline int wusb_dn_connect_new_connection(
const struct wusb_dn_connect *
dn)
218 static inline int wusb_dn_connect_beacon_behavior(
const struct wusb_dn_connect *dn)
238 static inline size_t ckhdid_printf(
char *pr_ckhdid,
size_t size,
242 "%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx "
243 "%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx",
251 ckhdid->
data[14], ckhdid->
data[15]);
264 static inline u8 wusb_key_index(
int index,
int type,
int originator)
266 return (originator << 6) | (type << 4) | index;
269 #define WUSB_KEY_INDEX_TYPE_PTK 0
270 #define WUSB_KEY_INDEX_TYPE_ASSOC 1
271 #define WUSB_KEY_INDEX_TYPE_GTK 2
272 #define WUSB_KEY_INDEX_ORIGINATOR_HOST 0
273 #define WUSB_KEY_INDEX_ORIGINATOR_DEVICE 1
313 const void *
b,
size_t blen,
size_t len);
315 static inline int wusb_prf_64(
void *
out,
size_t out_size,
const u8 key[16],
318 const void *
b,
size_t blen)
320 return wusb_prf(out, out_size, key, n, a, b, blen, 64);
323 static inline int wusb_prf_128(
void *
out,
size_t out_size,
const u8 key[16],
326 const void *
b,
size_t blen)
328 return wusb_prf(out, out_size, key, n, a, b, blen, 128);
331 static inline int wusb_prf_256(
void *
out,
size_t out_size,
const u8 key[16],
334 const void *
b,
size_t blen)
336 return wusb_prf(out, out_size, key, n, a, b, blen, 256);
346 return wusb_prf_256(keydvt_out,
sizeof(*keydvt_out), key, n, &a,
347 keydvt_in,
sizeof(*keydvt_in));
366 static inline int wusb_oob_mic(
u8 mic_out[8],
const u8 key[16],
371 return wusb_prf_64(mic_out, 8, key, n, &a,
372 hs,
sizeof(*hs) -
sizeof(hs->
MIC));