peerkey.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * WPA Supplicant - PeerKey for Direct Link Setup (DLS)
  3. * Copyright (c) 2006-2008, Jouni Malinen <j@w1.fi>
  4. *
  5. * This software may be distributed under the terms of the BSD license.
  6. * See README for more details.
  7. */
  8. #ifndef PEERKEY_H
  9. #define PEERKEY_H
  10. #define PEERKEY_MAX_IE_LEN 80
  11. struct wpa_peerkey {
  12. struct wpa_peerkey *next;
  13. int initiator; /* whether this end was initator for SMK handshake */
  14. u8 addr[ETH_ALEN]; /* other end MAC address */
  15. u8 inonce[WPA_NONCE_LEN]; /* Initiator Nonce */
  16. u8 pnonce[WPA_NONCE_LEN]; /* Peer Nonce */
  17. u8 rsnie_i[PEERKEY_MAX_IE_LEN]; /* Initiator RSN IE */
  18. size_t rsnie_i_len;
  19. u8 rsnie_p[PEERKEY_MAX_IE_LEN]; /* Peer RSN IE */
  20. size_t rsnie_p_len;
  21. u8 smk[PMK_LEN];
  22. int smk_complete;
  23. u8 smkid[PMKID_LEN];
  24. u32 lifetime;
  25. os_time_t expiration;
  26. int cipher; /* Selected cipher (WPA_CIPHER_*) */
  27. u8 replay_counter[WPA_REPLAY_COUNTER_LEN];
  28. int replay_counter_set;
  29. int use_sha256; /* whether AKMP indicate SHA256-based derivations */
  30. struct wpa_ptk stk, tstk;
  31. int stk_set, tstk_set;
  32. };
  33. #ifdef CONFIG_PEERKEY
  34. int peerkey_verify_eapol_key_mic(struct wpa_sm *sm,
  35. struct wpa_peerkey *peerkey,
  36. struct wpa_eapol_key *key, u16 ver,
  37. const u8 *buf, size_t len);
  38. void peerkey_rx_eapol_4way(struct wpa_sm *sm, struct wpa_peerkey *peerkey,
  39. struct wpa_eapol_key *key, u16 key_info, u16 ver);
  40. void peerkey_rx_eapol_smk(struct wpa_sm *sm, const u8 *src_addr,
  41. struct wpa_eapol_key *key, size_t extra_len,
  42. u16 key_info, u16 ver);
  43. void peerkey_deinit(struct wpa_sm *sm);
  44. #else /* CONFIG_PEERKEY */
  45. static inline int
  46. peerkey_verify_eapol_key_mic(struct wpa_sm *sm,
  47. struct wpa_peerkey *peerkey,
  48. struct wpa_eapol_key *key, u16 ver,
  49. const u8 *buf, size_t len)
  50. {
  51. return -1;
  52. }
  53. static inline void
  54. peerkey_rx_eapol_4way(struct wpa_sm *sm, struct wpa_peerkey *peerkey,
  55. struct wpa_eapol_key *key, u16 key_info, u16 ver)
  56. {
  57. }
  58. static inline void
  59. peerkey_rx_eapol_smk(struct wpa_sm *sm, const u8 *src_addr,
  60. struct wpa_eapol_key *key, size_t extra_len,
  61. u16 key_info, u16 ver)
  62. {
  63. }
  64. static inline void peerkey_deinit(struct wpa_sm *sm)
  65. {
  66. }
  67. #endif /* CONFIG_PEERKEY */
  68. #endif /* PEERKEY_H */