opie.h (22348) | opie.h (23540) |
---|---|
1/* opie.h: Data structures and values for the OPIE authentication 2 system that a program might need. 3 4%%% portions-copyright-cmetz 5Portions of this software are Copyright 1996 by Craig Metz, All Rights 6Reserved. The Inner Net License Version 2 applies to these portions of 7the software. 8You should have received a copy of the license with this software. If --- 20 unchanged lines hidden (view full) --- 29 and unify. Re-did prototypes. 30 Modified at NRL for OPIE 2.0. 31 Written at Bellcore for the S/Key Version 1 software distribution 32 (skey.h). 33*/ 34#ifndef _OPIE_H 35#define _OPIE_H 36 | 1/* opie.h: Data structures and values for the OPIE authentication 2 system that a program might need. 3 4%%% portions-copyright-cmetz 5Portions of this software are Copyright 1996 by Craig Metz, All Rights 6Reserved. The Inner Net License Version 2 applies to these portions of 7the software. 8You should have received a copy of the license with this software. If --- 20 unchanged lines hidden (view full) --- 29 and unify. Re-did prototypes. 30 Modified at NRL for OPIE 2.0. 31 Written at Bellcore for the S/Key Version 1 software distribution 32 (skey.h). 33*/ 34#ifndef _OPIE_H 35#define _OPIE_H 36 |
37#if _OPIE 38 39#if HAVE_VOIDPTR 40#define VOIDPTR void * 41#else /* HAVE_VOIDPTR */ 42#define VOIDPTR char * 43#endif /* HAVE_VOIDPTR */ 44 45#if HAVE_VOIDRET 46#define VOIDRET void 47#else /* HAVE_VOIDRET */ 48#define VOIDRET 49#endif /* HAVE_VOIDRET */ 50 51#if HAVE_VOIDARG 52#define NOARGS void 53#else /* HAVE_VOIDARG */ 54#define NOARGS 55#endif /* HAVE_VOIDARG */ 56 57#if HAVE_ANSIDECL 58#define FUNCTION(arglist, args) (args) 59#define AND , 60#else /* HAVE_ANSIDECL */ 61#define FUNCTION(arglist, args) arglist args; 62#define AND ; 63#endif /* HAVE_ANSIDECL */ 64 65#define FUNCTION_NOARGS () 66 67#ifndef __P 68#if HAVE_ANSIPROTO 69#define __P(x) x 70#else /* HAVE_ANSIPROTO */ 71#define __P(x) () 72#endif /* HAVE_ANSIPROTO */ 73#endif /* __P */ 74 75#ifndef HAVE_SYS_UTSNAME_H 76struct utsname { 77 char nodename[65]; 78 }; 79#endif /* HAVE_SYS_UTSNAME_H */ 80 81#ifndef _SC_OPEN_MAX 82#define _SC_OPEN_MAX 1 83#endif /* _SC_OPEN_MAX */ 84 85#ifndef MAXHOSTNAMELEN 86#define MAXHOSTNAMELEN 1024 87#endif /* MAXHOSTNAMELEN */ 88 89#else /* _OPIE */ 90#ifdef __STDC__ 91#define VOIDRET void 92#define VOIDPTR void * 93#else /* __STDC__ */ 94#define VOIDRET 95#define VOIDPTR char * 96#endif /* __STDC__ */ 97#endif /* _OPIE */ 98 99#ifndef __P 100#ifdef __ARGS 101#define __P __ARGS 102#else /* __ARGS */ 103#ifdef __STDC__ 104#define __P(x) x 105#else /* __STDC__ */ 106#define __P(x) () 107#endif /* __STDC__ */ 108#endif /* __ARGS */ 109#endif /* __P */ 110 | |
111struct opie { 112 int opie_flags; 113 char opie_buf[256]; 114 char *opie_principal; 115 int opie_n; 116 char *opie_seed; 117 char *opie_val; 118 long opie_recstart; 119 char opie_extbuf[129]; /* > OPIE_PRINCIPAL_MAX + 1 + 16 + 2 + 1 */ 120 long opie_extrecstart; 121 char *opie_reinitkey; 122}; 123 124#define __OPIE_FLAGS_RW 1 125#define __OPIE_FLAGS_READ 2 126 127/* Minimum length of a secret password */ | 37struct opie { 38 int opie_flags; 39 char opie_buf[256]; 40 char *opie_principal; 41 int opie_n; 42 char *opie_seed; 43 char *opie_val; 44 long opie_recstart; 45 char opie_extbuf[129]; /* > OPIE_PRINCIPAL_MAX + 1 + 16 + 2 + 1 */ 46 long opie_extrecstart; 47 char *opie_reinitkey; 48}; 49 50#define __OPIE_FLAGS_RW 1 51#define __OPIE_FLAGS_READ 2 52 53/* Minimum length of a secret password */ |
128#ifndef OPIE_SECRET_MIN | |
129#define OPIE_SECRET_MIN 10 | 54#define OPIE_SECRET_MIN 10 |
130#endif /* OPIE_SECRET_MIN */ | |
131 132/* Maximum length of a secret password */ | 55 56/* Maximum length of a secret password */ |
133#ifndef OPIE_SECRET_MAX | |
134#define OPIE_SECRET_MAX 127 | 57#define OPIE_SECRET_MAX 127 |
135#endif /* OPIE_SECRET_MAX */ | |
136 137/* Minimum length of a seed */ | 58 59/* Minimum length of a seed */ |
138#ifndef OPIE_SEED_MIN | |
139#define OPIE_SEED_MIN 5 | 60#define OPIE_SEED_MIN 5 |
140#endif /* OPIE_SEED_MIN */ | |
141 142/* Maximum length of a seed */ | 61 62/* Maximum length of a seed */ |
143#ifndef OPIE_SEED_MAX | |
144#define OPIE_SEED_MAX 16 | 63#define OPIE_SEED_MAX 16 |
145#endif /* OPIE_SEED_MAX */ | |
146 147/* Maximum length of a challenge (otp-md? 9999 seed) */ | 64 65/* Maximum length of a challenge (otp-md? 9999 seed) */ |
148#ifndef OPIE_CHALLENGE_MAX | |
149#define OPIE_CHALLENGE_MAX (7+1+4+1+OPIE_SEED_MAX) | 66#define OPIE_CHALLENGE_MAX (7+1+4+1+OPIE_SEED_MAX) |
150#endif /* OPIE_CHALLENGE_MAX */ | |
151 152/* Maximum length of a response that we allow */ | 67 68/* Maximum length of a response that we allow */ |
153#ifndef OPIE_RESPONSE_MAX | |
154#define OPIE_RESPONSE_MAX (9+1+19+1+9+OPIE_SEED_MAX+1+19+1+19+1+19) | 69#define OPIE_RESPONSE_MAX (9+1+19+1+9+OPIE_SEED_MAX+1+19+1+19+1+19) |
155#endif /* OPIE_RESPONSE_MAX */ | |
156 157/* Maximum length of a principal (read: user name) */ | 70 71/* Maximum length of a principal (read: user name) */ |
158#ifndef OPIE_PRINCIPAL_MAX | |
159#define OPIE_PRINCIPAL_MAX 32 | 72#define OPIE_PRINCIPAL_MAX 32 |
160#endif /* OPIE_PRINCIPAL_MAX */ | |
161 | 73 |
162#ifndef __alpha 163#define UINT4 unsigned long 164#else /* __alpha */ 165#define UINT4 unsigned int 166#endif /* __alpha */ 167 | |
168struct opiemdx_ctx { | 74struct opiemdx_ctx { |
169 UINT4 state[4]; 170 UINT4 count[2]; | 75 u_int32_t state[4]; 76 u_int32_t count[2]; |
171 unsigned char buffer[64]; 172}; 173 | 77 unsigned char buffer[64]; 78}; 79 |
174#ifndef SEEK_SET 175#define SEEK_SET 0 176#endif /* SEEK_SET */ 177 178#ifndef SEEK_END 179#define SEEK_END 2 180#endif /* SEEK_END */ 181 | 80__BEGIN_DECLS |
182int opieaccessfile __P((char *)); 183int rdnets __P((long)); 184int isaddr __P((register char *)); 185int opiealways __P((char *)); 186char *opieatob8 __P((char *,char *)); | 81int opieaccessfile __P((char *)); 82int rdnets __P((long)); 83int isaddr __P((register char *)); 84int opiealways __P((char *)); 85char *opieatob8 __P((char *,char *)); |
187VOIDRET opiebackspace __P((char *)); | 86void opiebackspace __P((char *)); |
188char *opiebtoa8 __P((char *,char *)); 189char *opiebtoe __P((char *,char *)); 190char *opiebtoh __P((char *,char *)); 191int opieetob __P((char *,char *)); 192int opiechallenge __P((struct opie *,char *,char *)); 193int opiegenerator __P((char *,char *,char *)); 194int opiegetsequence __P((struct opie *)); | 87char *opiebtoa8 __P((char *,char *)); 88char *opiebtoe __P((char *,char *)); 89char *opiebtoh __P((char *,char *)); 90int opieetob __P((char *,char *)); 91int opiechallenge __P((struct opie *,char *,char *)); 92int opiegenerator __P((char *,char *,char *)); 93int opiegetsequence __P((struct opie *)); |
195VOIDRET opiehash __P((VOIDPTR, unsigned)); | 94void opiehash __P((void *, unsigned)); |
196int opiehtoi __P((register char)); 197int opiekeycrunch __P((int, char *, char *, char *)); 198int opielock __P((char *)); 199int opielookup __P((struct opie *,char *)); | 95int opiehtoi __P((register char)); 96int opiekeycrunch __P((int, char *, char *, char *)); 97int opielock __P((char *)); 98int opielookup __P((struct opie *,char *)); |
200VOIDRET opiemd4init __P((struct opiemdx_ctx *)); 201VOIDRET opiemd4update __P((struct opiemdx_ctx *,unsigned char *,unsigned int)); 202VOIDRET opiemd4final __P((unsigned char *,struct opiemdx_ctx *)); 203VOIDRET opiemd5init __P((struct opiemdx_ctx *)); 204VOIDRET opiemd5update __P((struct opiemdx_ctx *,unsigned char *,unsigned int)); 205VOIDRET opiemd5final __P((unsigned char *,struct opiemdx_ctx *)); | |
206int opiepasscheck __P((char *)); | 99int opiepasscheck __P((char *)); |
207VOIDRET opierandomchallenge __P((char *)); | 100void opierandomchallenge __P((char *)); |
208char * opieskipspace __P((register char *)); | 101char * opieskipspace __P((register char *)); |
209VOIDRET opiestripcrlf __P((char *)); | 102void opiestripcrlf __P((char *)); |
210int opieverify __P((struct opie *,char *)); | 103int opieverify __P((struct opie *,char *)); |
211int opiepasswd __P((struct opie *, int, char *, int, char *, char *)); | 104int opiepasswd __P((struct opie *, int, char *, int, char *, char *)); |
212char *opiereadpass __P((char *, int, int)); 213int opielogin __P((char *line, char *name, char *host)); | 105char *opiereadpass __P((char *, int, int)); 106int opielogin __P((char *line, char *name, char *host)); |
107__END_DECLS |
|
214 | 108 |
215#if _OPIE | 109#if _OPIE /* internal glue support */ 110 111#define VOIDPTR void * 112#define VOIDRET void 113#define NOARGS void 114#define FUNCTION(arglist, args) (args) 115#define AND , 116#define FUNCTION_NOARGS () 117#define UINT4 u_int32_t 118 119__BEGIN_DECLS |
216struct utmp; | 120struct utmp; |
217int __opiegetutmpentry __P((char *, struct utmp *)); | 121int __opiegetutmpentry __P((char *, struct utmp *)); 122int __opiereadrec __P((struct opie *)); 123int __opiewriterec __P((struct opie *)); 124 |
218#ifdef EOF 219FILE *__opieopen __P((char *, int, int)); | 125#ifdef EOF 126FILE *__opieopen __P((char *, int, int)); |
220#endif /* EOF */ 221int __opiereadrec __P((struct opie *)); 222int __opiewriterec __P((struct opie *)); | 127#endif 128 129__END_DECLS 130 |
223#endif /* _OPIE */ | 131#endif /* _OPIE */ |
132 |
|
224#endif /* _OPIE_H */ | 133#endif /* _OPIE_H */ |