xref: /netbsd-src/crypto/external/bsd/openssh/dist/hostfile.h (revision 413d532bcc3f62d122e56d92e13ac64825a40baf)
1 /*	$NetBSD: hostfile.h,v 1.5 2013/11/08 19:18:25 christos Exp $	*/
2 /* $OpenBSD: hostfile.h,v 1.20 2013/07/12 00:19:58 djm Exp $ */
3 
4 /*
5  * Author: Tatu Ylonen <ylo@cs.hut.fi>
6  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
7  *                    All rights reserved
8  *
9  * As far as I am concerned, the code I have written for this software
10  * can be used freely for any purpose.  Any derived versions of this
11  * software must be clearly marked as such, and if the derived work is
12  * incompatible with the protocol description in the RFC file, it must be
13  * called by a name other than "ssh" or "Secure Shell".
14  */
15 #ifndef HOSTFILE_H
16 #define HOSTFILE_H
17 
18 typedef enum {
19 	HOST_OK, HOST_NEW, HOST_CHANGED, HOST_REVOKED, HOST_FOUND
20 }       HostStatus;
21 
22 typedef enum {
23 	MRK_ERROR, MRK_NONE, MRK_REVOKE, MRK_CA
24 }	HostkeyMarker;
25 
26 struct hostkey_entry {
27 	char *host;
28 	char *file;
29 	u_long line;
30 	Key *key;
31 	HostkeyMarker marker;
32 };
33 struct hostkeys;
34 
35 struct hostkeys *init_hostkeys(void);
36 void	 load_hostkeys(struct hostkeys *, const char *, const char *);
37 void	 free_hostkeys(struct hostkeys *);
38 
39 HostStatus check_key_in_hostkeys(struct hostkeys *, Key *,
40     const struct hostkey_entry **);
41 int	 lookup_key_in_hostkeys_by_type(struct hostkeys *, int,
42     const struct hostkey_entry **);
43 
44 int	 hostfile_read_key(char **, int *, Key *);
45 int	 add_host_to_hostfile(const char *, const char *, const Key *, int);
46 
47 #define HASH_MAGIC	"|1|"
48 #define HASH_DELIM	'|'
49 
50 #define CA_MARKER	"@cert-authority"
51 #define REVOKE_MARKER	"@revoked"
52 
53 char	*host_hash(const char *, const char *, u_int);
54 
55 #endif
56