opie.h revision 59300
122347Spst/* opie.h: Data structures and values for the OPIE authentication
222347Spst	system that a program might need.
322347Spst
429967Sache%%% portions-copyright-cmetz-96
559121SkrisPortions of this software are Copyright 1996-1998 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
1859121Skris	Modified by cmetz for OPIE 2.32. Added symbolic flag names for
1959121Skris		opiepasswd(). Added __opieparsechallenge() prototype.
2029967Sache	Modified by cmetz for OPIE 2.31. Removed active attack protection.
2122347Spst	Modified by cmetz for OPIE 2.3. Renamed PTR to VOIDPTR. Added
2222347Spst		re-init key and extension file fields to struct opie. Added
2322347Spst		opie_ prefix on struct opie members. Added opie_flags field
2422347Spst		and definitions. Added more prototypes. Changed opiehash()
2522347Spst		prototype.
2622347Spst	Modified by cmetz for OPIE 2.22. Define __P correctly if this file
2722347Spst		is included in a third-party program.
2822347Spst	Modified by cmetz for OPIE 2.2. Re-did prototypes. Added FUNCTION
2922347Spst                definition et al. Multiple-include protection. Added struct
3022347Spst		utsname fake. Got rid of gethostname() cruft. Moved UINT4
3122347Spst                here. Provide for *seek whence values. Move MDx context here
3222347Spst                and unify. Re-did prototypes.
3322347Spst	Modified at NRL for OPIE 2.0.
3422347Spst	Written at Bellcore for the S/Key Version 1 software distribution
3522347Spst		(skey.h).
3659121Skris
3759121Skris$FreeBSD: head/contrib/opie/opie.h 59300 2000-04-17 00:01:23Z kris $
3822347Spst*/
3922347Spst#ifndef _OPIE_H
4029967Sache#define _OPIE_H 1
4122347Spst
4222347Spststruct opie {
4322347Spst  int opie_flags;
4422347Spst  char opie_buf[256];
4522347Spst  char *opie_principal;
4622347Spst  int opie_n;
4722347Spst  char *opie_seed;
4822347Spst  char *opie_val;
4922347Spst  long opie_recstart;
5022347Spst};
5122347Spst
5222347Spst#define __OPIE_FLAGS_RW 1
5322347Spst#define __OPIE_FLAGS_READ 2
5422347Spst
5522347Spst/* Minimum length of a secret password */
5622347Spst#define OPIE_SECRET_MIN 10
5722347Spst
5822347Spst/* Maximum length of a secret password */
5922347Spst#define OPIE_SECRET_MAX 127
6022347Spst
6122347Spst/* Minimum length of a seed */
6222347Spst#define OPIE_SEED_MIN 5
6322347Spst
6422347Spst/* Maximum length of a seed */
6522347Spst#define OPIE_SEED_MAX 16
6622347Spst
6722347Spst/* Maximum length of a challenge (otp-md? 9999 seed) */
6822347Spst#define OPIE_CHALLENGE_MAX (7+1+4+1+OPIE_SEED_MAX)
6922347Spst
7022347Spst/* Maximum length of a response that we allow */
7122347Spst#define OPIE_RESPONSE_MAX (9+1+19+1+9+OPIE_SEED_MAX+1+19+1+19+1+19)
7222347Spst
7322347Spst/* Maximum length of a principal (read: user name) */
7422347Spst#define OPIE_PRINCIPAL_MAX 32
7522347Spst
7629967Sache#include <sys/cdefs.h>
7722347Spst
7823540Spst__BEGIN_DECLS
7922347Spstint  opieaccessfile __P((char *));
8022347Spstint  rdnets __P((long));
8122347Spstint  isaddr __P((register char *));
8222347Spstint  opiealways __P((char *));
8322347Spstchar *opieatob8 __P((char *,char *));
8423540Spstvoid opiebackspace __P((char *));
8522347Spstchar *opiebtoa8 __P((char *,char *));
8622347Spstchar *opiebtoe __P((char *,char *));
8722347Spstchar *opiebtoh __P((char *,char *));
8822347Spstint  opieetob __P((char *,char *));
8922347Spstint  opiechallenge __P((struct opie *,char *,char *));
9022347Spstint  opiegenerator __P((char *,char *,char *));
9122347Spstint  opiegetsequence __P((struct opie *));
9223540Spstvoid opiehash __P((void *, unsigned));
9322347Spstint  opiehtoi __P((register char));
9422347Spstint  opiekeycrunch __P((int, char *, char *, char *));
9522347Spstint  opielock __P((char *));
9659300Skrisint  opieunlock __P((void));
9759300Skrisvoid opieunlockaeh __P((void));
9859300Skrisvoid opiedisableaeh __P((void));
9922347Spstint  opielookup __P((struct opie *,char *));
10022347Spstint  opiepasscheck __P((char *));
10123540Spstvoid opierandomchallenge __P((char *));
10222347Spstchar * opieskipspace __P((register char *));
10323540Spstvoid opiestripcrlf __P((char *));
10422347Spstint  opieverify __P((struct opie *,char *));
10529967Sacheint opiepasswd __P((struct opie *, int, char *, int, char *, char *));
10622347Spstchar *opiereadpass __P((char *, int, int));
10722347Spstint opielogin __P((char *line, char *name, char *host));
10823540Spst__END_DECLS
10922347Spst
11029967Sache#if _OPIE
11129967Sache#define VOIDPTR void *
11229967Sache#define VOIDRET void
11329967Sache#define NOARGS  void
11429967Sache#define FUNCTION(arglist, args) (args)
11529967Sache#define AND ,
11629967Sache#define FUNCTION_NOARGS ()
11729967Sache#define UINT4 u_int32_t
11823540Spst
11923540Spst__BEGIN_DECLS
12022347Spststruct utmp;
12129967Sacheint __opiegetutmpentry __P((char *, struct utmp *));
12222347Spst#ifdef EOF
12322347SpstFILE *__opieopen __P((char *, int, int));
12429967Sache#endif /* EOF */
12529967Sacheint __opiereadrec __P((struct opie *));
12629967Sacheint __opiewriterec __P((struct opie *));
12759121Skrisint __opieparsechallenge __P((char *buffer, int *algorithm, int *sequence, char **seed, int *exts));
12829972Sache__END_DECLS
12929967Sache#endif /* _OPIE */
13059121Skris
13159121Skris#define OPIEPASSWD_CONSOLE 1
13259121Skris#define OPIEPASSWD_FORCE   2
13359121Skris
13422347Spst#endif /* _OPIE_H */
135