78#if PPP_SUPPORT && MSCHAP_SUPPORT
100#define SHA1_SIGNATURE_SIZE 20
101#define MD4_SIGNATURE_SIZE 16
102#define MAX_NT_PASSWORD 256
104#define MS_CHAP_RESPONSE_LEN 49
105#define MS_CHAP2_RESPONSE_LEN 49
106#define MS_AUTH_RESPONSE_LENGTH 40
110#define MS_CHAP_ERROR_RESTRICTED_LOGON_HOURS 646
111#define MS_CHAP_ERROR_ACCT_DISABLED 647
112#define MS_CHAP_ERROR_PASSWD_EXPIRED 648
113#define MS_CHAP_ERROR_NO_DIALIN_PERMISSION 649
114#define MS_CHAP_ERROR_AUTHENTICATION_FAILURE 691
115#define MS_CHAP_ERROR_CHANGING_PASSWORD 709
120#define MS_CHAP_LANMANRESP 0
121#define MS_CHAP_LANMANRESP_LEN 24
122#define MS_CHAP_NTRESP 24
123#define MS_CHAP_NTRESP_LEN 24
124#define MS_CHAP_USENT 48
129#define MS_CHAP2_PEER_CHALLENGE 0
130#define MS_CHAP2_PEER_CHAL_LEN 16
131#define MS_CHAP2_RESERVED_LEN 8
132#define MS_CHAP2_NTRESP 24
133#define MS_CHAP2_NTRESP_LEN 24
134#define MS_CHAP2_FLAGS 48
139#define MPPE_ENC_POL_ENC_ALLOWED 1
140#define MPPE_ENC_POL_ENC_REQUIRED 2
141#define MPPE_ENC_TYPES_RC4_40 2
142#define MPPE_ENC_TYPES_RC4_128 4
145extern void set_mppe_enc_types(
int,
int);
150#define MS_CHAP2_AUTHENTICATEE 0
151#define MS_CHAP2_AUTHENTICATOR 1
153static void ascii2unicode (
const char[],
int,
u_char[]);
154static void NTPasswordHash (
u_char *,
int,
u_char[MD4_SIGNATURE_SIZE]);
157static void ChapMS_NT (
const u_char *,
const char *,
int,
u_char[24]);
158static void ChapMS2_NT (
const u_char *,
const u_char[16],
const char *,
const char *,
int,
160static void GenerateAuthenticatorResponsePlain
162 const char *,
u_char[41]);
164static void ChapMS_LANMan (
u_char *,
char *,
int,
u_char *);
167static void GenerateAuthenticatorResponse(
const u_char PasswordHashHash[MD4_SIGNATURE_SIZE],
170 u_char authResponse[MS_AUTH_RESPONSE_LENGTH+1]);
173static void Set_Start_Key (ppp_pcb *pcb,
const u_char *,
const char *,
int);
174static void SetMasterKeys (ppp_pcb *pcb,
const char *,
int,
u_char[24],
int);
177static void ChapMS (ppp_pcb *pcb,
const u_char *,
const char *,
int,
u_char *);
178static void ChapMS2 (ppp_pcb *pcb,
const u_char *,
const u_char *,
const char *,
const char *,
int,
190static char *mschap_challenge =
NULL;
192static char *mschap2_peer_challenge =
NULL;
203static option_t chapms_option_list[] = {
205 {
"ms-lanman", o_bool, &ms_lanman,
206 "Use LanMan passwd when using MS-CHAP", 1 },
209 {
"mschap-challenge", o_string, &mschap_challenge,
210 "specify CHAP challenge" },
211 {
"mschap2-peer-challenge", o_string, &mschap2_peer_challenge,
212 "specify CHAP peer challenge" },
225static void chapms_generate_challenge(ppp_pcb *pcb,
unsigned char *challenge) {
230 if (mschap_challenge &&
strlen(mschap_challenge) == 8)
231 memcpy(challenge, mschap_challenge, 8);
234 magic_random_bytes(challenge, 8);
237static void chapms2_generate_challenge(ppp_pcb *pcb,
unsigned char *challenge) {
242 if (mschap_challenge &&
strlen(mschap_challenge) == 16)
243 memcpy(challenge, mschap_challenge, 16);
246 magic_random_bytes(challenge, 16);
249static int chapms_verify_response(ppp_pcb *pcb,
int id,
const char *
name,
250 const unsigned char *
secret,
int secret_len,
251 const unsigned char *challenge,
const unsigned char *response,
252 char *
message,
int message_space) {
253 unsigned char md[MS_CHAP_RESPONSE_LEN];
255 int challenge_len, response_len;
259 challenge_len = *challenge++;
260 response_len = *response++;
261 if (response_len != MS_CHAP_RESPONSE_LEN)
265 if (!response[MS_CHAP_USENT]) {
267 ppp_notice((
"Peer request for LANMAN auth not supported"));
273 ChapMS(pcb, (
const u_char *)challenge, (
const char *)
secret, secret_len,
md);
277 if (!response[MS_CHAP_USENT])
278 diff =
memcmp(&response[MS_CHAP_LANMANRESP],
279 &
md[MS_CHAP_LANMANRESP], MS_CHAP_LANMANRESP_LEN);
282 diff =
memcmp(&response[MS_CHAP_NTRESP], &
md[MS_CHAP_NTRESP],
286 ppp_slprintf(
message, message_space,
"Access granted");
292 ppp_slprintf(
message, message_space,
"E=691 R=1 C=%0.*B V=0",
293 challenge_len, challenge);
297static int chapms2_verify_response(ppp_pcb *pcb,
int id,
const char *
name,
298 const unsigned char *
secret,
int secret_len,
299 const unsigned char *challenge,
const unsigned char *response,
300 char *
message,
int message_space) {
301 unsigned char md[MS_CHAP2_RESPONSE_LEN];
302 char saresponse[MS_AUTH_RESPONSE_LENGTH+1];
303 int challenge_len, response_len;
306 challenge_len = *challenge++;
307 response_len = *response++;
308 if (response_len != MS_CHAP2_RESPONSE_LEN)
312 ChapMS2(pcb, (
const u_char*)challenge, (
const u_char*)&response[MS_CHAP2_PEER_CHALLENGE],
name,
313 (
const char *)
secret, secret_len,
md,
314 (
unsigned char *)saresponse, MS_CHAP2_AUTHENTICATOR);
336 if (
memcmp(&
md[MS_CHAP2_NTRESP], &response[MS_CHAP2_NTRESP],
337 MS_CHAP2_NTRESP_LEN) == 0) {
338 if (response[MS_CHAP2_FLAGS])
339 ppp_slprintf(
message, message_space,
"S=%s", saresponse);
341 ppp_slprintf(
message, message_space,
"S=%s M=%s",
342 saresponse,
"Access granted");
368 ppp_slprintf(
message, message_space,
"E=691 R=1 C=%0.*B V=0 M=%s",
369 challenge_len, challenge,
"Access denied");
374static void chapms_make_response(ppp_pcb *pcb,
unsigned char *response,
int id,
const char *our_name,
375 const unsigned char *challenge,
const char *
secret,
int secret_len,
376 unsigned char *private_) {
381 *response++ = MS_CHAP_RESPONSE_LEN;
382 ChapMS(pcb, challenge,
secret, secret_len, response);
385static void chapms2_make_response(ppp_pcb *pcb,
unsigned char *response,
int id,
const char *our_name,
386 const unsigned char *challenge,
const char *
secret,
int secret_len,
387 unsigned char *private_) {
390 *response++ = MS_CHAP2_RESPONSE_LEN;
391 ChapMS2(pcb, challenge,
393 mschap2_peer_challenge,
397 our_name,
secret, secret_len, response, private_,
398 MS_CHAP2_AUTHENTICATEE);
401static int chapms2_check_success(ppp_pcb *pcb,
unsigned char *
msg,
int len,
unsigned char *private_) {
404 if ((
len < MS_AUTH_RESPONSE_LENGTH + 2) ||
407 ppp_error((
"MS-CHAPv2 Success packet is badly formed."));
412 if (
len < MS_AUTH_RESPONSE_LENGTH
413 ||
memcmp(
msg, private_, MS_AUTH_RESPONSE_LENGTH)) {
415 ppp_error((
"MS-CHAPv2 mutual authentication failed."));
419 msg += MS_AUTH_RESPONSE_LENGTH;
420 len -= MS_AUTH_RESPONSE_LENGTH;
425 ppp_error((
"MS-CHAPv2 Success packet is badly formed."));
431static void chapms_handle_failure(ppp_pcb *pcb,
unsigned char *inp,
int len) {
460 case MS_CHAP_ERROR_RESTRICTED_LOGON_HOURS:
461 p =
"E=646 Restricted logon hours";
464 case MS_CHAP_ERROR_ACCT_DISABLED:
465 p =
"E=647 Account disabled";
468 case MS_CHAP_ERROR_PASSWD_EXPIRED:
469 p =
"E=648 Password expired";
472 case MS_CHAP_ERROR_NO_DIALIN_PERMISSION:
473 p =
"E=649 No dialin permission";
476 case MS_CHAP_ERROR_AUTHENTICATION_FAILURE:
477 p =
"E=691 Authentication failure";
480 case MS_CHAP_ERROR_CHANGING_PASSWORD:
482 p =
"E=709 Error changing password";
486 ppp_error((
"Unknown MS-CHAP authentication failure: %.*v",
493 ppp_error((
"MS-CHAP authentication failed: %v",
p));
496static void ChallengeResponse(
const u_char *challenge,
497 const u_char PasswordHash[MD4_SIGNATURE_SIZE],
500 lwip_des_context
des;
503 BZERO(ZPasswordHash,
sizeof(ZPasswordHash));
504 MEMCPY(ZPasswordHash, PasswordHash, MD4_SIGNATURE_SIZE);
507 dbglog(
"ChallengeResponse - ZPasswordHash %.*B",
508 sizeof(ZPasswordHash), ZPasswordHash);
511 pppcrypt_56_to_64_bit_key(ZPasswordHash + 0,
des_key);
514 lwip_des_crypt_ecb(&
des, challenge, response +0);
517 pppcrypt_56_to_64_bit_key(ZPasswordHash + 7,
des_key);
520 lwip_des_crypt_ecb(&
des, challenge, response +8);
523 pppcrypt_56_to_64_bit_key(ZPasswordHash + 14,
des_key);
526 lwip_des_crypt_ecb(&
des, challenge, response +16);
530 dbglog(
"ChallengeResponse - response %.24B", response);
534static void ChallengeHash(
const u_char PeerChallenge[16],
const u_char *rchallenge,
536 lwip_sha1_context sha1Context;
537 u_char sha1Hash[SHA1_SIGNATURE_SIZE];
546 lwip_sha1_init(&sha1Context);
547 lwip_sha1_starts(&sha1Context);
548 lwip_sha1_update(&sha1Context, PeerChallenge, 16);
549 lwip_sha1_update(&sha1Context, rchallenge, 16);
550 lwip_sha1_update(&sha1Context, (
const unsigned char*)
user,
strlen(
user));
551 lwip_sha1_finish(&sha1Context, sha1Hash);
552 lwip_sha1_free(&sha1Context);
554 MEMCPY(Challenge, sha1Hash, 8);
564static void ascii2unicode(
const char ascii[],
int ascii_len,
u_char unicode[]) {
567 BZERO(unicode, ascii_len * 2);
568 for (
i = 0;
i < ascii_len;
i++)
573 lwip_md4_context md4Context;
575 lwip_md4_init(&md4Context);
576 lwip_md4_starts(&md4Context);
577 lwip_md4_update(&md4Context,
secret, secret_len);
578 lwip_md4_finish(&md4Context,
hash);
579 lwip_md4_free(&md4Context);
582static void ChapMS_NT(
const u_char *rchallenge,
const char *
secret,
int secret_len,
584 u_char unicodePassword[MAX_NT_PASSWORD * 2];
585 u_char PasswordHash[MD4_SIGNATURE_SIZE];
588 ascii2unicode(
secret, secret_len, unicodePassword);
589 NTPasswordHash(unicodePassword, secret_len * 2, PasswordHash);
591 ChallengeResponse(rchallenge, PasswordHash, NTResponse);
594static void ChapMS2_NT(
const u_char *rchallenge,
const u_char PeerChallenge[16],
const char *
username,
595 const char *
secret,
int secret_len,
u_char NTResponse[24]) {
596 u_char unicodePassword[MAX_NT_PASSWORD * 2];
597 u_char PasswordHash[MD4_SIGNATURE_SIZE];
600 ChallengeHash(PeerChallenge, rchallenge,
username, Challenge);
603 ascii2unicode(
secret, secret_len, unicodePassword);
604 NTPasswordHash(unicodePassword, secret_len * 2, PasswordHash);
606 ChallengeResponse(Challenge, PasswordHash, NTResponse);
612static void ChapMS_LANMan(
u_char *rchallenge,
char *
secret,
int secret_len,
613 unsigned char *response) {
615 u_char UcasePassword[MAX_NT_PASSWORD];
616 u_char PasswordHash[MD4_SIGNATURE_SIZE];
617 lwip_des_context
des;
621 BZERO(UcasePassword,
sizeof(UcasePassword));
622 for (
i = 0;
i < secret_len;
i++)
625 pppcrypt_56_to_64_bit_key(UcasePassword +0,
des_key);
628 lwip_des_crypt_ecb(&
des, StdText, PasswordHash +0);
631 pppcrypt_56_to_64_bit_key(UcasePassword +7,
des_key);
634 lwip_des_crypt_ecb(&
des, StdText, PasswordHash +8);
637 ChallengeResponse(rchallenge, PasswordHash, &response[MS_CHAP_LANMANRESP]);
642static void GenerateAuthenticatorResponse(
const u_char PasswordHashHash[MD4_SIGNATURE_SIZE],
645 u_char authResponse[MS_AUTH_RESPONSE_LENGTH+1]) {
649 static const u_char Magic1[39] =
650 { 0x4D, 0x61, 0x67, 0x69, 0x63, 0x20, 0x73, 0x65, 0x72, 0x76,
651 0x65, 0x72, 0x20, 0x74, 0x6F, 0x20, 0x63, 0x6C, 0x69, 0x65,
652 0x6E, 0x74, 0x20, 0x73, 0x69, 0x67, 0x6E, 0x69, 0x6E, 0x67,
653 0x20, 0x63, 0x6F, 0x6E, 0x73, 0x74, 0x61, 0x6E, 0x74 };
654 static const u_char Magic2[41] =
655 { 0x50, 0x61, 0x64, 0x20, 0x74, 0x6F, 0x20, 0x6D, 0x61, 0x6B,
656 0x65, 0x20, 0x69, 0x74, 0x20, 0x64, 0x6F, 0x20, 0x6D, 0x6F,
657 0x72, 0x65, 0x20, 0x74, 0x68, 0x61, 0x6E, 0x20, 0x6F, 0x6E,
658 0x65, 0x20, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6F,
662 lwip_sha1_context sha1Context;
663 u_char Digest[SHA1_SIGNATURE_SIZE];
666 lwip_sha1_init(&sha1Context);
667 lwip_sha1_starts(&sha1Context);
668 lwip_sha1_update(&sha1Context, PasswordHashHash, MD4_SIGNATURE_SIZE);
669 lwip_sha1_update(&sha1Context, NTResponse, 24);
670 lwip_sha1_update(&sha1Context, Magic1,
sizeof(Magic1));
671 lwip_sha1_finish(&sha1Context, Digest);
672 lwip_sha1_free(&sha1Context);
674 ChallengeHash(PeerChallenge, rchallenge,
username, Challenge);
676 lwip_sha1_init(&sha1Context);
677 lwip_sha1_starts(&sha1Context);
678 lwip_sha1_update(&sha1Context, Digest,
sizeof(Digest));
679 lwip_sha1_update(&sha1Context, Challenge,
sizeof(Challenge));
680 lwip_sha1_update(&sha1Context, Magic2,
sizeof(Magic2));
681 lwip_sha1_finish(&sha1Context, Digest);
682 lwip_sha1_free(&sha1Context);
685 for (
i = 0;
i <
LWIP_MAX((MS_AUTH_RESPONSE_LENGTH / 2), (
int)
sizeof(Digest));
i++)
686 sprintf((
char *)&authResponse[
i * 2],
"%02X", Digest[
i]);
690static void GenerateAuthenticatorResponsePlain(
691 const char *
secret,
int secret_len,
694 u_char authResponse[MS_AUTH_RESPONSE_LENGTH+1]) {
695 u_char unicodePassword[MAX_NT_PASSWORD * 2];
696 u_char PasswordHash[MD4_SIGNATURE_SIZE];
697 u_char PasswordHashHash[MD4_SIGNATURE_SIZE];
700 ascii2unicode(
secret, secret_len, unicodePassword);
701 NTPasswordHash(unicodePassword, secret_len * 2, PasswordHash);
702 NTPasswordHash(PasswordHash,
sizeof(PasswordHash),
705 GenerateAuthenticatorResponse(PasswordHashHash, NTResponse, PeerChallenge,
706 rchallenge,
username, authResponse);
714static void Set_Start_Key(ppp_pcb *pcb,
const u_char *rchallenge,
const char *
secret,
int secret_len) {
715 u_char unicodePassword[MAX_NT_PASSWORD * 2];
716 u_char PasswordHash[MD4_SIGNATURE_SIZE];
717 u_char PasswordHashHash[MD4_SIGNATURE_SIZE];
718 lwip_sha1_context sha1Context;
719 u_char Digest[SHA1_SIGNATURE_SIZE];
722 ascii2unicode(
secret, secret_len, unicodePassword);
723 NTPasswordHash(unicodePassword, secret_len * 2, PasswordHash);
724 NTPasswordHash(PasswordHash,
sizeof(PasswordHash), PasswordHashHash);
726 lwip_sha1_init(&sha1Context);
727 lwip_sha1_starts(&sha1Context);
728 lwip_sha1_update(&sha1Context, PasswordHashHash, MD4_SIGNATURE_SIZE);
729 lwip_sha1_update(&sha1Context, PasswordHashHash, MD4_SIGNATURE_SIZE);
730 lwip_sha1_update(&sha1Context, rchallenge, 8);
731 lwip_sha1_finish(&sha1Context, Digest);
732 lwip_sha1_free(&sha1Context);
735 mppe_set_key(pcb, &pcb->mppe_comp, Digest);
736 mppe_set_key(pcb, &pcb->mppe_decomp, Digest);
738 pcb->mppe_keys_set = 1;
744static void SetMasterKeys(ppp_pcb *pcb,
const char *
secret,
int secret_len,
u_char NTResponse[24],
int IsServer) {
745 u_char unicodePassword[MAX_NT_PASSWORD * 2];
746 u_char PasswordHash[MD4_SIGNATURE_SIZE];
747 u_char PasswordHashHash[MD4_SIGNATURE_SIZE];
748 lwip_sha1_context sha1Context;
749 u_char MasterKey[SHA1_SIGNATURE_SIZE];
750 u_char Digest[SHA1_SIGNATURE_SIZE];
754 static const u_char Magic1[27] =
755 { 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x74,
756 0x68, 0x65, 0x20, 0x4d, 0x50, 0x50, 0x45, 0x20, 0x4d,
757 0x61, 0x73, 0x74, 0x65, 0x72, 0x20, 0x4b, 0x65, 0x79 };
760 static const u_char Magic2[84] =
761 { 0x4f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6c, 0x69,
762 0x65, 0x6e, 0x74, 0x20, 0x73, 0x69, 0x64, 0x65, 0x2c, 0x20,
763 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68,
764 0x65, 0x20, 0x73, 0x65, 0x6e, 0x64, 0x20, 0x6b, 0x65, 0x79,
765 0x3b, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73,
766 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x73, 0x69, 0x64, 0x65,
767 0x2c, 0x20, 0x69, 0x74, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68,
768 0x65, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x20,
769 0x6b, 0x65, 0x79, 0x2e };
772 static const u_char Magic3[84] =
773 { 0x4f, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63, 0x6c, 0x69,
774 0x65, 0x6e, 0x74, 0x20, 0x73, 0x69, 0x64, 0x65, 0x2c, 0x20,
775 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68,
776 0x65, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x20,
777 0x6b, 0x65, 0x79, 0x3b, 0x20, 0x6f, 0x6e, 0x20, 0x74, 0x68,
778 0x65, 0x20, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x73,
779 0x69, 0x64, 0x65, 0x2c, 0x20, 0x69, 0x74, 0x20, 0x69, 0x73,
780 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x65, 0x6e, 0x64, 0x20,
781 0x6b, 0x65, 0x79, 0x2e };
784 ascii2unicode(
secret, secret_len, unicodePassword);
785 NTPasswordHash(unicodePassword, secret_len * 2, PasswordHash);
786 NTPasswordHash(PasswordHash,
sizeof(PasswordHash), PasswordHashHash);
788 lwip_sha1_init(&sha1Context);
789 lwip_sha1_starts(&sha1Context);
790 lwip_sha1_update(&sha1Context, PasswordHashHash, MD4_SIGNATURE_SIZE);
791 lwip_sha1_update(&sha1Context, NTResponse, 24);
792 lwip_sha1_update(&sha1Context, Magic1,
sizeof(Magic1));
793 lwip_sha1_finish(&sha1Context, MasterKey);
794 lwip_sha1_free(&sha1Context);
803 lwip_sha1_init(&sha1Context);
804 lwip_sha1_starts(&sha1Context);
805 lwip_sha1_update(&sha1Context, MasterKey, 16);
806 lwip_sha1_update(&sha1Context, mppe_sha1_pad1, SHA1_PAD_SIZE);
807 lwip_sha1_update(&sha1Context,
s, 84);
808 lwip_sha1_update(&sha1Context, mppe_sha1_pad2, SHA1_PAD_SIZE);
809 lwip_sha1_finish(&sha1Context, Digest);
810 lwip_sha1_free(&sha1Context);
812 mppe_set_key(pcb, &pcb->mppe_comp, Digest);
821 lwip_sha1_init(&sha1Context);
822 lwip_sha1_starts(&sha1Context);
823 lwip_sha1_update(&sha1Context, MasterKey, 16);
824 lwip_sha1_update(&sha1Context, mppe_sha1_pad1, SHA1_PAD_SIZE);
825 lwip_sha1_update(&sha1Context,
s, 84);
826 lwip_sha1_update(&sha1Context, mppe_sha1_pad2, SHA1_PAD_SIZE);
827 lwip_sha1_finish(&sha1Context, Digest);
828 lwip_sha1_free(&sha1Context);
830 mppe_set_key(pcb, &pcb->mppe_decomp, Digest);
832 pcb->mppe_keys_set = 1;
838static void ChapMS(ppp_pcb *pcb,
const u_char *rchallenge,
const char *
secret,
int secret_len,
839 unsigned char *response) {
843 BZERO(response, MS_CHAP_RESPONSE_LEN);
845 ChapMS_NT(rchallenge,
secret, secret_len, &response[MS_CHAP_NTRESP]);
848 ChapMS_LANMan(rchallenge,
secret, secret_len,
849 &response[MS_CHAP_LANMANRESP]);
852 response[MS_CHAP_USENT] = !ms_lanman;
854 response[MS_CHAP_USENT] = 1;
858 Set_Start_Key(pcb, rchallenge,
secret, secret_len);
873static void ChapMS2(ppp_pcb *pcb,
const u_char *rchallenge,
const u_char *PeerChallenge,
874 const char *
user,
const char *
secret,
int secret_len,
unsigned char *response,
875 u_char authResponse[],
int authenticator) {
882 BZERO(response, MS_CHAP2_RESPONSE_LEN);
886 magic_random_bytes(&response[MS_CHAP2_PEER_CHALLENGE], MS_CHAP2_PEER_CHAL_LEN);
888 MEMCPY(&response[MS_CHAP2_PEER_CHALLENGE], PeerChallenge,
889 MS_CHAP2_PEER_CHAL_LEN);
892 ChapMS2_NT(rchallenge, &response[MS_CHAP2_PEER_CHALLENGE],
user,
893 secret, secret_len, &response[MS_CHAP2_NTRESP]);
896 GenerateAuthenticatorResponsePlain(
secret, secret_len,
897 &response[MS_CHAP2_NTRESP],
898 &response[MS_CHAP2_PEER_CHALLENGE],
899 rchallenge,
user, authResponse);
902 SetMasterKeys(pcb,
secret, secret_len,
903 &response[MS_CHAP2_NTRESP], authenticator);
914 if (
policy != MPPE_ENC_POL_ENC_ALLOWED ||
915 policy != MPPE_ENC_POL_ENC_REQUIRED)
919 if (
policy == MPPE_ENC_POL_ENC_ALLOWED && !ccp_wantoptions[0].mppe)
927 case MPPE_ENC_TYPES_RC4_40:
928 ccp_wantoptions[0].mppe &= ~MPPE_OPT_128;
930 case MPPE_ENC_TYPES_RC4_128:
931 ccp_wantoptions[0].mppe &= ~MPPE_OPT_40;
940const struct chap_digest_type chapms_digest = {
943 chapms_generate_challenge,
944 chapms_verify_response,
946 chapms_make_response,
948 chapms_handle_failure,
951const struct chap_digest_type chapms2_digest = {
954 chapms2_generate_challenge,
955 chapms2_verify_response,
957 chapms2_make_response,
958 chapms2_check_success,
959 chapms_handle_failure,
char * strstr(char *String1, char *String2)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
WINBASEAPI _Check_return_ _Out_ AppPolicyProcessTerminationMethod * policy
void user(int argc, const char *argv[])
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define LWIP_UNUSED_ARG(x)
_Check_return_ long __cdecl strtol(_In_z_ const char *_Str, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)
#define MEMCPY(DST, SRC, BYTES)
#define memcpy(s1, s2, n)
#define sprintf(buf, format,...)
static DATA_BLOB CRYPTPROTECT_PROMPTSTRUCT DATA_BLOB *static LPWSTR DATA_BLOB CRYPTPROTECT_PROMPTSTRUCT DATA_BLOB *static char secret[]
_CRT_RESTORE_GCC_WARNINGS _CRT_DISABLE_GCC_WARNINGS _Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)