aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-11-26 18:47:24 (GMT)
committerJouni Malinen <j@w1.fi>2008-11-26 18:47:24 (GMT)
commitf855f923a735c38b0ec918f3302173bf3e8e7a7f (patch)
treeb43ddb34a95893a58abea6f24c7ab4033ec89b36 /src
parent2f4eb314547bcbeea9a4b89c0d20cf6a2fb553cc (diff)
downloadhostap-f855f923a735c38b0ec918f3302173bf3e8e7a7f.zip
hostap-f855f923a735c38b0ec918f3302173bf3e8e7a7f.tar.gz
hostap-f855f923a735c38b0ec918f3302173bf3e8e7a7f.tar.bz2
WPS: Moved UUID configuration from phase1 into global config area
Diffstat (limited to 'src')
-rw-r--r--src/eap_peer/eap.c2
-rw-r--r--src/eap_peer/eap.h6
-rw-r--r--src/eap_peer/eap_i.h1
-rw-r--r--src/eap_peer/eap_wsc.c18
-rw-r--r--src/eapol_supp/eapol_supp_sm.c1
-rw-r--r--src/eapol_supp/eapol_supp_sm.h7
-rw-r--r--src/utils/uuid.c10
-rw-r--r--src/utils/uuid.h1
8 files changed, 30 insertions, 16 deletions
diff --git a/src/eap_peer/eap.c b/src/eap_peer/eap.c
index 2627faa..7ec6d1a 100644
--- a/src/eap_peer/eap.c
+++ b/src/eap_peer/eap.c
@@ -1180,6 +1180,8 @@ struct eap_sm * eap_peer_sm_init(void *eapol_ctx,
sm->ClientTimeout = 60;
if (conf->mac_addr)
os_memcpy(sm->mac_addr, conf->mac_addr, ETH_ALEN);
+ if (conf->uuid)
+ os_memcpy(sm->uuid, conf->uuid, 16);
os_memset(&tlsconf, 0, sizeof(tlsconf));
tlsconf.opensc_engine_path = conf->opensc_engine_path;
diff --git a/src/eap_peer/eap.h b/src/eap_peer/eap.h
index cd08032..a23f88a 100644
--- a/src/eap_peer/eap.h
+++ b/src/eap_peer/eap.h
@@ -263,6 +263,12 @@ struct eap_config {
* This is only used by EAP-WSC and can be left %NULL if not available.
*/
const u8 *mac_addr;
+ /**
+ * uuid - Device UUID
+ *
+ * This is only used by EAP-WSC and can be left %NULL if not available.
+ */
+ const u8 *uuid;
};
struct eap_sm * eap_peer_sm_init(void *eapol_ctx,
diff --git a/src/eap_peer/eap_i.h b/src/eap_peer/eap_i.h
index 623701c..6f425d2 100644
--- a/src/eap_peer/eap_i.h
+++ b/src/eap_peer/eap_i.h
@@ -334,6 +334,7 @@ struct eap_sm {
int force_disabled;
u8 mac_addr[ETH_ALEN];
+ u8 uuid[16];
};
const u8 * eap_get_config_identity(struct eap_sm *sm, size_t *len);
diff --git a/src/eap_peer/eap_wsc.c b/src/eap_peer/eap_wsc.c
index e80b7c6..669f336 100644
--- a/src/eap_peer/eap_wsc.c
+++ b/src/eap_peer/eap_wsc.c
@@ -107,7 +107,6 @@ static void * eap_wsc_init(struct eap_sm *sm)
size_t identity_len;
int registrar;
struct wps_config cfg;
- u8 uuid[UUID_LEN];
const char *pos;
const char *phase1;
struct wps_context *wps = NULL;
@@ -201,23 +200,10 @@ static void * eap_wsc_init(struct eap_sm *sm)
return NULL;
}
- pos = os_strstr(phase1, "uuid=");
- if (pos == NULL) {
- wpa_printf(MSG_INFO, "EAP-WSC: UUID not set in phase1 "
- "configuration data");
- os_free(data);
- return NULL;
- }
- if (uuid_str2bin(pos + 5, uuid)) {
- wpa_printf(MSG_INFO, "EAP-WSC: Invalid UUID in phase1 "
- "configuration data");
- os_free(data);
- return NULL;
- }
if (registrar && wps)
- os_memcpy(wps->uuid, uuid, UUID_LEN);
+ os_memcpy(wps->uuid, sm->uuid, UUID_LEN);
else
- cfg.uuid = uuid;
+ cfg.uuid = sm->uuid;
cfg.wps_cred_cb = sm->eapol_cb->wps_cred;
cfg.cb_ctx = sm->eapol_ctx;
data->wps = wps_init(&cfg);
diff --git a/src/eapol_supp/eapol_supp_sm.c b/src/eapol_supp/eapol_supp_sm.c
index 9af1d6d..3ae5e15 100644
--- a/src/eapol_supp/eapol_supp_sm.c
+++ b/src/eapol_supp/eapol_supp_sm.c
@@ -1820,6 +1820,7 @@ struct eapol_sm *eapol_sm_init(struct eapol_ctx *ctx)
conf.pkcs11_module_path = ctx->pkcs11_module_path;
#endif /* EAP_TLS_OPENSSL */
conf.mac_addr = ctx->mac_addr;
+ conf.uuid = ctx->uuid;
sm->eap = eap_peer_sm_init(sm, &eapol_cb, sm->ctx->msg_ctx, &conf);
if (sm->eap == NULL) {
diff --git a/src/eapol_supp/eapol_supp_sm.h b/src/eapol_supp/eapol_supp_sm.h
index f297d23..637a1a4 100644
--- a/src/eapol_supp/eapol_supp_sm.h
+++ b/src/eapol_supp/eapol_supp_sm.h
@@ -208,6 +208,13 @@ struct eapol_ctx {
const u8 *mac_addr;
/**
+ * uuid - Device UUID
+ *
+ * This is only used by EAP-WSC and can be left %NULL if not available.
+ */
+ const u8 *uuid;
+
+ /**
* wps_cred - Notify that new credential was received from WPS
* @ctx: Callback context (ctx)
* Returns: 0 on success (credential stored), -1 on failure
diff --git a/src/utils/uuid.c b/src/utils/uuid.c
index b1fd234..d8cc267 100644
--- a/src/utils/uuid.c
+++ b/src/utils/uuid.c
@@ -65,3 +65,13 @@ int uuid_bin2str(const u8 *bin, char *str, size_t max_len)
return -1;
return 0;
}
+
+
+int is_nil_uuid(const u8 *uuid)
+{
+ int i;
+ for (i = 0; i < UUID_LEN; i++)
+ if (uuid[i])
+ return 0;
+ return 1;
+}
diff --git a/src/utils/uuid.h b/src/utils/uuid.h
index bb56bbb..0759165 100644
--- a/src/utils/uuid.h
+++ b/src/utils/uuid.h
@@ -19,5 +19,6 @@
int uuid_str2bin(const char *str, u8 *bin);
int uuid_bin2str(const u8 *bin, char *str, size_t max_len);
+int is_nil_uuid(const u8 *uuid);
#endif /* UUID_H */