Home | History | Annotate | Line # | Download | only in libskey
skey.h revision 1.9
      1 /*	$NetBSD: skey.h,v 1.9 2005/02/04 16:12:13 perry Exp $	*/
      2 
      3 /*
      4  * S/KEY v1.1b (skey.h)
      5  *
      6  * Authors:
      7  *          Neil M. Haller <nmh (at) thumper.bellcore.com>
      8  *          Philip R. Karn <karn (at) chicago.qualcomm.com>
      9  *          John S. Walden <jsw (at) thumper.bellcore.com>
     10  *
     11  * Modifications:
     12  *          Scott Chasin <chasin (at) crimelab.com>
     13  *          Todd C. Miller <Todd.Miller (at) courtesan.com>
     14  *
     15  * Main client header
     16  */
     17 
     18 /* Server-side data structure for reading keys file during login */
     19 struct skey {
     20   FILE *keyfile;
     21   char buf[256];
     22   char *logname;
     23   int n;
     24   char *seed;
     25   char *val;
     26   long recstart;		/* needed so reread of buffer is efficient */
     27 };
     28 
     29 /* Client-side structure for scanning data stream for challenge */
     30 struct mc {
     31   char buf[256];
     32   int skip;
     33   int cnt;
     34 };
     35 
     36 /* Maximum sequence number we allow */
     37 #ifndef SKEY_MAX_SEQ
     38 #define SKEY_MAX_SEQ		10000
     39 #endif
     40 
     41 /* Minimum secret password length (rfc2289) */
     42 #ifndef SKEY_MIN_PW_LEN
     43 #define SKEY_MIN_PW_LEN		10
     44 #endif
     45 
     46 /* Max secret password length (rfc2289 says 63 but allows more) */
     47 #ifndef SKEY_MAX_PW_LEN
     48 #define SKEY_MAX_PW_LEN		255
     49 #endif
     50 
     51 /* Max length of an S/Key seed (rfc2289) */
     52 #ifndef SKEY_MAX_SEED_LEN
     53 #define SKEY_MAX_SEED_LEN	16
     54 #endif
     55 
     56 /* Max length of S/Key challenge (otp-???? 9999 seed) */
     57 #ifndef SKEY_MAX_CHALLENGE
     58 #define SKEY_MAX_CHALLENGE     (11 + SKEY_MAX_HASHNAME_LEN + SKEY_MAX_SEED_LEN)
     59 #endif
     60 
     61 /* Max length of hash algorithm name (md4/md5/sha1/rmd160) */
     62 #define SKEY_MAX_HASHNAME_LEN	6
     63 
     64 /* Size of a binary key (not NULL-terminated) */
     65 #define SKEY_BINKEY_SIZE	8
     66 
     67 /* Location of random file for bogus challenges */
     68 #define _SKEY_RAND_FILE_PATH_	"/var/db/host.random"
     69 
     70 /* Prototypes */
     71 void f(char *);
     72 int keycrunch(char *, const char *, const char *);
     73 char *btoe(char *, const char *);
     74 char *put8(char *, const char *);
     75 int etob(char *, const char *);
     76 void rip(char *);
     77 int skeychallenge(struct skey *, const char *, char *, size_t);
     78 int skeylookup(struct skey *, const char *);
     79 int skeyverify(struct skey *, char *);
     80 void sevenbit(char *);
     81 void backspace(char *);
     82 const char *skipspace(const char *);
     83 char *readpass(char *, int);
     84 char *readskey(char *, int);
     85 int skey_authenticate(const char *);
     86 int skey_passcheck(const char *, char *);
     87 const char *skey_keyinfo(const char *);
     88 int skey_haskey(const char *);
     89 int getskeyprompt(struct skey *, char *, char *);
     90 int atob8(char *, const char *);
     91 int btoa8(char *, const char *);
     92 int htoi(int);
     93 const char *skey_get_algorithm(void);
     94 const char *skey_set_algorithm(const char *);
     95 int skeygetnext(struct skey *);
     96 int skeyzero(struct skey *, char *);
     97