68 |
7u83 |
1 |
#ifndef P9AUTH_H
|
|
|
2 |
#define P9AUTH_H
|
|
|
3 |
|
|
|
4 |
#define U9AUTH_DOMLEN 48 /* length of an authentication domain name */
|
|
|
5 |
#define U9AUTH_DESKEYLEN 7 /* length of a des key for encrypt/decrypt */
|
|
|
6 |
#define U9AUTH_CHALLEN 8 /* length of a challenge */
|
|
|
7 |
#define U9AUTH_NETCHLEN 16 /* max network challenge length */
|
|
|
8 |
#define U9AUTH_CONFIGLEN 14
|
|
|
9 |
#define U9AUTH_SECRETLEN 32 /* max length of a secret */
|
|
|
10 |
#define U9AUTH_APOPCHLEN 256
|
|
|
11 |
#define U9AUTH_MD5LEN 16
|
|
|
12 |
#define U9AUTH_KEYDBOFF 8 /* length of random data at the start of key file */
|
|
|
13 |
#define U9AUTH_OKEYDBLEN U9FSNAMELEN+U9AUTH_DESKEYLEN+4+2, /* length of an entry in old key file */
|
|
|
14 |
#define U9AUTH_KEYDBLEN OKEYDBLENSECRETLEN, /* length of an entry in key file */
|
|
|
15 |
|
|
|
16 |
/* encryption numberings (anti-replay) */
|
|
|
17 |
enum
|
|
|
18 |
{
|
|
|
19 |
AuthTreq=1, /* ticket request */
|
|
|
20 |
AuthChal=2, /* challenge box request */
|
|
|
21 |
AuthPass=3, /* change password */
|
|
|
22 |
AuthOK=4, /* fixed length reply follows */
|
|
|
23 |
AuthErr=5, /* error follows */
|
|
|
24 |
AuthMod=6, /* modify user */
|
|
|
25 |
AuthApop=7, /* apop authentication for pop3 */
|
|
|
26 |
AuthOKvar=9, /* variable length reply follows */
|
|
|
27 |
AuthChap=10, /* chap authentication for ppp */
|
|
|
28 |
AuthMSchap=11, /* MS chap authentication for ppp */
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
AuthTs=64, /* ticket encrypted with server's key */
|
|
|
32 |
AuthTc, /* ticket encrypted with client's key */
|
|
|
33 |
AuthAs, /* server generated authenticator */
|
|
|
34 |
AuthAc, /* client generated authenticator */
|
|
|
35 |
AuthTp, /* ticket encrypted with clien's key for password change */
|
|
|
36 |
};
|
|
|
37 |
|
|
|
38 |
struct u9auth_ticketreq
|
|
|
39 |
{
|
|
|
40 |
char type;
|
|
|
41 |
char authid[U9FS_NAMELEN]; /* server's encryption id */
|
|
|
42 |
char authdom[U9AUTH_DOMLEN]; /* server's authentication domain */
|
|
|
43 |
char chal[U9AUTH_CHALLEN]; /* challenge from server */
|
|
|
44 |
char hostid[U9FS_NAMELEN]; /* host's encryption id */
|
|
|
45 |
char uid[U9FS_NAMELEN]; /* uid of requesting user on host */
|
|
|
46 |
};
|
|
|
47 |
#define U9AUTH_TICKREQLEN (3*U9FS_NAMELEN+U9AUTH_CHALLEN+U9AUTH_DOMLEN+1)
|
|
|
48 |
|
|
|
49 |
struct u9auth_ticket
|
|
|
50 |
{
|
|
|
51 |
char num; /* replay protection */
|
|
|
52 |
char chal[U9AUTH_CHALLEN]; /* server challenge */
|
|
|
53 |
char cuid[U9FS_NAMELEN]; /* uid on client */
|
|
|
54 |
char suid[U9FS_NAMELEN]; /* uid on server */
|
|
|
55 |
char key[U9AUTH_DESKEYLEN]; /* nonce DES key */
|
|
|
56 |
};
|
|
|
57 |
#define U9AUTH_TICKETLEN (U9AUTH_CHALLEN+2*U9FS_NAMELEN+U9AUTH_DESKEYLEN+1)
|
|
|
58 |
|
|
|
59 |
struct u9auth_authenticator
|
|
|
60 |
{
|
|
|
61 |
char num; /* replay protection */
|
|
|
62 |
char chal[U9AUTH_CHALLEN];
|
|
|
63 |
u_long id; /* authenticator id, ++'d with each auth */
|
|
|
64 |
};
|
|
|
65 |
#define U9AUTH_AUTHENTLEN (U9AUTH_CHALLEN+4+1)
|
|
|
66 |
|
|
|
67 |
struct u9auth_passwordreq
|
|
|
68 |
{
|
|
|
69 |
char num;
|
|
|
70 |
char old[U9FS_NAMELEN];
|
|
|
71 |
char new[U9FS_NAMELEN];
|
|
|
72 |
char changesecret;
|
|
|
73 |
char secret[U9AUTH_SECRETLEN]; /* new secret */
|
|
|
74 |
};
|
|
|
75 |
#define U9AUTH_PASSREQLEN (2*U9FS_NAMELEN+1+1+U9AUTH_SECRETLEN)
|
|
|
76 |
|
|
|
77 |
struct u9auth_nvrsafe
|
|
|
78 |
{
|
|
|
79 |
char machkey[U9AUTH_DESKEYLEN];
|
|
|
80 |
u_char machsum;
|
|
|
81 |
char authkey[U9AUTH_DESKEYLEN];
|
|
|
82 |
u_char authsum;
|
|
|
83 |
char config[U9AUTH_CONFIGLEN];
|
|
|
84 |
u_char configsum;
|
|
|
85 |
char authid[U9FS_NAMELEN];
|
|
|
86 |
u_char authidsum;
|
|
|
87 |
char authdom[U9AUTH_DOMLEN];
|
|
|
88 |
u_char authdomsum;
|
|
|
89 |
};
|
|
|
90 |
|
|
|
91 |
struct u9auth_chalstate
|
|
|
92 |
{
|
|
|
93 |
int afd; /* /dev/authenticate */
|
|
|
94 |
int asfd; /* authdial() */
|
|
|
95 |
char chal[U9AUTH_NETCHLEN]; /* challenge/response */
|
|
|
96 |
};
|
|
|
97 |
|
|
|
98 |
struct u9auth_apopchalstate
|
|
|
99 |
{
|
|
|
100 |
int afd; /* /dev/authenticate */
|
|
|
101 |
int asfd; /* authdial() */
|
|
|
102 |
char chal[U9AUTH_APOPCHLEN]; /* challenge/response */
|
|
|
103 |
};
|
|
|
104 |
|
|
|
105 |
struct u9auth_chapreply
|
|
|
106 |
{
|
|
|
107 |
u_char id;
|
|
|
108 |
char uid[U9FS_NAMELEN];
|
|
|
109 |
char resp[U9AUTH_MD5LEN];
|
|
|
110 |
};
|
|
|
111 |
|
|
|
112 |
struct u9auth_mSchapreply
|
|
|
113 |
{
|
|
|
114 |
char uid[U9FS_NAMELEN];
|
|
|
115 |
char LMresp[24]; /* Lan Manager response */
|
|
|
116 |
char NTresp[24]; /* NT response */
|
|
|
117 |
};
|
|
|
118 |
|
|
|
119 |
#ifdef KERNEL
|
|
|
120 |
void u9auth_genchal __P((char *));
|
|
|
121 |
int u9auth_gettickets __P((struct socket * so, struct u9fsreq * rep,
|
|
|
122 |
char * user, char * ckey, char * ts, char * authc,
|
|
|
123 |
struct proc * p));
|
|
|
124 |
int encrypt9 __P((void *key, void * vbuf, int n));
|
|
|
125 |
int decrypt9 __P((void *key, void * vbuf, int n));
|
|
|
126 |
|
|
|
127 |
#endif
|
|
|
128 |
|
|
|
129 |
#endif
|