opie.h revision 29972
122347Spst/* opie.h: Data structures and values for the OPIE authentication
222347Spst	system that a program might need.
322347Spst
429967Sache%%% portions-copyright-cmetz-96
529967SachePortions of this software are Copyright 1996-1997 by Craig Metz, All Rights
622347SpstReserved. The Inner Net License Version 2 applies to these portions of
722347Spstthe software.
822347SpstYou should have received a copy of the license with this software. If
922347Spstyou didn't get a copy, you may request one from <license@inner.net>.
1022347Spst
1122347SpstPortions of this software are Copyright 1995 by Randall Atkinson and Dan
1222347SpstMcDonald, All Rights Reserved. All Rights under this copyright are assigned
1322347Spstto the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and
1422347SpstLicense Agreement applies to this software.
1522347Spst
1622347Spst	History:
1722347Spst
1829967Sache	Modified by cmetz for OPIE 2.31. Removed active attack protection.
1922347Spst	Modified by cmetz for OPIE 2.3. Renamed PTR to VOIDPTR. Added
2022347Spst		re-init key and extension file fields to struct opie. Added
2122347Spst		opie_ prefix on struct opie members. Added opie_flags field
2222347Spst		and definitions. Added more prototypes. Changed opiehash()
2322347Spst		prototype.
2422347Spst	Modified by cmetz for OPIE 2.22. Define __P correctly if this file
2522347Spst		is included in a third-party program.
2622347Spst	Modified by cmetz for OPIE 2.2. Re-did prototypes. Added FUNCTION
2722347Spst                definition et al. Multiple-include protection. Added struct
2822347Spst		utsname fake. Got rid of gethostname() cruft. Moved UINT4
2922347Spst                here. Provide for *seek whence values. Move MDx context here
3022347Spst                and unify. Re-did prototypes.
3122347Spst	Modified at NRL for OPIE 2.0.
3222347Spst	Written at Bellcore for the S/Key Version 1 software distribution
3322347Spst		(skey.h).
3422347Spst*/
3522347Spst#ifndef _OPIE_H
3629967Sache#define _OPIE_H 1
3722347Spst
3822347Spststruct opie {
3922347Spst  int opie_flags;
4022347Spst  char opie_buf[256];
4122347Spst  char *opie_principal;
4222347Spst  int opie_n;
4322347Spst  char *opie_seed;
4422347Spst  char *opie_val;
4522347Spst  long opie_recstart;
4622347Spst};
4722347Spst
4822347Spst#define __OPIE_FLAGS_RW 1
4922347Spst#define __OPIE_FLAGS_READ 2
5022347Spst
5122347Spst/* Minimum length of a secret password */
5222347Spst#define OPIE_SECRET_MIN 10
5322347Spst
5422347Spst/* Maximum length of a secret password */
5522347Spst#define OPIE_SECRET_MAX 127
5622347Spst
5722347Spst/* Minimum length of a seed */
5822347Spst#define OPIE_SEED_MIN 5
5922347Spst
6022347Spst/* Maximum length of a seed */
6122347Spst#define OPIE_SEED_MAX 16
6222347Spst
6322347Spst/* Maximum length of a challenge (otp-md? 9999 seed) */
6422347Spst#define OPIE_CHALLENGE_MAX (7+1+4+1+OPIE_SEED_MAX)
6522347Spst
6622347Spst/* Maximum length of a response that we allow */
6722347Spst#define OPIE_RESPONSE_MAX (9+1+19+1+9+OPIE_SEED_MAX+1+19+1+19+1+19)
6822347Spst
6922347Spst/* Maximum length of a principal (read: user name) */
7022347Spst#define OPIE_PRINCIPAL_MAX 32
7122347Spst
7229967Sache#include <sys/cdefs.h>
7322347Spst
7423540Spst__BEGIN_DECLS
7522347Spstint  opieaccessfile __P((char *));
7622347Spstint  rdnets __P((long));
7722347Spstint  isaddr __P((register char *));
7822347Spstint  opiealways __P((char *));
7922347Spstchar *opieatob8 __P((char *,char *));
8023540Spstvoid opiebackspace __P((char *));
8122347Spstchar *opiebtoa8 __P((char *,char *));
8222347Spstchar *opiebtoe __P((char *,char *));
8322347Spstchar *opiebtoh __P((char *,char *));
8422347Spstint  opieetob __P((char *,char *));
8522347Spstint  opiechallenge __P((struct opie *,char *,char *));
8622347Spstint  opiegenerator __P((char *,char *,char *));
8722347Spstint  opiegetsequence __P((struct opie *));
8823540Spstvoid opiehash __P((void *, unsigned));
8922347Spstint  opiehtoi __P((register char));
9022347Spstint  opiekeycrunch __P((int, char *, char *, char *));
9122347Spstint  opielock __P((char *));
9222347Spstint  opielookup __P((struct opie *,char *));
9322347Spstint  opiepasscheck __P((char *));
9423540Spstvoid opierandomchallenge __P((char *));
9522347Spstchar * opieskipspace __P((register char *));
9623540Spstvoid opiestripcrlf __P((char *));
9722347Spstint  opieverify __P((struct opie *,char *));
9829967Sacheint opiepasswd __P((struct opie *, int, char *, int, char *, char *));
9922347Spstchar *opiereadpass __P((char *, int, int));
10022347Spstint opielogin __P((char *line, char *name, char *host));
10123540Spst__END_DECLS
10222347Spst
10329967Sache#if _OPIE
10429967Sache#define VOIDPTR void *
10529967Sache#define VOIDRET void
10629967Sache#define NOARGS  void
10729967Sache#define FUNCTION(arglist, args) (args)
10829967Sache#define AND ,
10929967Sache#define FUNCTION_NOARGS ()
11029967Sache#define UINT4 u_int32_t
11123540Spst
11223540Spst__BEGIN_DECLS
11322347Spststruct utmp;
11429967Sacheint __opiegetutmpentry __P((char *, struct utmp *));
11522347Spst#ifdef EOF
11622347SpstFILE *__opieopen __P((char *, int, int));
11729967Sache#endif /* EOF */
11829967Sacheint __opiereadrec __P((struct opie *));
11929967Sacheint __opiewriterec __P((struct opie *));
12029972Sache__END_DECLS
12129967Sache#endif /* _OPIE */
12222347Spst#endif /* _OPIE_H */
123