• Home
  • Raw
  • Download

Lines Matching refs:pcb

98 static void eap_init(ppp_pcb *pcb);
99 static void eap_input(ppp_pcb *pcb, u_char *inp, int inlen);
100 static void eap_protrej(ppp_pcb *pcb);
101 static void eap_lowerup(ppp_pcb *pcb);
102 static void eap_lowerdown(ppp_pcb *pcb);
196 static void eap_init(ppp_pcb *pcb) { in eap_init() argument
198 BZERO(&pcb->eap, sizeof(eap_state)); in eap_init()
200 pcb->eap.es_server.ea_id = magic(); in eap_init()
209 ppp_pcb *pcb = (ppp_pcb*)arg; in eap_client_timeout() local
211 if (!eap_client_active(pcb)) in eap_client_timeout()
215 auth_withpeer_fail(pcb, PPP_EAP); in eap_client_timeout()
216 pcb->eap.es_client.ea_state = eapBadAuth; in eap_client_timeout()
225 void eap_authwithpeer(ppp_pcb *pcb, const char *localname) { in eap_authwithpeer() argument
231 pcb->eap.es_client.ea_name = localname; in eap_authwithpeer()
232 pcb->eap.es_client.ea_namelen = strlen(localname); in eap_authwithpeer()
234 pcb->eap.es_client.ea_state = eapListen; in eap_authwithpeer()
240 if (pcb->settings.eap_req_time > 0) in eap_authwithpeer()
241 TIMEOUT(eap_client_timeout, pcb, in eap_authwithpeer()
242 pcb->settings.eap_req_time); in eap_authwithpeer()
250 static void eap_send_failure(ppp_pcb *pcb) { in eap_send_failure() argument
267 pcb->eap.es_server.ea_id++; in eap_send_failure()
268 PUTCHAR(pcb->eap.es_server.ea_id, outp); in eap_send_failure()
271 ppp_write(pcb, p); in eap_send_failure()
273 pcb->eap.es_server.ea_state = eapBadAuth; in eap_send_failure()
274 auth_peer_fail(pcb, PPP_EAP); in eap_send_failure()
281 static void eap_send_success(ppp_pcb *pcb) { in eap_send_success() argument
298 pcb->eap.es_server.ea_id++; in eap_send_success()
299 PUTCHAR(pcb->eap.es_server.ea_id, outp); in eap_send_success()
302 ppp_write(pcb, p); in eap_send_success()
304 auth_peer_success(pcb, PPP_EAP, 0, in eap_send_success()
305 pcb->eap.es_server.ea_peer, pcb->eap.es_server.ea_peerlen); in eap_send_success()
425 static void eap_figure_next_state(ppp_pcb *pcb, int status) { in eap_figure_next_state() argument
437 pcb->settings.eap_timeout_time = pcb->eap.es_savedtime; in eap_figure_next_state()
438 switch (pcb->eap.es_server.ea_state) { in eap_figure_next_state()
445 ts = (struct t_server *)pcb->eap.es_server.ea_session; in eap_figure_next_state()
448 pcb->eap.es_server.ea_session = NULL; in eap_figure_next_state()
449 pcb->eap.es_server.ea_skey = NULL; in eap_figure_next_state()
453 pcb->eap.es_server.ea_state = eapBadAuth; in eap_figure_next_state()
458 if (pcb->eap.es_server.ea_peerlen > SRP_PSEUDO_LEN && in eap_figure_next_state()
459 strncmp(pcb->eap.es_server.ea_peer, SRP_PSEUDO_ID, in eap_figure_next_state()
461 (pcb->eap.es_server.ea_peerlen - SRP_PSEUDO_LEN) * 3 / 4 < in eap_figure_next_state()
465 pcb->eap.es_server.ea_peer + SRP_PSEUDO_LEN, in eap_figure_next_state()
466 pcb->eap.es_server.ea_peerlen - SRP_PSEUDO_LEN, in eap_figure_next_state()
490 pcb->eap.es_server.ea_peerlen = plen; in eap_figure_next_state()
491 dp = (unsigned char *)pcb->eap.es_server.ea_peer; in eap_figure_next_state()
503 pcb->eap.es_server.ea_peer[ in eap_figure_next_state()
504 pcb->eap.es_server.ea_peerlen] = '\0'; in eap_figure_next_state()
506 pcb->eap.es_server.ea_peerlen, in eap_figure_next_state()
507 pcb->eap.es_server.ea_peer); in eap_figure_next_state()
515 if (get_srp_secret(pcb->eap.es_unit, pcb->eap.es_server.ea_peer, in eap_figure_next_state()
516 pcb->eap.es_server.ea_name, (char *)secbuf, 1) != 0) { in eap_figure_next_state()
518 pcb->eap.es_server.ea_state = eapMD5Chall; in eap_figure_next_state()
536 if (pcb->settings.eap_timeout_time > 0 && in eap_figure_next_state()
537 pcb->settings.eap_timeout_time < 30) in eap_figure_next_state()
538 pcb->settings.eap_timeout_time = 30; in eap_figure_next_state()
545 tpw.pebuf.name = pcb->eap.es_server.ea_peer; in eap_figure_next_state()
554 pcb->eap.es_server.ea_session = (void *)ts; in eap_figure_next_state()
555 pcb->eap.es_server.ea_state = eapSRP1; in eap_figure_next_state()
556 vals[0] = pcb->eap.es_server.ea_id + 1; in eap_figure_next_state()
564 pcb->eap.es_server.ea_state = eapMD5Chall; in eap_figure_next_state()
569 ts = (struct t_server *)pcb->eap.es_server.ea_session; in eap_figure_next_state()
572 pcb->eap.es_server.ea_session = NULL; in eap_figure_next_state()
573 pcb->eap.es_server.ea_skey = NULL; in eap_figure_next_state()
577 pcb->eap.es_server.ea_state = eapMD5Chall; in eap_figure_next_state()
578 } else if (status != 0 || pcb->eap.es_server.ea_session == NULL) { in eap_figure_next_state()
579 pcb->eap.es_server.ea_state = eapBadAuth; in eap_figure_next_state()
581 pcb->eap.es_server.ea_state = eapSRP2; in eap_figure_next_state()
587 ts = (struct t_server *)pcb->eap.es_server.ea_session; in eap_figure_next_state()
590 pcb->eap.es_server.ea_session = NULL; in eap_figure_next_state()
591 pcb->eap.es_server.ea_skey = NULL; in eap_figure_next_state()
594 if (status != 0 || pcb->eap.es_server.ea_session == NULL) { in eap_figure_next_state()
595 pcb->eap.es_server.ea_state = eapBadAuth; in eap_figure_next_state()
597 pcb->eap.es_server.ea_state = eapSRP3; in eap_figure_next_state()
604 ts = (struct t_server *)pcb->eap.es_server.ea_session; in eap_figure_next_state()
607 pcb->eap.es_server.ea_session = NULL; in eap_figure_next_state()
608 pcb->eap.es_server.ea_skey = NULL; in eap_figure_next_state()
611 if (status != 0 || pcb->eap.es_server.ea_session == NULL) { in eap_figure_next_state()
612 pcb->eap.es_server.ea_state = eapBadAuth; in eap_figure_next_state()
614 pcb->eap.es_server.ea_state = eapOpen; in eap_figure_next_state()
620 pcb->eap.es_server.ea_state = eapBadAuth; in eap_figure_next_state()
622 pcb->eap.es_server.ea_state = eapOpen; in eap_figure_next_state()
627 pcb->eap.es_server.ea_state = eapBadAuth; in eap_figure_next_state()
630 if (pcb->eap.es_server.ea_state == eapBadAuth) in eap_figure_next_state()
631 eap_send_failure(pcb); in eap_figure_next_state()
638 static void eap_send_request(ppp_pcb *pcb) { in eap_send_request() argument
654 if (pcb->eap.es_server.ea_state < eapIdentify && in eap_send_request()
655 pcb->eap.es_server.ea_state != eapInitial) { in eap_send_request()
656 pcb->eap.es_server.ea_state = eapIdentify; in eap_send_request()
658 if (pcb->settings.explicit_remote && pcb->remote_name) { in eap_send_request()
664 int len = (int)strlen(pcb->remote_name); in eap_send_request()
668 MEMCPY(pcb->eap.es_server.ea_peer, pcb->remote_name, len); in eap_send_request()
669 pcb->eap.es_server.ea_peer[len] = '\0'; in eap_send_request()
670 pcb->eap.es_server.ea_peerlen = len; in eap_send_request()
671 eap_figure_next_state(pcb, 0); in eap_send_request()
676 if (pcb->settings.eap_max_transmits > 0 && in eap_send_request()
677 pcb->eap.es_server.ea_requests >= pcb->settings.eap_max_transmits) { in eap_send_request()
678 if (pcb->eap.es_server.ea_responses > 0) in eap_send_request()
682 eap_send_failure(pcb); in eap_send_request()
699 PUTCHAR(pcb->eap.es_server.ea_id, outp); in eap_send_request()
703 switch (pcb->eap.es_server.ea_state) { in eap_send_request()
718 pcb->eap.es_challen = EAP_MIN_CHALLENGE_LENGTH + in eap_send_request()
720 PUTCHAR(pcb->eap.es_challen, outp); in eap_send_request()
721 magic_random_bytes(pcb->eap.es_challenge, pcb->eap.es_challen); in eap_send_request()
722 MEMCPY(outp, pcb->eap.es_challenge, pcb->eap.es_challen); in eap_send_request()
723 INCPTR(pcb->eap.es_challen, outp); in eap_send_request()
724 MEMCPY(outp, pcb->eap.es_server.ea_name, pcb->eap.es_server.ea_namelen); in eap_send_request()
725 INCPTR(pcb->eap.es_server.ea_namelen, outp); in eap_send_request()
733 PUTCHAR(pcb->eap.es_server.ea_namelen, outp); in eap_send_request()
734 MEMCPY(outp, pcb->eap.es_server.ea_name, pcb->eap.es_server.ea_namelen); in eap_send_request()
735 INCPTR(pcb->eap.es_server.ea_namelen, outp); in eap_send_request()
737 ts = (struct t_server *)pcb->eap.es_server.ea_session; in eap_send_request()
762 ts = (struct t_server *)pcb->eap.es_server.ea_session; in eap_send_request()
772 ts = (struct t_server *)pcb->eap.es_server.ea_session; in eap_send_request()
780 cp = (unsigned char *)pcb->eap.es_server.ea_peer; in eap_send_request()
781 if ((j = i = pcb->eap.es_server.ea_peerlen) > 7) in eap_send_request()
823 SHA1Update(&ctxt, &pcb->eap.es_server.ea_id, 1); in eap_send_request()
824 SHA1Update(&ctxt, pcb->eap.es_server.ea_skey, in eap_send_request()
826 SHA1Update(&ctxt, pcb->eap.es_server.ea_peer, in eap_send_request()
827 pcb->eap.es_server.ea_peerlen); in eap_send_request()
834 SHA1Update(&ctxt, &pcb->eap.es_server.ea_id, 1); in eap_send_request()
835 SHA1Update(&ctxt, pcb->eap.es_server.ea_skey, in eap_send_request()
846 pcb->eap.es_challen = EAP_MIN_CHALLENGE_LENGTH + in eap_send_request()
848 magic_random_bytes(pcb->eap.es_challenge, pcb->eap.es_challen); in eap_send_request()
849 MEMCPY(outp, pcb->eap.es_challenge, pcb->eap.es_challen); in eap_send_request()
850 INCPTR(pcb->eap.es_challen, outp); in eap_send_request()
862 ppp_write(pcb, p); in eap_send_request()
864 pcb->eap.es_server.ea_requests++; in eap_send_request()
866 if (pcb->settings.eap_timeout_time > 0) in eap_send_request()
867 TIMEOUT(eap_server_timeout, pcb, pcb->settings.eap_timeout_time); in eap_send_request()
876 void eap_authpeer(ppp_pcb *pcb, const char *localname) { in eap_authpeer() argument
879 pcb->eap.es_server.ea_name = localname; in eap_authpeer()
880 pcb->eap.es_server.ea_namelen = strlen(localname); in eap_authpeer()
882 pcb->eap.es_savedtime = pcb->settings.eap_timeout_time; in eap_authpeer()
885 if (pcb->eap.es_server.ea_state == eapInitial || in eap_authpeer()
886 pcb->eap.es_server.ea_state == eapPending) { in eap_authpeer()
887 pcb->eap.es_server.ea_state = eapPending; in eap_authpeer()
891 pcb->eap.es_server.ea_state = eapPending; in eap_authpeer()
894 eap_send_request(pcb); in eap_authpeer()
902 ppp_pcb *pcb = (ppp_pcb*)arg; in eap_server_timeout() local
904 if (!eap_server_active(pcb)) in eap_server_timeout()
908 eap_send_request(pcb); in eap_server_timeout()
917 ppp_pcb *pcb = (ppp_pcb*)arg; in eap_rechallenge() local
919 if (pcb->eap.es_server.ea_state != eapOpen && in eap_rechallenge()
920 pcb->eap.es_server.ea_state != eapSRP4) in eap_rechallenge()
923 pcb->eap.es_server.ea_requests = 0; in eap_rechallenge()
924 pcb->eap.es_server.ea_state = eapIdentify; in eap_rechallenge()
925 eap_figure_next_state(pcb, 0); in eap_rechallenge()
926 pcb->eap.es_server.ea_id++; in eap_rechallenge()
927 eap_send_request(pcb); in eap_rechallenge()
931 ppp_pcb *pcb = (ppp_pcb*)arg; in srp_lwrechallenge() local
933 if (pcb->eap.es_server.ea_state != eapOpen || in srp_lwrechallenge()
934 pcb->eap.es_server.ea_type != EAPT_SRP) in srp_lwrechallenge()
937 pcb->eap.es_server.ea_requests = 0; in srp_lwrechallenge()
938 pcb->eap.es_server.ea_state = eapSRP4; in srp_lwrechallenge()
939 pcb->eap.es_server.ea_id++; in srp_lwrechallenge()
940 eap_send_request(pcb); in srp_lwrechallenge()
952 static void eap_lowerup(ppp_pcb *pcb) { in eap_lowerup() argument
953 pcb->eap.es_client.ea_state = eapClosed; in eap_lowerup()
955 pcb->eap.es_server.ea_state = eapClosed; in eap_lowerup()
964 static void eap_lowerdown(ppp_pcb *pcb) { in eap_lowerdown() argument
966 if (eap_client_active(pcb) && pcb->settings.eap_req_time > 0) { in eap_lowerdown()
967 UNTIMEOUT(eap_client_timeout, pcb); in eap_lowerdown()
970 if (eap_server_active(pcb)) { in eap_lowerdown()
971 if (pcb->settings.eap_timeout_time > 0) { in eap_lowerdown()
972 UNTIMEOUT(eap_server_timeout, pcb); in eap_lowerdown()
975 if ((pcb->eap.es_server.ea_state == eapOpen || in eap_lowerdown()
976 pcb->eap.es_server.ea_state == eapSRP4) && in eap_lowerdown()
977 pcb->eap.es_rechallenge > 0) { in eap_lowerdown()
978 UNTIMEOUT(eap_rechallenge, (void *)pcb); in eap_lowerdown()
980 if (pcb->eap.es_server.ea_state == eapOpen && in eap_lowerdown()
981 pcb->eap.es_lwrechallenge > 0) { in eap_lowerdown()
982 UNTIMEOUT(srp_lwrechallenge, (void *)pcb); in eap_lowerdown()
986 pcb->eap.es_client.ea_state = pcb->eap.es_server.ea_state = eapInitial; in eap_lowerdown()
987 pcb->eap.es_client.ea_requests = pcb->eap.es_server.ea_requests = 0; in eap_lowerdown()
997 static void eap_protrej(ppp_pcb *pcb) { in eap_protrej() argument
999 if (eap_client_active(pcb)) { in eap_protrej()
1001 auth_withpeer_fail(pcb, PPP_EAP); in eap_protrej()
1004 if (eap_server_active(pcb)) { in eap_protrej()
1006 auth_peer_fail(pcb, PPP_EAP); in eap_protrej()
1009 eap_lowerdown(pcb); in eap_protrej()
1015 static void eap_send_response(ppp_pcb *pcb, u_char id, u_char typenum, const u_char *str, int lenst… in eap_send_response() argument
1035 pcb->eap.es_client.ea_id = id; in eap_send_response()
1042 ppp_write(pcb, p); in eap_send_response()
1048 static void eap_chap_response(ppp_pcb *pcb, u_char id, u_char *hash, const char *name, int namelen)… in eap_chap_response() argument
1069 pcb->eap.es_client.ea_id = id; in eap_chap_response()
1079 ppp_write(pcb, p); in eap_chap_response()
1094 ppp_pcb *pcb = &ppp_pcb_list[pcb->eap.es_unit]; local
1114 pcb->eap.es_client.ea_id = id;
1122 ppp_write(pcb, p);
1135 ppp_pcb *pcb = &ppp_pcb_list[pcb->eap.es_unit]; local
1156 pcb->eap.es_client.ea_id = id;
1163 ppp_write(pcb, p);
1167 static void eap_send_nak(ppp_pcb *pcb, u_char id, u_char type) { in eap_send_nak() argument
1187 pcb->eap.es_client.ea_id = id; in eap_send_nak()
1192 ppp_write(pcb, p); in eap_send_nak()
1273 SHA1Update(&ctxt, pcb->eap.es_client.ea_skey, SESSION_KEY_LEN);
1277 SHA1Update(&ctxt, pcb->eap.es_client.ea_name,
1278 pcb->eap.es_client.ea_namelen);
1300 pcb->eap.es_usedpseudo = 0;
1311 static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { in eap_request() argument
1334 pcb->eap.es_client.ea_requests++; in eap_request()
1335 if (pcb->settings.eap_allow_req != 0 && in eap_request()
1336 pcb->eap.es_client.ea_requests > pcb->settings.eap_allow_req) { in eap_request()
1338 if (pcb->settings.eap_req_time > 0) { in eap_request()
1339 UNTIMEOUT(eap_client_timeout, pcb); in eap_request()
1341 auth_withpeer_fail(pcb, PPP_EAP); in eap_request()
1358 if (pcb->eap.es_usepseudo && in eap_request()
1359 (pcb->eap.es_usedpseudo == 0 || in eap_request()
1360 (pcb->eap.es_usedpseudo == 1 && in eap_request()
1361 id == pcb->eap.es_client.ea_id))) { in eap_request()
1362 pcb->eap.es_usedpseudo = 1; in eap_request()
1370 eap_send_response(pcb, id, typenum, in eap_request()
1379 if (pcb->eap.es_usepseudo && pcb->eap.es_usedpseudo != 2) { in eap_request()
1381 pcb->eap.es_usedpseudo = 2; in eap_request()
1384 eap_send_response(pcb, id, typenum, (const u_char*)pcb->eap.es_client.ea_name, in eap_request()
1385 pcb->eap.es_client.ea_namelen); in eap_request()
1391 eap_send_response(pcb, id, typenum, NULL, 0); in eap_request()
1415 eap_send_nak(pcb, id, EAPT_SRP); in eap_request()
1431 if (pcb->settings.explicit_remote || in eap_request()
1432 (pcb->settings.remote_name[0] != '\0' && vallen == len)) in eap_request()
1433 strlcpy(rhostname, pcb->settings.remote_name, sizeof (rhostname)); in eap_request()
1440 if (!get_secret(pcb, pcb->eap.es_client.ea_name, in eap_request()
1443 eap_send_nak(pcb, id, EAPT_SRP); in eap_request()
1455 eap_chap_response(pcb, id, hash, pcb->eap.es_client.ea_name, in eap_request()
1456 pcb->eap.es_client.ea_namelen); in eap_request()
1473 if (pcb->eap.es_client.ea_session != NULL) { in eap_request()
1474 tc = (struct t_client *)pcb->eap.es_client. in eap_request()
1481 if (id != pcb->eap.es_client.ea_id) { in eap_request()
1483 pcb->eap.es_client.ea_session = NULL; in eap_request()
1488 pcb->eap.es_client.ea_skey = NULL; in eap_request()
1519 MEMCPY(pcb->eap.es_client.ea_peer, rhostname, rhostnamelen); in eap_request()
1520 pcb->eap.es_client.ea_peer[rhostnamelen] = '\0'; in eap_request()
1521 pcb->eap.es_client.ea_peerlen = rhostnamelen; in eap_request()
1566 tc = t_clientopen(pcb->eap.es_client.ea_name, in eap_request()
1569 eap_send_nak(pcb, id, EAPT_MD5CHAP); in eap_request()
1572 pcb->eap.es_client.ea_session = (void *)tc; in eap_request()
1585 tc = (struct t_client *)pcb->eap.es_client.ea_session; in eap_request()
1588 eap_send_nak(pcb, id, EAPT_MD5CHAP); in eap_request()
1591 if (pcb->eap.es_client.ea_skey != NULL) { in eap_request()
1596 if (id != pcb->eap.es_client.ea_id) { in eap_request()
1599 pcb->eap.es_client.ea_id, id); in eap_request()
1602 if (get_srp_secret(pcb->eap.es_unit, in eap_request()
1603 pcb->eap.es_client.ea_name, in eap_request()
1604 pcb->eap.es_client.ea_peer, secret, 0) == 0) { in eap_request()
1610 eap_send_nak(pcb, id, EAPT_MD5CHAP); in eap_request()
1617 pcb->eap.es_client.ea_skey = in eap_request()
1619 if (pcb->eap.es_client.ea_skey == NULL) { in eap_request()
1630 tc = (struct t_client *)pcb->eap.es_client.ea_session; in eap_request()
1631 if (tc == NULL || pcb->eap.es_client.ea_skey == NULL) { in eap_request()
1633 eap_send_nak(pcb, id, EAPT_MD5CHAP); in eap_request()
1641 if (pcb->eap.es_client.ea_state == eapOpen) { in eap_request()
1642 if (id != pcb->eap.es_client.ea_id) { in eap_request()
1645 pcb->eap.es_client.ea_id, id); in eap_request()
1655 GETLONG(pcb->eap.es_client.ea_keyflags, inp); in eap_request()
1657 if (len > 0 && pcb->eap.es_usepseudo) { in eap_request()
1678 SHA1Update(&ctxt, pcb->eap.es_client.ea_skey, in eap_request()
1681 SHA1Update(&ctxt, pcb->eap.es_client.ea_name, in eap_request()
1682 pcb->eap.es_client.ea_namelen); in eap_request()
1690 eap_send_nak(pcb, id, EAPT_MD5CHAP); in eap_request()
1698 eap_send_nak(pcb, id, EAPT_SRP); in eap_request()
1702 if (pcb->settings.eap_req_time > 0) { in eap_request()
1703 UNTIMEOUT(eap_client_timeout, pcb); in eap_request()
1704 TIMEOUT(eap_client_timeout, pcb, in eap_request()
1705 pcb->settings.eap_req_time); in eap_request()
1711 pcb->eap.es_client.ea_state = eapBadAuth; in eap_request()
1712 if (pcb->settings.eap_req_time > 0) { in eap_request()
1715 pcb->eap.es_client.ea_session = NULL; in eap_request()
1717 auth_withpeer_fail(pcb, PPP_EAP); in eap_request()
1725 static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { in eap_response() argument
1740 if (pcb->eap.es_server.ea_id != id) { in eap_response()
1742 pcb->eap.es_server.ea_id); in eap_response()
1746 pcb->eap.es_server.ea_responses++; in eap_response()
1758 if (pcb->eap.es_server.ea_state != eapIdentify) { in eap_response()
1767 MEMCPY(pcb->eap.es_server.ea_peer, inp, len); in eap_response()
1768 pcb->eap.es_server.ea_peer[len] = '\0'; in eap_response()
1769 pcb->eap.es_server.ea_peerlen = len; in eap_response()
1770 eap_figure_next_state(pcb, 0); in eap_response()
1780 eap_figure_next_state(pcb, 1); in eap_response()
1789 !pcb->explicit_remote && in eap_response()
1791 pcb->eap.es_server.ea_state == eapIdentify){ in eap_response()
1793 eap_figure_next_state(pcb, 1); in eap_response()
1800 pcb->eap.es_server.ea_state = eapIdentify; in eap_response()
1801 eap_figure_next_state(pcb, 0); in eap_response()
1805 pcb->eap.es_server.ea_state = eapMD5Chall; in eap_response()
1810 switch (pcb->eap.es_server.ea_state) { in eap_response()
1814 pcb->eap.es_server.ea_state = eapMD5Chall; in eap_response()
1818 pcb->eap.es_server.ea_state = eapIdentify; in eap_response()
1819 eap_figure_next_state(pcb, 0); in eap_response()
1829 if (pcb->eap.es_server.ea_state != eapMD5Chall) { in eap_response()
1831 eap_figure_next_state(pcb, 1); in eap_response()
1836 eap_figure_next_state(pcb, 1); in eap_response()
1843 eap_figure_next_state(pcb, 1); in eap_response()
1868 if (!get_secret(pcb, rhostname, in eap_response()
1869 pcb->eap.es_server.ea_name, secret, &secret_len, 1)) { in eap_response()
1871 eap_send_failure(pcb); in eap_response()
1876 lwip_md5_update(&mdContext, &pcb->eap.es_server.ea_id, 1); in eap_response()
1879 lwip_md5_update(&mdContext, pcb->eap.es_challenge, pcb->eap.es_challen); in eap_response()
1883 eap_send_failure(pcb); in eap_response()
1886 pcb->eap.es_server.ea_type = EAPT_MD5CHAP; in eap_response()
1887 eap_send_success(pcb); in eap_response()
1888 eap_figure_next_state(pcb, 0); in eap_response()
1889 if (pcb->eap.es_rechallenge != 0) in eap_response()
1890 TIMEOUT(eap_rechallenge, pcb, pcb->eap.es_rechallenge); in eap_response()
1897 eap_figure_next_state(pcb, 1); in eap_response()
1904 if (pcb->eap.es_server.ea_state != eapSRP1) { in eap_response()
1906 eap_figure_next_state(pcb, 1); in eap_response()
1911 ts = (struct t_server *)pcb->eap.es_server.ea_session; in eap_response()
1913 pcb->eap.es_server.ea_skey = t_servergetkey(ts, &A); in eap_response()
1914 if (pcb->eap.es_server.ea_skey == NULL) { in eap_response()
1917 eap_send_failure(pcb); in eap_response()
1919 eap_figure_next_state(pcb, 0); in eap_response()
1924 if (pcb->eap.es_server.ea_state != eapSRP2) { in eap_response()
1926 eap_figure_next_state(pcb, 1); in eap_response()
1932 eap_figure_next_state(pcb, 1); in eap_response()
1935 GETLONG(pcb->eap.es_server.ea_keyflags, inp); in eap_response()
1936 ts = (struct t_server *)pcb->eap.es_server.ea_session; in eap_response()
1940 eap_send_failure(pcb); in eap_response()
1943 eap_figure_next_state(pcb, 0); in eap_response()
1947 if (pcb->eap.es_server.ea_state != eapSRP3) { in eap_response()
1952 pcb->eap.es_server.ea_type = EAPT_SRP; in eap_response()
1953 eap_send_success(pcb, esp); in eap_response()
1954 eap_figure_next_state(pcb, 0); in eap_response()
1955 if (pcb->eap.es_rechallenge != 0) in eap_response()
1956 TIMEOUT(eap_rechallenge, pcb, in eap_response()
1957 pcb->eap.es_rechallenge); in eap_response()
1958 if (pcb->eap.es_lwrechallenge != 0) in eap_response()
1959 TIMEOUT(srp_lwrechallenge, pcb, in eap_response()
1960 pcb->eap.es_lwrechallenge); in eap_response()
1964 if (pcb->eap.es_server.ea_state != eapSRP4) { in eap_response()
1976 SHA1Update(&ctxt, pcb->eap.es_server.ea_skey, in eap_response()
1978 SHA1Update(&ctxt, pcb->eap.es_challenge, pcb->eap.es_challen); in eap_response()
1979 SHA1Update(&ctxt, pcb->eap.es_server.ea_peer, in eap_response()
1980 pcb->eap.es_server.ea_peerlen); in eap_response()
1984 eap_send_failure(pcb); in eap_response()
1987 pcb->eap.es_server.ea_state = eapOpen; in eap_response()
1988 if (pcb->eap.es_lwrechallenge != 0) in eap_response()
1990 pcb->eap.es_lwrechallenge); in eap_response()
2002 if (pcb->settings.eap_timeout_time > 0) { in eap_response()
2003 UNTIMEOUT(eap_server_timeout, pcb); in eap_response()
2006 if (pcb->eap.es_server.ea_state != eapBadAuth && in eap_response()
2007 pcb->eap.es_server.ea_state != eapOpen) { in eap_response()
2008 pcb->eap.es_server.ea_id++; in eap_response()
2009 eap_send_request(pcb); in eap_response()
2017 static void eap_success(ppp_pcb *pcb, u_char *inp, int id, int len) { in eap_success() argument
2020 if (pcb->eap.es_client.ea_state != eapOpen && !eap_client_active(pcb)) { in eap_success()
2022 eap_state_name(pcb->eap.es_client.ea_state), in eap_success()
2023 pcb->eap.es_client.ea_state); in eap_success()
2027 if (pcb->settings.eap_req_time > 0) { in eap_success()
2028 UNTIMEOUT(eap_client_timeout, pcb); in eap_success()
2036 pcb->eap.es_client.ea_state = eapOpen; in eap_success()
2037 auth_withpeer_success(pcb, PPP_EAP, 0); in eap_success()
2043 static void eap_failure(ppp_pcb *pcb, u_char *inp, int id, int len) { in eap_failure() argument
2046 if (!eap_client_active(pcb)) { in eap_failure()
2048 eap_state_name(pcb->eap.es_client.ea_state), in eap_failure()
2049 pcb->eap.es_client.ea_state); in eap_failure()
2052 if (pcb->settings.eap_req_time > 0) { in eap_failure()
2053 UNTIMEOUT(eap_client_timeout, pcb); in eap_failure()
2061 pcb->eap.es_client.ea_state = eapBadAuth; in eap_failure()
2064 auth_withpeer_fail(pcb, PPP_EAP); in eap_failure()
2070 static void eap_input(ppp_pcb *pcb, u_char *inp, int inlen) { in eap_input() argument
2095 eap_request(pcb, inp, id, len); in eap_input()
2100 eap_response(pcb, inp, id, len); in eap_input()
2105 eap_success(pcb, inp, id, len); in eap_input()
2109 eap_failure(pcb, inp, id, len); in eap_input()