Revert "Cumulative patch from commit 4ec1fd8e42bad9390f14a58225b6e5f6fb691950"

This reverts commit 78a5dac804c22aa6e4ec8226a864d3b0d6ccddbb.

Test: None
diff --git a/src/eap_peer/eap.c b/src/eap_peer/eap.c
index 1c6116a..9110ca5 100644
--- a/src/eap_peer/eap.c
+++ b/src/eap_peer/eap.c
@@ -571,7 +571,8 @@
 
 
 #ifdef CONFIG_ERP
-struct wpabuf * eap_peer_build_erp_reauth_start(struct eap_sm *sm, u8 eap_id)
+static int eap_peer_erp_reauth_start(struct eap_sm *sm,
+				     const struct eap_hdr *hdr, size_t len)
 {
 	char *realm;
 	struct eap_erp_key *erp;
@@ -580,16 +581,16 @@
 
 	realm = eap_home_realm(sm);
 	if (!realm)
-		return NULL;
+		return -1;
 
 	erp = eap_erp_get_key(sm, realm);
 	os_free(realm);
 	realm = NULL;
 	if (!erp)
-		return NULL;
+		return -1;
 
 	if (erp->next_seq >= 65536)
-		return NULL; /* SEQ has range of 0..65535 */
+		return -1; /* SEQ has range of 0..65535 */
 
 	/* TODO: check rRK lifetime expiration */
 
@@ -598,9 +599,9 @@
 
 	msg = eap_msg_alloc(EAP_VENDOR_IETF, (EapType) EAP_ERP_TYPE_REAUTH,
 			    1 + 2 + 2 + os_strlen(erp->keyname_nai) + 1 + 16,
-			    EAP_CODE_INITIATE, eap_id);
+			    EAP_CODE_INITIATE, hdr->identifier);
 	if (msg == NULL)
-		return NULL;
+		return -1;
 
 	wpabuf_put_u8(msg, 0x20); /* Flags: R=0 B=0 L=1 */
 	wpabuf_put_be16(msg, erp->next_seq);
@@ -614,28 +615,13 @@
 	if (hmac_sha256(erp->rIK, erp->rIK_len,
 			wpabuf_head(msg), wpabuf_len(msg), hash) < 0) {
 		wpabuf_free(msg);
-		return NULL;
+		return -1;
 	}
 	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;
@@ -1580,7 +1566,7 @@
 		/* TODO: Derivation of domain specific keys for local ER */
 	}
 
-	if (eap_peer_erp_reauth_start(sm, hdr->identifier) == 0)
+	if (eap_peer_erp_reauth_start(sm, hdr, len) == 0)
 		return;
 
 invalid:
@@ -1591,7 +1577,8 @@
 }
 
 
-void eap_peer_finish(struct eap_sm *sm, const struct eap_hdr *hdr, size_t len)
+static void eap_peer_finish(struct eap_sm *sm, const struct eap_hdr *hdr,
+			    size_t len)
 {
 #ifdef CONFIG_ERP
 	const u8 *pos = (const u8 *) (hdr + 1);