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