static void eap_sake_process(struct eap_sm *sm, void *priv, u8 *respData, size_t respDataLen) { struct eap_sake_data *data = priv; struct eap_sake_hdr *resp; u8 subtype, *pos, *end; resp = (struct eap_sake_hdr *) respData; subtype = resp->subtype; pos = (u8 *) (resp + 1); end = respData + ntohs(resp->length); wpa_hexdump(MSG_DEBUG, "EAP-SAKE: Received attributes", pos, end - pos); switch (subtype) { case EAP_SAKE_SUBTYPE_IDENTITY: eap_sake_process_identity(sm, data, respData, respDataLen, pos, end - pos); break; case EAP_SAKE_SUBTYPE_CHALLENGE: eap_sake_process_challenge(sm, data, respData, respDataLen, pos, end - pos); break; case EAP_SAKE_SUBTYPE_CONFIRM: eap_sake_process_confirm(sm, data, respData, respDataLen, pos, end - pos); break; case EAP_SAKE_SUBTYPE_AUTH_REJECT: eap_sake_process_auth_reject(sm, data, respData, respDataLen, pos, end - pos); break; } }
static void eap_sake_process(struct eap_sm *sm, void *priv, struct wpabuf *respData) { struct eap_sake_data *data = priv; struct eap_sake_hdr *resp; u8 subtype; size_t len; const u8 *pos, *end; pos = eap_hdr_validate(EAP_VENDOR_IETF, EAP_TYPE_SAKE, respData, &len); if (pos == NULL || len < sizeof(struct eap_sake_hdr)) return; resp = (struct eap_sake_hdr *) pos; end = pos + len; subtype = resp->subtype; pos = (u8 *) (resp + 1); wpa_hexdump(MSG_DEBUG, "EAP-SAKE: Received attributes", pos, end - pos); switch (subtype) { case EAP_SAKE_SUBTYPE_IDENTITY: eap_sake_process_identity(sm, data, respData, pos, end - pos); break; case EAP_SAKE_SUBTYPE_CHALLENGE: eap_sake_process_challenge(sm, data, respData, pos, end - pos); break; case EAP_SAKE_SUBTYPE_CONFIRM: eap_sake_process_confirm(sm, data, respData, pos, end - pos); break; case EAP_SAKE_SUBTYPE_AUTH_REJECT: eap_sake_process_auth_reject(sm, data, respData, pos, end - pos); break; } }
static struct wpabuf * eap_sake_process(struct eap_sm *sm, void *priv, struct eap_method_ret *ret, const struct wpabuf *reqData) { struct eap_sake_data *data = priv; const struct eap_sake_hdr *req; struct wpabuf *resp; const u8 *pos, *end; size_t len; u8 subtype, session_id, id; pos = eap_hdr_validate(EAP_VENDOR_IETF, EAP_TYPE_SAKE, reqData, &len); if (pos == NULL || len < sizeof(struct eap_sake_hdr)) { ret->ignore = TRUE; return NULL; } req = (const struct eap_sake_hdr *) pos; end = pos + len; id = eap_get_id(reqData); subtype = req->subtype; session_id = req->session_id; pos = (const u8 *) (req + 1); wpa_printf(MSG_DEBUG, "EAP-SAKE: Received frame: subtype %d " "session_id %d", subtype, session_id); wpa_hexdump(MSG_DEBUG, "EAP-SAKE: Received attributes", pos, end - pos); if (data->session_id_set && data->session_id != session_id) { wpa_printf(MSG_INFO, "EAP-SAKE: Session ID mismatch (%d,%d)", session_id, data->session_id); ret->ignore = TRUE; return NULL; } data->session_id = session_id; data->session_id_set = 1; ret->ignore = FALSE; ret->methodState = METHOD_MAY_CONT; ret->decision = DECISION_FAIL; ret->allowNotifications = TRUE; switch (subtype) { case EAP_SAKE_SUBTYPE_IDENTITY: resp = eap_sake_process_identity(sm, data, ret, id, pos, end - pos); break; case EAP_SAKE_SUBTYPE_CHALLENGE: resp = eap_sake_process_challenge(sm, data, ret, id, pos, end - pos); break; case EAP_SAKE_SUBTYPE_CONFIRM: resp = eap_sake_process_confirm(sm, data, ret, id, reqData, pos, end - pos); break; default: wpa_printf(MSG_DEBUG, "EAP-SAKE: Ignoring message with " "unknown subtype %d", subtype); ret->ignore = TRUE; return NULL; } if (ret->methodState == METHOD_DONE) ret->allowNotifications = FALSE; return resp; }