opie.h revision 29967
1/* opie.h: Data structures and values for the OPIE authentication 2 system that a program might need. 3 4%%% portions-copyright-cmetz-96 5Portions of this software are Copyright 1996-1997 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 9you didn't get a copy, you may request one from <license@inner.net>. 10 11Portions of this software are Copyright 1995 by Randall Atkinson and Dan 12McDonald, All Rights Reserved. All Rights under this copyright are assigned 13to the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and 14License Agreement applies to this software. 15 16 History: 17 18 Modified by cmetz for OPIE 2.31. Removed active attack protection. 19 Modified by cmetz for OPIE 2.3. Renamed PTR to VOIDPTR. Added 20 re-init key and extension file fields to struct opie. Added 21 opie_ prefix on struct opie members. Added opie_flags field 22 and definitions. Added more prototypes. Changed opiehash() 23 prototype. 24 Modified by cmetz for OPIE 2.22. Define __P correctly if this file 25 is included in a third-party program. 26 Modified by cmetz for OPIE 2.2. Re-did prototypes. Added FUNCTION 27 definition et al. Multiple-include protection. Added struct 28 utsname fake. Got rid of gethostname() cruft. Moved UINT4 29 here. Provide for *seek whence values. Move MDx context here 30 and unify. Re-did prototypes. 31 Modified at NRL for OPIE 2.0. 32 Written at Bellcore for the S/Key Version 1 software distribution 33 (skey.h). 34*/ 35#ifndef _OPIE_H 36#define _OPIE_H 1 37 38struct opie { 39 int opie_flags; 40 char opie_buf[256]; 41 char *opie_principal; 42 int opie_n; 43 char *opie_seed; 44 char *opie_val; 45 long opie_recstart; 46}; 47 48#define __OPIE_FLAGS_RW 1 49#define __OPIE_FLAGS_READ 2 50 51/* Minimum length of a secret password */ 52#define OPIE_SECRET_MIN 10 53 54/* Maximum length of a secret password */ 55#define OPIE_SECRET_MAX 127 56 57/* Minimum length of a seed */ 58#define OPIE_SEED_MIN 5 59 60/* Maximum length of a seed */ 61#define OPIE_SEED_MAX 16 62 63/* Maximum length of a challenge (otp-md? 9999 seed) */ 64#define OPIE_CHALLENGE_MAX (7+1+4+1+OPIE_SEED_MAX) 65 66/* Maximum length of a response that we allow */ 67#define OPIE_RESPONSE_MAX (9+1+19+1+9+OPIE_SEED_MAX+1+19+1+19+1+19) 68 69/* Maximum length of a principal (read: user name) */ 70#define OPIE_PRINCIPAL_MAX 32 71 72#include <sys/cdefs.h> 73 74__BEGIN_DECLS 75int opieaccessfile __P((char *)); 76int rdnets __P((long)); 77int isaddr __P((register char *)); 78int opiealways __P((char *)); 79char *opieatob8 __P((char *,char *)); 80void opiebackspace __P((char *)); 81char *opiebtoa8 __P((char *,char *)); 82char *opiebtoe __P((char *,char *)); 83char *opiebtoh __P((char *,char *)); 84int opieetob __P((char *,char *)); 85int opiechallenge __P((struct opie *,char *,char *)); 86int opiegenerator __P((char *,char *,char *)); 87int opiegetsequence __P((struct opie *)); 88void opiehash __P((void *, unsigned)); 89int opiehtoi __P((register char)); 90int opiekeycrunch __P((int, char *, char *, char *)); 91int opielock __P((char *)); 92int opielookup __P((struct opie *,char *)); 93int opiepasscheck __P((char *)); 94void opierandomchallenge __P((char *)); 95char * opieskipspace __P((register char *)); 96void opiestripcrlf __P((char *)); 97int opieverify __P((struct opie *,char *)); 98int opiepasswd __P((struct opie *, int, char *, int, char *, char *)); 99char *opiereadpass __P((char *, int, int)); 100int opielogin __P((char *line, char *name, char *host)); 101__END_DECLS 102 103#if _OPIE 104#define VOIDPTR void * 105#define VOIDRET void 106#define NOARGS void 107#define FUNCTION(arglist, args) (args) 108#define AND , 109#define FUNCTION_NOARGS () 110#define UINT4 u_int32_t 111 112__BEGIN_DECLS 113struct utmp; 114int __opiegetutmpentry __P((char *, struct utmp *)); 115#ifdef EOF 116FILE *__opieopen __P((char *, int, int)); 117#endif /* EOF */ 118int __opiereadrec __P((struct opie *)); 119int __opiewriterec __P((struct opie *)); 120#endif /* _OPIE */ 121__END_DECLS 122#endif /* _OPIE_H */ 123