This commit was generated by cvs2svn to track changes on a CVS vendor
[unix-history] / libexec / pppd / chap.h
CommitLineData
2a905848
RG
1/*
2 * chap.h - Cryptographic Handshake Authentication Protocol definitions.
3 * based on November 1991 draft of PPP Authentication RFC
4 *
5 * Copyright (c) 1991 Gregory M. Christy
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the author.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 */
19
20#ifndef __CHAP_INCLUDE__
21
22/* Code + ID + length */
23#define CHAP_HEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short))
24
25/*
26 * CHAP codes.
27 */
28
29#define CHAP_DIGEST_MD5 5 /* use MD5 algorithm */
30
31#define MD5_SIGNATURE_SIZE 16 /* 16 bytes in a MD5 message digest */
32
33#define CHAP_NOCALLBACK 0 /* don't call back after successful auth */
34#define CHAP_CALLBACK 1 /* do call back */
35
36#define CHAP_CHALLENGE 1
37#define CHAP_RESPONSE 2
38#define CHAP_SUCCESS 3
39#define CHAP_FAILURE 4
40
41/*
42 * Challenge lengths
43 */
44
45#define MIN_CHALLENGE_LENGTH 64
46#define MAX_CHALLENGE_LENGTH 128
47
48#define MAX_SECRET_LEN 128
49/*
50 * Each interface is described by chap structure.
51 */
52
53typedef struct chap_state {
54 int unit; /* Interface unit number */
55 u_char chal_str[MAX_CHALLENGE_LENGTH + 1]; /* challenge string */
56 u_char chal_len; /* challenge length */
57 int clientstate; /* Client state */
58 int serverstate; /* Server state */
59 int flags; /* Flags */
60 unsigned char id; /* Current id */
61 int timeouttime; /* Timeout time in milliseconds */
62 int retransmits; /* Number of retransmissions */
63} chap_state;
64
65
66/*
67 * Client states.
68 */
69#define CHAPCS_CLOSED 1 /* Connection down */
70#define CHAPCS_CHALLENGE_SENT 2 /* We've sent a challenge */
71#define CHAPCS_OPEN 3 /* We've received an Ack */
72
73/*
74 * Server states.
75 */
76#define CHAPSS_CLOSED 1 /* Connection down */
77#define CHAPSS_LISTEN 2 /* Listening for a challenge */
78#define CHAPSS_OPEN 3 /* We've sent an Ack */
79
80/*
81 * Flags.
82 */
83#define CHAPF_LOWERUP 0x01 /* The lower level is UP */
84#define CHAPF_AWPPENDING 0x02 /* Auth with peer pending */
85#define CHAPF_APPENDING 0x04 /* Auth peer pending */
86#define CHAPF_UPVALID 0x08 /* values valid */
87#define CHAPF_UPPENDING 0x10 /* values pending */
88
89
90/*
91 * Timeouts.
92 */
93#define CHAP_DEFTIMEOUT 3 /* Timeout time in seconds */
94
95extern chap_state chap[];
96
97void ChapInit __ARGS((int));
98void ChapAuthWithPeer __ARGS((int));
99void ChapAuthPeer __ARGS((int));
100void ChapLowerUp __ARGS((int));
101void ChapLowerDown __ARGS((int));
102void ChapInput __ARGS((int, u_char *, int));
103void ChapProtocolReject __ARGS((int));
104
105#define __CHAP_INCLUDE__
106#endif /* __CHAP_INCLUDE__ */