Lines Matching refs:chap_server
130 memset(&pcb->chap_server, 0, sizeof(chap_server_state)); in chap_init()
142 pcb->chap_server.flags |= LOWERUP; in chap_lowerup()
143 if (pcb->chap_server.flags & AUTH_STARTED) in chap_lowerup()
152 if (pcb->chap_server.flags & TIMEOUT_PENDING) in chap_lowerdown()
154 pcb->chap_server.flags = 0; in chap_lowerdown()
168 if (pcb->chap_server.flags & AUTH_STARTED) { in chap_auth_peer()
179 pcb->chap_server.digest = dp; in chap_auth_peer()
180 pcb->chap_server.name = our_name; in chap_auth_peer()
182 pcb->chap_server.id = magic(); in chap_auth_peer()
183 pcb->chap_server.flags |= AUTH_STARTED; in chap_auth_peer()
184 if (pcb->chap_server.flags & LOWERUP) in chap_auth_peer()
227 pcb->chap_server.flags &= ~TIMEOUT_PENDING; in chap_timeout()
228 if ((pcb->chap_server.flags & CHALLENGE_VALID) == 0) { in chap_timeout()
229 pcb->chap_server.challenge_xmits = 0; in chap_timeout()
231 pcb->chap_server.flags |= CHALLENGE_VALID; in chap_timeout()
232 } else if (pcb->chap_server.challenge_xmits >= pcb->settings.chap_max_transmits) { in chap_timeout()
233 pcb->chap_server.flags &= ~CHALLENGE_VALID; in chap_timeout()
234 pcb->chap_server.flags |= AUTH_DONE | AUTH_FAILED; in chap_timeout()
239 p = pbuf_alloc(PBUF_RAW, (u16_t)(pcb->chap_server.challenge_pktlen), PPP_CTRL_PBUF_TYPE); in chap_timeout()
246 MEMCPY(p->payload, pcb->chap_server.challenge, pcb->chap_server.challenge_pktlen); in chap_timeout()
248 ++pcb->chap_server.challenge_xmits; in chap_timeout()
249 pcb->chap_server.flags |= TIMEOUT_PENDING; in chap_timeout()
261 p = pcb->chap_server.challenge; in chap_generate_challenge()
264 pcb->chap_server.digest->generate_challenge(pcb, p); in chap_generate_challenge()
266 nlen = strlen(pcb->chap_server.name); in chap_generate_challenge()
267 memcpy(p + 1 + clen, pcb->chap_server.name, nlen); in chap_generate_challenge()
270 pcb->chap_server.challenge_pktlen = PPP_HDRLEN + len; in chap_generate_challenge()
272 p = pcb->chap_server.challenge + PPP_HDRLEN; in chap_generate_challenge()
274 p[1] = ++pcb->chap_server.id; in chap_generate_challenge()
296 if ((pcb->chap_server.flags & LOWERUP) == 0)
298 if (id != pcb->chap_server.challenge[PPP_HDRLEN+1] || len < 2)
300 if (pcb->chap_server.flags & CHALLENGE_VALID) {
308 if (pcb->chap_server.flags & TIMEOUT_PENDING) {
309 pcb->chap_server.flags &= ~TIMEOUT_PENDING;
328 ok = (*verifier)(name, pcb->chap_server.name, id, pcb->chap_server.digest,
329 pcb->chap_server.challenge + PPP_HDRLEN + CHAP_HDRLEN,
330 response, pcb->chap_server.message, sizeof(pcb->chap_server.message));
332 ok = chap_verify_response(pcb, name, pcb->chap_server.name, id, pcb->chap_server.digest,
333 pcb->chap_server.challenge + PPP_HDRLEN + CHAP_HDRLEN,
339 pcb->chap_server.flags |= AUTH_FAILED;
342 } else if ((pcb->chap_server.flags & AUTH_DONE) == 0)
359 outp[0] = (pcb->chap_server.flags & AUTH_FAILED)? CHAP_FAILURE: CHAP_SUCCESS;
367 if (pcb->chap_server.flags & CHALLENGE_VALID) {
368 pcb->chap_server.flags &= ~CHALLENGE_VALID;
369 if (!(pcb->chap_server.flags & AUTH_DONE) && !(pcb->chap_server.flags & AUTH_FAILED)) {
383 pcb->chap_server.flags |= AUTH_FAILED;
389 if (pcb->chap_server.flags & AUTH_FAILED) {
392 if ((pcb->chap_server.flags & AUTH_DONE) == 0)
394 pcb->chap_server.digest->code,
397 pcb->chap_server.flags |= TIMEOUT_PENDING;
402 pcb->chap_server.flags |= AUTH_DONE;
569 if (pcb->chap_server.flags & TIMEOUT_PENDING) {
570 pcb->chap_server.flags &= ~TIMEOUT_PENDING;
573 if (pcb->chap_server.flags & AUTH_STARTED) {
574 pcb->chap_server.flags = 0;