opie.h revision 60572
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 60572 2000-05-15 04:20:54Z 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 6760572Skris/* Max length of hash algorithm name (md4/md5) */ 6860572Skris#define OPIE_HASHNAME_MAX 3 6960572Skris 7022347Spst/* Maximum length of a challenge (otp-md? 9999 seed) */ 7160572Skris#define OPIE_CHALLENGE_MAX (4+OPIE_HASHNAME_MAX+1+4+1+OPIE_SEED_MAX) 7222347Spst 7322347Spst/* Maximum length of a response that we allow */ 7422347Spst#define OPIE_RESPONSE_MAX (9+1+19+1+9+OPIE_SEED_MAX+1+19+1+19+1+19) 7522347Spst 7622347Spst/* Maximum length of a principal (read: user name) */ 7722347Spst#define OPIE_PRINCIPAL_MAX 32 7822347Spst 7929967Sache#include <sys/cdefs.h> 8022347Spst 8123540Spst__BEGIN_DECLS 8222347Spstint opieaccessfile __P((char *)); 8322347Spstint rdnets __P((long)); 8422347Spstint isaddr __P((register char *)); 8522347Spstint opiealways __P((char *)); 8622347Spstchar *opieatob8 __P((char *,char *)); 8723540Spstvoid opiebackspace __P((char *)); 8822347Spstchar *opiebtoa8 __P((char *,char *)); 8922347Spstchar *opiebtoe __P((char *,char *)); 9022347Spstchar *opiebtoh __P((char *,char *)); 9122347Spstint opieetob __P((char *,char *)); 9222347Spstint opiechallenge __P((struct opie *,char *,char *)); 9322347Spstint opiegenerator __P((char *,char *,char *)); 9422347Spstint opiegetsequence __P((struct opie *)); 9523540Spstvoid opiehash __P((void *, unsigned)); 9622347Spstint opiehtoi __P((register char)); 9722347Spstint opiekeycrunch __P((int, char *, char *, char *)); 9822347Spstint opielock __P((char *)); 9959300Skrisint opieunlock __P((void)); 10059300Skrisvoid opieunlockaeh __P((void)); 10159300Skrisvoid opiedisableaeh __P((void)); 10222347Spstint opielookup __P((struct opie *,char *)); 10322347Spstint opiepasscheck __P((char *)); 10423540Spstvoid opierandomchallenge __P((char *)); 10522347Spstchar * opieskipspace __P((register char *)); 10623540Spstvoid opiestripcrlf __P((char *)); 10722347Spstint opieverify __P((struct opie *,char *)); 10829967Sacheint opiepasswd __P((struct opie *, int, char *, int, char *, char *)); 10922347Spstchar *opiereadpass __P((char *, int, int)); 11022347Spstint opielogin __P((char *line, char *name, char *host)); 11160572Skrisconst char *opie_get_algorithm __P((void)); 11260572Skrisint opie_haskey __P((char *username)); 11360572Skrischar *opie_keyinfo __P((char *)); 11460572Skrisint opie_passverify __P((char *username, char *passwd)); 11523540Spst__END_DECLS 11622347Spst 11729967Sache#if _OPIE 11829967Sache#define VOIDPTR void * 11929967Sache#define VOIDRET void 12029967Sache#define NOARGS void 12129967Sache#define FUNCTION(arglist, args) (args) 12229967Sache#define AND , 12329967Sache#define FUNCTION_NOARGS () 12429967Sache#define UINT4 u_int32_t 12523540Spst 12623540Spst__BEGIN_DECLS 12722347Spststruct utmp; 12829967Sacheint __opiegetutmpentry __P((char *, struct utmp *)); 12922347Spst#ifdef EOF 13022347SpstFILE *__opieopen __P((char *, int, int)); 13129967Sache#endif /* EOF */ 13229967Sacheint __opiereadrec __P((struct opie *)); 13329967Sacheint __opiewriterec __P((struct opie *)); 13459121Skrisint __opieparsechallenge __P((char *buffer, int *algorithm, int *sequence, char **seed, int *exts)); 13529972Sache__END_DECLS 13629967Sache#endif /* _OPIE */ 13759121Skris 13859121Skris#define OPIEPASSWD_CONSOLE 1 13959121Skris#define OPIEPASSWD_FORCE 2 14059121Skris 14122347Spst#endif /* _OPIE_H */ 142