[PATCH] linking wpa supplicant sm with hostapd

Leonardo Maccari maccari-thisaintpartofmyaddress- at lenst.det.unifi.it
Tue Sep 20 06:23:02 EDT 2005


since in hostapd code pmksa_cache_add is the only not static pmksa_cache*
function when I try to import wpa.c from supplicant to authenticator it
conflicts. is there a reason for it not to be static? if there is a reason
I add a few patches for changing its name in wpa_supplicant code (against
cvs version).

for the same reason, is it possible to move common wpa definitions out of
wpa.c (in both branches) and move them to something like wpa_common.c?

for example: 
#define WPA_REPLAY_COUNTER_LEN 8
#define WPA_NONCE_LEN 32
#define WPA_KEY_RSC_LEN 8

#define EAPOL_VERSION 2


struct ieee802_1x_hdr {
	u8 version;
	u8 type;
	u16 length;
	/* followed by length octets of data */
} __attribute__ ((packed));


enum { IEEE802_1X_TYPE_EAP_PACKET = 0,
       IEEE802_1X_TYPE_EAPOL_START = 1,
       IEEE802_1X_TYPE_EAPOL_LOGOFF = 2,
       IEEE802_1X_TYPE_EAPOL_KEY = 3,
       IEEE802_1X_TYPE_EAPOL_ENCAPSULATED_ASF_ALERT = 4
};

enum { EAPOL_KEY_TYPE_RC4 = 1, EAPOL_KEY_TYPE_RSN = 2,
       EAPOL_KEY_TYPE_WPA = 254 };



ciao,
leonardo.
-- 
   Key fingerprint = 3129 C583 F03B 2E73 0115  C040 3489 0185 B592 19FE
 Obviously -thisaintpartofmyaddress- is not part of my real email address 

-------------- next part --------------
--- hostap-orig/hostap/wpa_supplicant/preauth.c	2005-09-10 17:57:58.000000000 +0200
+++ hostap/wpa_supplicant/preauth.c	2005-09-20 12:00:16.374038656 +0200
@@ -147,7 +147,7 @@
 
 
 /**
- * pmksa_cache_add - Add a PMKSA cache entry
+ * pmksa_s_cache_add - Add a PMKSA cache entry
  * @sm: Pointer to WPA state machine data from wpa_sm_init()
  * @pmk: The new pairwise master key
  * @pmk_len: PMK length in bytes, usually PMK_LEN (32)
@@ -162,7 +162,7 @@
  * based on the PMK and the driver interface is notified of the new PMKID.
  */
 struct rsn_pmksa_cache *
-pmksa_cache_add(struct wpa_sm *sm, const u8 *pmk,
+pmksa_s_cache_add(struct wpa_sm *sm, const u8 *pmk,
 		size_t pmk_len, const u8 *aa, const u8 *spa,
 		struct wpa_ssid *ssid)
 {
@@ -316,7 +316,7 @@
 {
 	struct rsn_pmksa_cache *new_entry;
 
-	new_entry = pmksa_cache_add(sm, old_entry->pmk, old_entry->pmk_len,
+	new_entry = pmksa_s_cache_add(sm, old_entry->pmk, old_entry->pmk_len,
 				    aa, sm->own_addr, old_entry->ssid);
 	if (new_entry == NULL)
 		return NULL;
@@ -522,7 +522,7 @@
 			wpa_hexdump_key(MSG_DEBUG, "RSN: PMK from pre-auth",
 					pmk, pmk_len);
 			sm->pmk_len = pmk_len;
-			pmksa_cache_add(sm, pmk, pmk_len,
+			pmksa_s_cache_add(sm, pmk, pmk_len,
 					sm->preauth_bssid, sm->own_addr,
 					sm->cur_ssid);
 		} else {
-------------- next part --------------
--- hostap-orig/hostap/wpa_supplicant/preauth.h	2005-09-18 18:33:32.000000000 +0200
+++ hostap/wpa_supplicant/preauth.h	2005-09-20 11:59:41.397355920 +0200
@@ -25,7 +25,7 @@
 int pmksa_cache_list(struct wpa_sm *sm, char *buf, size_t len);
 void pmksa_candidate_free(struct wpa_sm *sm);
 struct rsn_pmksa_cache *
-pmksa_cache_add(struct wpa_sm *sm, const u8 *pmk,
+pmksa_s_cache_add(struct wpa_sm *sm, const u8 *pmk,
 		size_t pmk_len, const u8 *aa, const u8 *spa,
 		struct wpa_ssid *ssid);
 void pmksa_cache_notify_reconfig(struct wpa_sm *sm);
-------------- next part --------------
--- hostap-orig/hostap/wpa_supplicant/wpa.c	2005-09-17 23:43:57.000000000 +0200
+++ hostap/wpa_supplicant/wpa.c	2005-09-20 12:01:10.294841448 +0200
@@ -972,7 +972,7 @@
 			wpa_hexdump_key(MSG_DEBUG, "WPA: PMK from EAPOL state "
 					"machines", sm->pmk, pmk_len);
 			sm->pmk_len = pmk_len;
-			pmksa_cache_add(sm, sm->pmk, pmk_len, src_addr,
+			pmksa_s_cache_add(sm, sm->pmk, pmk_len, src_addr,
 					sm->own_addr, sm->cur_ssid);
 			if (!sm->cur_pmksa && pmkid &&
 			    pmksa_cache_get(sm, src_addr, pmkid)) {


More information about the HostAP mailing list