1997-02-06 18:52:29 +01:00
|
|
|
/* opie.h: Data structures and values for the OPIE authentication
|
|
|
|
system that a program might need.
|
|
|
|
|
1997-09-29 12:33:14 +02:00
|
|
|
%%% portions-copyright-cmetz-96
|
2002-03-22 00:42:52 +01:00
|
|
|
Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
|
1997-02-06 18:52:29 +01:00
|
|
|
Reserved. The Inner Net License Version 2 applies to these portions of
|
|
|
|
the software.
|
|
|
|
You should have received a copy of the license with this software. If
|
|
|
|
you didn't get a copy, you may request one from <license@inner.net>.
|
|
|
|
|
|
|
|
Portions of this software are Copyright 1995 by Randall Atkinson and Dan
|
|
|
|
McDonald, All Rights Reserved. All Rights under this copyright are assigned
|
|
|
|
to the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and
|
|
|
|
License Agreement applies to this software.
|
|
|
|
|
|
|
|
History:
|
|
|
|
|
2002-03-22 00:42:52 +01:00
|
|
|
Modified by cmetz for OPIE 2.4. Added sequence number limits. Added
|
|
|
|
struct opie_otpkey and made many functions use it. Added
|
|
|
|
opiestrncpy(). Include header with libmissing prototypes.
|
2000-04-10 13:18:54 +02:00
|
|
|
Modified by cmetz for OPIE 2.32. Added symbolic flag names for
|
|
|
|
opiepasswd(). Added __opieparsechallenge() prototype.
|
1997-09-29 12:33:14 +02:00
|
|
|
Modified by cmetz for OPIE 2.31. Removed active attack protection.
|
1997-02-06 18:52:29 +01:00
|
|
|
Modified by cmetz for OPIE 2.3. Renamed PTR to VOIDPTR. Added
|
|
|
|
re-init key and extension file fields to struct opie. Added
|
|
|
|
opie_ prefix on struct opie members. Added opie_flags field
|
|
|
|
and definitions. Added more prototypes. Changed opiehash()
|
|
|
|
prototype.
|
|
|
|
Modified by cmetz for OPIE 2.22. Define __P correctly if this file
|
|
|
|
is included in a third-party program.
|
|
|
|
Modified by cmetz for OPIE 2.2. Re-did prototypes. Added FUNCTION
|
|
|
|
definition et al. Multiple-include protection. Added struct
|
|
|
|
utsname fake. Got rid of gethostname() cruft. Moved UINT4
|
|
|
|
here. Provide for *seek whence values. Move MDx context here
|
|
|
|
and unify. Re-did prototypes.
|
|
|
|
Modified at NRL for OPIE 2.0.
|
|
|
|
Written at Bellcore for the S/Key Version 1 software distribution
|
|
|
|
(skey.h).
|
2000-04-10 13:18:54 +02:00
|
|
|
|
|
|
|
$FreeBSD$
|
1997-02-06 18:52:29 +01:00
|
|
|
*/
|
|
|
|
#ifndef _OPIE_H
|
1997-09-29 12:33:14 +02:00
|
|
|
#define _OPIE_H 1
|
1997-02-06 18:52:29 +01:00
|
|
|
|
|
|
|
struct opie {
|
|
|
|
int opie_flags;
|
|
|
|
char opie_buf[256];
|
|
|
|
char *opie_principal;
|
|
|
|
int opie_n;
|
|
|
|
char *opie_seed;
|
|
|
|
char *opie_val;
|
|
|
|
long opie_recstart;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define __OPIE_FLAGS_RW 1
|
|
|
|
#define __OPIE_FLAGS_READ 2
|
|
|
|
|
|
|
|
/* Minimum length of a secret password */
|
2002-03-22 00:42:52 +01:00
|
|
|
#ifndef OPIE_SECRET_MIN
|
1997-02-06 18:52:29 +01:00
|
|
|
#define OPIE_SECRET_MIN 10
|
2002-03-22 00:42:52 +01:00
|
|
|
#endif /* OPIE_SECRET_MIN */
|
1997-02-06 18:52:29 +01:00
|
|
|
|
|
|
|
/* Maximum length of a secret password */
|
|
|
|
#define OPIE_SECRET_MAX 127
|
|
|
|
|
|
|
|
/* Minimum length of a seed */
|
|
|
|
#define OPIE_SEED_MIN 5
|
|
|
|
|
|
|
|
/* Maximum length of a seed */
|
|
|
|
#define OPIE_SEED_MAX 16
|
|
|
|
|
2000-05-15 06:20:54 +02:00
|
|
|
/* Max length of hash algorithm name (md4/md5) */
|
|
|
|
#define OPIE_HASHNAME_MAX 3
|
|
|
|
|
1997-02-06 18:52:29 +01:00
|
|
|
/* Maximum length of a challenge (otp-md? 9999 seed) */
|
2000-05-15 06:20:54 +02:00
|
|
|
#define OPIE_CHALLENGE_MAX (4+OPIE_HASHNAME_MAX+1+4+1+OPIE_SEED_MAX)
|
1997-02-06 18:52:29 +01:00
|
|
|
|
|
|
|
/* Maximum length of a response that we allow */
|
|
|
|
#define OPIE_RESPONSE_MAX (9+1+19+1+9+OPIE_SEED_MAX+1+19+1+19+1+19)
|
|
|
|
|
|
|
|
/* Maximum length of a principal (read: user name) */
|
|
|
|
#define OPIE_PRINCIPAL_MAX 32
|
|
|
|
|
2002-03-22 00:42:52 +01:00
|
|
|
/* Maximum sequence number */
|
|
|
|
#ifndef OPIE_SEQUENCE_MAX
|
|
|
|
#define OPIE_SEQUENCE_MAX 9999
|
|
|
|
#endif /* OPIE_SEQUENCE_MAX */
|
|
|
|
|
|
|
|
/* Restricted sequence number */
|
|
|
|
#ifndef OPIE_SEQUENCE_RESTRICT
|
|
|
|
#define OPIE_SEQUENCE_RESTRICT 9
|
|
|
|
#endif /* OPIE_SEQUENCE_RESTRICT */
|
|
|
|
|
|
|
|
#define UINT4 u_int32_t
|
|
|
|
|
|
|
|
struct opie_otpkey {
|
|
|
|
UINT4 words[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifndef SEEK_SET
|
|
|
|
#define SEEK_SET 0
|
|
|
|
#endif /* SEEK_SET */
|
|
|
|
|
|
|
|
#ifndef SEEK_END
|
|
|
|
#define SEEK_END 2
|
|
|
|
#endif /* SEEK_END */
|
1997-02-06 18:52:29 +01:00
|
|
|
|
1997-03-08 20:42:17 +01:00
|
|
|
__BEGIN_DECLS
|
1997-02-06 18:52:29 +01:00
|
|
|
int opieaccessfile __P((char *));
|
|
|
|
int rdnets __P((long));
|
|
|
|
int isaddr __P((register char *));
|
|
|
|
int opiealways __P((char *));
|
2002-03-22 00:42:52 +01:00
|
|
|
char *opieatob8 __P((struct opie_otpkey *, char *));
|
1997-03-08 20:42:17 +01:00
|
|
|
void opiebackspace __P((char *));
|
2002-03-22 00:42:52 +01:00
|
|
|
char *opiebtoa8 __P((char *, struct opie_otpkey *));
|
|
|
|
char *opiebtoe __P((char *, struct opie_otpkey *));
|
|
|
|
char *opiebtoh __P((char *, struct opie_otpkey *));
|
|
|
|
int opieetob __P((struct opie_otpkey *, char *));
|
1997-02-06 18:52:29 +01:00
|
|
|
int opiechallenge __P((struct opie *,char *,char *));
|
|
|
|
int opiegenerator __P((char *,char *,char *));
|
|
|
|
int opiegetsequence __P((struct opie *));
|
2002-03-22 00:42:52 +01:00
|
|
|
void opiehash __P((struct opie_otpkey *, unsigned));
|
1997-02-06 18:52:29 +01:00
|
|
|
int opiehtoi __P((register char));
|
2002-03-22 00:42:52 +01:00
|
|
|
int opiekeycrunch __P((int, struct opie_otpkey *, char *, char *));
|
1997-02-06 18:52:29 +01:00
|
|
|
int opielock __P((char *));
|
2000-04-17 02:01:23 +02:00
|
|
|
int opieunlock __P((void));
|
|
|
|
void opieunlockaeh __P((void));
|
|
|
|
void opiedisableaeh __P((void));
|
1997-02-06 18:52:29 +01:00
|
|
|
int opielookup __P((struct opie *,char *));
|
|
|
|
int opiepasscheck __P((char *));
|
2013-10-28 19:24:31 +01:00
|
|
|
int opienewseed __P((char *));
|
1997-03-08 20:42:17 +01:00
|
|
|
void opierandomchallenge __P((char *));
|
1997-02-06 18:52:29 +01:00
|
|
|
char * opieskipspace __P((register char *));
|
1997-03-08 20:42:17 +01:00
|
|
|
void opiestripcrlf __P((char *));
|
1997-02-06 18:52:29 +01:00
|
|
|
int opieverify __P((struct opie *,char *));
|
1997-09-29 12:33:14 +02:00
|
|
|
int opiepasswd __P((struct opie *, int, char *, int, char *, char *));
|
1997-02-06 18:52:29 +01:00
|
|
|
char *opiereadpass __P((char *, int, int));
|
|
|
|
int opielogin __P((char *line, char *name, char *host));
|
2000-05-15 06:20:54 +02:00
|
|
|
const char *opie_get_algorithm __P((void));
|
|
|
|
int opie_haskey __P((char *username));
|
|
|
|
char *opie_keyinfo __P((char *));
|
|
|
|
int opie_passverify __P((char *username, char *passwd));
|
2013-10-28 19:24:31 +01:00
|
|
|
int opieinsecure __P((void));
|
|
|
|
void opieversion __P((void));
|
1997-03-08 20:42:17 +01:00
|
|
|
__END_DECLS
|
1997-02-06 18:52:29 +01:00
|
|
|
|
1997-09-29 12:33:14 +02:00
|
|
|
#if _OPIE
|
|
|
|
#define VOIDPTR void *
|
|
|
|
#define VOIDRET void
|
|
|
|
#define NOARGS void
|
|
|
|
#define FUNCTION(arglist, args) (args)
|
|
|
|
#define AND ,
|
|
|
|
#define FUNCTION_NOARGS ()
|
1997-03-08 20:42:17 +01:00
|
|
|
|
|
|
|
__BEGIN_DECLS
|
1997-02-06 18:52:29 +01:00
|
|
|
struct utmp;
|
1997-09-29 12:33:14 +02:00
|
|
|
int __opiegetutmpentry __P((char *, struct utmp *));
|
1997-02-06 18:52:29 +01:00
|
|
|
#ifdef EOF
|
|
|
|
FILE *__opieopen __P((char *, int, int));
|
1997-09-29 12:33:14 +02:00
|
|
|
#endif /* EOF */
|
|
|
|
int __opiereadrec __P((struct opie *));
|
|
|
|
int __opiewriterec __P((struct opie *));
|
2000-04-10 13:18:54 +02:00
|
|
|
int __opieparsechallenge __P((char *buffer, int *algorithm, int *sequence, char **seed, int *exts));
|
2013-10-28 19:24:31 +01:00
|
|
|
VOIDRET opiehashlen __P((int algorithm, VOIDPTR in, struct opie_otpkey *out, int n));
|
1997-09-29 12:33:14 +02:00
|
|
|
__END_DECLS
|
2002-03-22 00:42:52 +01:00
|
|
|
|
|
|
|
#define opiestrncpy(dst, src, n) \
|
|
|
|
do { \
|
|
|
|
strncpy(dst, src, n-1); \
|
|
|
|
dst[n-1] = 0; \
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
/* #include "missing.h" */
|
1997-09-29 12:58:53 +02:00
|
|
|
#endif /* _OPIE */
|
2000-04-10 13:18:54 +02:00
|
|
|
|
|
|
|
#define OPIEPASSWD_CONSOLE 1
|
|
|
|
#define OPIEPASSWD_FORCE 2
|
|
|
|
|
1997-02-06 18:52:29 +01:00
|
|
|
#endif /* _OPIE_H */
|