]> git.ozlabs.org Git - ppp.git/blob - pppd/chap_ms.h
config: Include some extra files in the tarball
[ppp.git] / pppd / chap_ms.h
1 /*
2  * chap_ms.h - Challenge Handshake Authentication Protocol definitions.
3  *
4  * Copyright (c) 1995 Eric Rosenquist.  All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in
15  *    the documentation and/or other materials provided with the
16  *    distribution.
17  *
18  * 3. The name(s) of the authors of this software must not be used to
19  *    endorse or promote products derived from this software without
20  *    prior written permission.
21  *
22  * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
23  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
24  * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
25  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
26  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
27  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
28  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
29  */
30
31 #ifndef PPP_CHAPMS_H
32 #define PPP_CHAPMS_H
33
34 #include "pppdconf.h"
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 #define MAX_NT_PASSWORD         256     /* Max (Unicode) chars in an NT pass */
41
42 #define MS_CHAP_RESPONSE_LEN    49      /* Response length for MS-CHAP */
43 #define MS_CHAP2_RESPONSE_LEN   49      /* Response length for MS-CHAPv2 */
44 #define MS_AUTH_RESPONSE_LENGTH 40      /* MS-CHAPv2 authenticator response, */
45 #define MS_AUTH_NTRESP_LEN      24  /* Length of NT-response field */
46                                         /* as ASCII */
47
48 /* E=eeeeeeeeee error codes for MS-CHAP failure messages. */
49 #define MS_CHAP_ERROR_RESTRICTED_LOGON_HOURS    646
50 #define MS_CHAP_ERROR_ACCT_DISABLED             647
51 #define MS_CHAP_ERROR_PASSWD_EXPIRED            648
52 #define MS_CHAP_ERROR_NO_DIALIN_PERMISSION      649
53 #define MS_CHAP_ERROR_AUTHENTICATION_FAILURE    691
54 #define MS_CHAP_ERROR_CHANGING_PASSWORD         709
55
56 /*
57  * Offsets within the response field for MS-CHAP
58  */
59 #define MS_CHAP_LANMANRESP      0
60 #define MS_CHAP_LANMANRESP_LEN  24
61 #define MS_CHAP_NTRESP          24
62 #define MS_CHAP_NTRESP_LEN      24
63 #define MS_CHAP_USENT           48
64
65 /*
66  * Offsets within the response field for MS-CHAP2
67  */
68 #define MS_CHAP2_PEER_CHALLENGE 0
69 #define MS_CHAP2_PEER_CHAL_LEN  16
70 #define MS_CHAP2_RESERVED_LEN   8
71 #define MS_CHAP2_NTRESP         24
72 #define MS_CHAP2_NTRESP_LEN     24
73 #define MS_CHAP2_FLAGS          48
74
75 /* Are we the authenticator or authenticatee?  For MS-CHAPv2 key derivation. */
76 #define MS_CHAP2_AUTHENTICATEE 0
77 #define MS_CHAP2_AUTHENTICATOR 1
78
79 void ChapMS (u_char *, char *, int, u_char *);
80 void ChapMS2 (u_char *, u_char *, char *, char *, int,
81               u_char *, u_char[MS_AUTH_RESPONSE_LENGTH+1], int);
82
83 void ChallengeHash (u_char[16], u_char *, char *, u_char[8]);
84
85
86 /**
87  * PasswordHashHash - 16 bytes representing the NT Password Hash Hash
88  * NTResponse - 24 bytes  represending the NTResponse parameter
89  * PeerChallenge - 16 bytes challange for peer
90  * rchallenge - 16 bytes challenge provided by peer
91  * authResponse - 24 + 1 byte to store the authenticator response
92  */
93 void GenerateAuthenticatorResponse(unsigned char *PasswordHashHash,
94                         unsigned char *NTResponse, unsigned char *PeerChallenge,
95                         unsigned char *rchallenge, char *username,
96                         unsigned char *authResponse);
97
98 void chapms_init(void);
99
100 #ifdef __cplusplus
101 }
102 #endif
103
104 #endif /* PPP_CHAPMS_H */