Home | History | Annotate | Line # | Download | only in libskey
skey.h revision 1.7
      1 /*	$NetBSD: skey.h,v 1.7 2000/07/06 22:30:19 mjl 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 {
     21   FILE *keyfile;
     22   char buf[256];
     23   char *logname;
     24   int n;
     25   char *seed;
     26   char *val;
     27   long recstart;		/* needed so reread of buffer is efficient */
     28 };
     29 
     30 /* Client-side structure for scanning data stream for challenge */
     31 struct mc
     32 {
     33   char buf[256];
     34   int skip;
     35   int cnt;
     36 };
     37 
     38 /* Maximum sequence number we allow */
     39 #ifndef SKEY_MAX_SEQ
     40 #define SKEY_MAX_SEQ           10000
     41 #endif
     42 
     43 /* Minimum secret password length (rfc2289) */
     44 #ifndef SKEY_MIN_PW_LEN
     45 #define SKEY_MIN_PW_LEN                10
     46 #endif
     47 
     48 /* Max secret password length (rfc2289 says 63 but allows more) */
     49 #ifndef SKEY_MAX_PW_LEN
     50 #define SKEY_MAX_PW_LEN                255
     51 #endif
     52 
     53 /* Max length of an S/Key seed (rfc2289) */
     54 #ifndef SKEY_MAX_SEED_LEN
     55 #define SKEY_MAX_SEED_LEN  	 16
     56 #endif
     57 
     58 /* Max length of S/Key challenge (otp-???? 9999 seed) */
     59 #ifndef SKEY_MAX_CHALLENGE
     60 #define SKEY_MAX_CHALLENGE 	 (11 + SKEY_MAX_HASHNAME_LEN + SKEY_MAX_SEED_LEN)
     61 #endif
     62 
     63 /* Max length of hash algorithm name (md4/md5/sha1/rmd160) */
     64 #define SKEY_MAX_HASHNAME_LEN  6
     65 
     66 /* Size of a binary key (not NULL-terminated) */
     67 #define SKEY_BINKEY_SIZE		 8
     68 
     69 /* Location of random file for bogus challenges */
     70 #define _SKEY_RAND_FILE_PATH_  "/var/db/host.random"
     71 
     72 /* Prototypes */
     73 void f __P ((char *));
     74 int keycrunch __P ((char *, const char *, const char *));
     75 char *btoe __P ((char *, const char *));
     76 char *put8 __P ((char *, const char *));
     77 int etob __P ((char *, const char *));
     78 void rip __P ((char *));
     79 int skeychallenge __P ((struct skey *, const char *, char *, size_t));
     80 int skeylookup __P ((struct skey *, const char *));
     81 int skeyverify __P ((struct skey *, char *));
     82 void sevenbit __P ((char *));
     83 void backspace __P ((char *));
     84 const char *skipspace __P ((const char *));
     85 char *readpass __P ((char *, int));
     86 char *readskey __P ((char *, int));
     87 int skey_authenticate __P ((const char *));
     88 int skey_passcheck __P ((const char *, char *));
     89 char *skey_keyinfo __P ((const char *));
     90 int skey_haskey __P ((const char *));
     91 int getskeyprompt __P ((struct skey *, char *, char *));
     92 int atob8 __P((char *, const char *));
     93 int btoa8 __P((char *, const char *));
     94 int htoi __P((int));
     95 const char *skey_get_algorithm __P((void));
     96 const char *skey_set_algorithm __P((const char *));
     97 int skeygetnext __P((struct skey *));
     98 int skeyzero __P((struct skey *, char *));
     99