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