|
@@ -571,7 +571,7 @@ fail:
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_ERP
|
|
|
-static int eap_peer_erp_reauth_start(struct eap_sm *sm, u8 eap_id)
|
|
|
+struct wpabuf * eap_peer_build_erp_reauth_start(struct eap_sm *sm, u8 eap_id)
|
|
|
{
|
|
|
char *realm;
|
|
|
struct eap_erp_key *erp;
|
|
@@ -580,16 +580,16 @@ static int eap_peer_erp_reauth_start(struct eap_sm *sm, u8 eap_id)
|
|
|
|
|
|
realm = eap_home_realm(sm);
|
|
|
if (!realm)
|
|
|
- return -1;
|
|
|
+ return NULL;
|
|
|
|
|
|
erp = eap_erp_get_key(sm, realm);
|
|
|
os_free(realm);
|
|
|
realm = NULL;
|
|
|
if (!erp)
|
|
|
- return -1;
|
|
|
+ return NULL;
|
|
|
|
|
|
if (erp->next_seq >= 65536)
|
|
|
- return -1; /* SEQ has range of 0..65535 */
|
|
|
+ return NULL; /* SEQ has range of 0..65535 */
|
|
|
|
|
|
/* TODO: check rRK lifetime expiration */
|
|
|
|
|
@@ -600,7 +600,7 @@ static int eap_peer_erp_reauth_start(struct eap_sm *sm, u8 eap_id)
|
|
|
1 + 2 + 2 + os_strlen(erp->keyname_nai) + 1 + 16,
|
|
|
EAP_CODE_INITIATE, eap_id);
|
|
|
if (msg == NULL)
|
|
|
- return -1;
|
|
|
+ return NULL;
|
|
|
|
|
|
wpabuf_put_u8(msg, 0x20); /* Flags: R=0 B=0 L=1 */
|
|
|
wpabuf_put_be16(msg, erp->next_seq);
|
|
@@ -614,13 +614,28 @@ static int eap_peer_erp_reauth_start(struct eap_sm *sm, u8 eap_id)
|
|
|
if (hmac_sha256(erp->rIK, erp->rIK_len,
|
|
|
wpabuf_head(msg), wpabuf_len(msg), hash) < 0) {
|
|
|
wpabuf_free(msg);
|
|
|
- return -1;
|
|
|
+ return NULL;
|
|
|
}
|
|
|
wpabuf_put_data(msg, hash, 16);
|
|
|
|
|
|
- wpa_printf(MSG_DEBUG, "EAP: Sending EAP-Initiate/Re-auth");
|
|
|
sm->erp_seq = erp->next_seq;
|
|
|
erp->next_seq++;
|
|
|
+
|
|
|
+ wpa_hexdump_buf(MSG_DEBUG, "ERP: EAP-Initiate/Re-auth", msg);
|
|
|
+
|
|
|
+ return msg;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+static int eap_peer_erp_reauth_start(struct eap_sm *sm, u8 eap_id)
|
|
|
+{
|
|
|
+ struct wpabuf *msg;
|
|
|
+
|
|
|
+ msg = eap_peer_build_erp_reauth_start(sm, eap_id);
|
|
|
+ if (!msg)
|
|
|
+ return -1;
|
|
|
+
|
|
|
+ wpa_printf(MSG_DEBUG, "EAP: Sending EAP-Initiate/Re-auth");
|
|
|
wpabuf_free(sm->eapRespData);
|
|
|
sm->eapRespData = msg;
|
|
|
sm->reauthInit = TRUE;
|