Changeset View
Changeset View
Standalone View
Standalone View
sys/net/if_spppsubr.c
Show First 20 Lines • Show All 4,331 Lines • ▼ Show 20 Lines | sppp_chap_tld(struct sppp *sp) | ||||
sp->lcp.protos &= ~(1 << IDX_CHAP); | sp->lcp.protos &= ~(1 << IDX_CHAP); | ||||
lcp.Close(sp); | lcp.Close(sp); | ||||
} | } | ||||
static void | static void | ||||
sppp_chap_scr(struct sppp *sp) | sppp_chap_scr(struct sppp *sp) | ||||
{ | { | ||||
u_long *ch, seed; | u_long *ch; | ||||
u_char clen; | u_char clen; | ||||
/* Compute random challenge. */ | /* Compute random challenge. */ | ||||
ch = (u_long *)sp->myauth.challenge; | ch = (u_long *)sp->myauth.challenge; | ||||
read_random(&seed, sizeof seed); | arc4random_buf(ch, 4 * sizeof(*ch)); | ||||
ch[0] = seed ^ random(); | |||||
ch[1] = seed ^ random(); | |||||
ch[2] = seed ^ random(); | |||||
ch[3] = seed ^ random(); | |||||
clen = AUTHKEYLEN; | clen = AUTHKEYLEN; | ||||
sp->confid[IDX_CHAP] = ++sp->pp_seq[IDX_CHAP]; | sp->confid[IDX_CHAP] = ++sp->pp_seq[IDX_CHAP]; | ||||
sppp_auth_send(&chap, sp, CHAP_CHALLENGE, sp->confid[IDX_CHAP], | sppp_auth_send(&chap, sp, CHAP_CHALLENGE, sp->confid[IDX_CHAP], | ||||
sizeof clen, (const char *)&clen, | sizeof clen, (const char *)&clen, | ||||
(size_t)AUTHKEYLEN, sp->myauth.challenge, | (size_t)AUTHKEYLEN, sp->myauth.challenge, | ||||
(size_t)sppp_strnlen(sp->myauth.name, AUTHNAMELEN), | (size_t)sppp_strnlen(sp->myauth.name, AUTHNAMELEN), | ||||
▲ Show 20 Lines • Show All 1,066 Lines • Show Last 20 Lines |