opie.h revision 60572
111820Sjulian/* opie.h: Data structures and values for the OPIE authentication
211820Sjulian	system that a program might need.
311820Sjulian
411820Sjulian%%% portions-copyright-cmetz-96
511820SjulianPortions of this software are Copyright 1996-1998 by Craig Metz, All Rights
611820SjulianReserved. The Inner Net License Version 2 applies to these portions of
711820Sjulianthe software.
811820SjulianYou should have received a copy of the license with this software. If
911820Sjulianyou didn't get a copy, you may request one from <license@inner.net>.
1011820Sjulian
1111820SjulianPortions of this software are Copyright 1995 by Randall Atkinson and Dan
1211820SjulianMcDonald, All Rights Reserved. All Rights under this copyright are assigned
1311820Sjulianto the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and
1411820SjulianLicense Agreement applies to this software.
1511820Sjulian
1611820Sjulian	History:
1711820Sjulian
1811820Sjulian	Modified by cmetz for OPIE 2.32. Added symbolic flag names for
1911820Sjulian		opiepasswd(). Added __opieparsechallenge() prototype.
2011820Sjulian	Modified by cmetz for OPIE 2.31. Removed active attack protection.
2111820Sjulian	Modified by cmetz for OPIE 2.3. Renamed PTR to VOIDPTR. Added
2211820Sjulian		re-init key and extension file fields to struct opie. Added
2311820Sjulian		opie_ prefix on struct opie members. Added opie_flags field
2411820Sjulian		and definitions. Added more prototypes. Changed opiehash()
2511820Sjulian		prototype.
2611820Sjulian	Modified by cmetz for OPIE 2.22. Define __P correctly if this file
2711820Sjulian		is included in a third-party program.
2811820Sjulian	Modified by cmetz for OPIE 2.2. Re-did prototypes. Added FUNCTION
2911820Sjulian                definition et al. Multiple-include protection. Added struct
3011820Sjulian		utsname fake. Got rid of gethostname() cruft. Moved UINT4
3111820Sjulian                here. Provide for *seek whence values. Move MDx context here
3211820Sjulian                and unify. Re-did prototypes.
3311820Sjulian	Modified at NRL for OPIE 2.0.
3411820Sjulian	Written at Bellcore for the S/Key Version 1 software distribution
3511820Sjulian		(skey.h).
3611820Sjulian
3711820Sjulian$FreeBSD: head/contrib/opie/opie.h 60572 2000-05-15 04:20:54Z kris $
3812620Sjulian*/
3911820Sjulian#ifndef _OPIE_H
4011820Sjulian#define _OPIE_H 1
4111820Sjulian
4211820Sjulianstruct opie {
4311820Sjulian  int opie_flags;
4411820Sjulian  char opie_buf[256];
4511820Sjulian  char *opie_principal;
4611820Sjulian  int opie_n;
4711820Sjulian  char *opie_seed;
4811820Sjulian  char *opie_val;
4911820Sjulian  long opie_recstart;
5011820Sjulian};
5111820Sjulian
5211820Sjulian#define __OPIE_FLAGS_RW 1
5311820Sjulian#define __OPIE_FLAGS_READ 2
5411820Sjulian
5511820Sjulian/* Minimum length of a secret password */
5611820Sjulian#define OPIE_SECRET_MIN 10
5711820Sjulian
5811820Sjulian/* Maximum length of a secret password */
5911820Sjulian#define OPIE_SECRET_MAX 127
6011820Sjulian
6111820Sjulian/* Minimum length of a seed */
6211820Sjulian#define OPIE_SEED_MIN 5
6311820Sjulian
6411820Sjulian/* Maximum length of a seed */
6511820Sjulian#define OPIE_SEED_MAX 16
6611820Sjulian
6711820Sjulian/* Max length of hash algorithm name (md4/md5) */
6811820Sjulian#define OPIE_HASHNAME_MAX 3
6911820Sjulian
7011820Sjulian/* Maximum length of a challenge (otp-md? 9999 seed) */
7111820Sjulian#define OPIE_CHALLENGE_MAX (4+OPIE_HASHNAME_MAX+1+4+1+OPIE_SEED_MAX)
7211820Sjulian
7311820Sjulian/* Maximum length of a response that we allow */
7411820Sjulian#define OPIE_RESPONSE_MAX (9+1+19+1+9+OPIE_SEED_MAX+1+19+1+19+1+19)
7511820Sjulian
7611820Sjulian/* Maximum length of a principal (read: user name) */
7711820Sjulian#define OPIE_PRINCIPAL_MAX 32
7811820Sjulian
7911820Sjulian#include <sys/cdefs.h>
8011820Sjulian
8111820Sjulian__BEGIN_DECLS
8211820Sjulianint  opieaccessfile __P((char *));
8311820Sjulianint  rdnets __P((long));
8411820Sjulianint  isaddr __P((register char *));
8511820Sjulianint  opiealways __P((char *));
8611820Sjulianchar *opieatob8 __P((char *,char *));
8711820Sjulianvoid opiebackspace __P((char *));
8811820Sjulianchar *opiebtoa8 __P((char *,char *));
8911820Sjulianchar *opiebtoe __P((char *,char *));
9011820Sjulianchar *opiebtoh __P((char *,char *));
9111820Sjulianint  opieetob __P((char *,char *));
9211820Sjulianint  opiechallenge __P((struct opie *,char *,char *));
9311820Sjulianint  opiegenerator __P((char *,char *,char *));
9411820Sjulianint  opiegetsequence __P((struct opie *));
9511820Sjulianvoid opiehash __P((void *, unsigned));
9611820Sjulianint  opiehtoi __P((register char));
9711820Sjulianint  opiekeycrunch __P((int, char *, char *, char *));
9811820Sjulianint  opielock __P((char *));
9911820Sjulianint  opieunlock __P((void));
10011820Sjulianvoid opieunlockaeh __P((void));
10111820Sjulianvoid opiedisableaeh __P((void));
10211820Sjulianint  opielookup __P((struct opie *,char *));
10311820Sjulianint  opiepasscheck __P((char *));
10411820Sjulianvoid opierandomchallenge __P((char *));
10511820Sjulianchar * opieskipspace __P((register char *));
10611820Sjulianvoid opiestripcrlf __P((char *));
10711820Sjulianint  opieverify __P((struct opie *,char *));
10811820Sjulianint opiepasswd __P((struct opie *, int, char *, int, char *, char *));
10911820Sjulianchar *opiereadpass __P((char *, int, int));
11011820Sjulianint opielogin __P((char *line, char *name, char *host));
11111820Sjulianconst char *opie_get_algorithm __P((void));
11211820Sjulianint  opie_haskey __P((char *username));
11311820Sjulianchar *opie_keyinfo __P((char *));
11411820Sjulianint  opie_passverify __P((char *username, char *passwd));
11511820Sjulian__END_DECLS
11611820Sjulian
11711820Sjulian#if _OPIE
11811820Sjulian#define VOIDPTR void *
11911820Sjulian#define VOIDRET void
12011820Sjulian#define NOARGS  void
12111820Sjulian#define FUNCTION(arglist, args) (args)
12211820Sjulian#define AND ,
12311820Sjulian#define FUNCTION_NOARGS ()
12411820Sjulian#define UINT4 u_int32_t
12511820Sjulian
12611820Sjulian__BEGIN_DECLS
12711820Sjulianstruct utmp;
12811820Sjulianint __opiegetutmpentry __P((char *, struct utmp *));
12911820Sjulian#ifdef EOF
13011820SjulianFILE *__opieopen __P((char *, int, int));
13111820Sjulian#endif /* EOF */
13211820Sjulianint __opiereadrec __P((struct opie *));
13311820Sjulianint __opiewriterec __P((struct opie *));
13411820Sjulianint __opieparsechallenge __P((char *buffer, int *algorithm, int *sequence, char **seed, int *exts));
13511820Sjulian__END_DECLS
13611820Sjulian#endif /* _OPIE */
13711820Sjulian
13811820Sjulian#define OPIEPASSWD_CONSOLE 1
13911820Sjulian#define OPIEPASSWD_FORCE   2
14011820Sjulian
14111820Sjulian#endif /* _OPIE_H */
14211820Sjulian