1255767Sdes/* $OpenBSD: hostfile.h,v 1.20 2013/07/12 00:19:58 djm Exp $ */ 276259Sgreen 365668Skris/* 465668Skris * Author: Tatu Ylonen <ylo@cs.hut.fi> 565668Skris * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 665668Skris * All rights reserved 765668Skris * 865668Skris * As far as I am concerned, the code I have written for this software 965668Skris * can be used freely for any purpose. Any derived versions of this 1065668Skris * software must be clearly marked as such, and if the derived work is 1165668Skris * incompatible with the protocol description in the RFC file, it must be 1265668Skris * called by a name other than "ssh" or "Secure Shell". 1365668Skris */ 1458582Skris#ifndef HOSTFILE_H 1558582Skris#define HOSTFILE_H 1658582Skris 1758582Skristypedef enum { 18204917Sdes HOST_OK, HOST_NEW, HOST_CHANGED, HOST_REVOKED, HOST_FOUND 1958582Skris} HostStatus; 2076259Sgreen 21221420Sdestypedef enum { 22221420Sdes MRK_ERROR, MRK_NONE, MRK_REVOKE, MRK_CA 23221420Sdes} HostkeyMarker; 24221420Sdes 25221420Sdesstruct hostkey_entry { 26221420Sdes char *host; 27221420Sdes char *file; 28221420Sdes u_long line; 29221420Sdes Key *key; 30221420Sdes HostkeyMarker marker; 31221420Sdes}; 32221420Sdesstruct hostkeys; 33221420Sdes 34221420Sdesstruct hostkeys *init_hostkeys(void); 35221420Sdesvoid load_hostkeys(struct hostkeys *, const char *, const char *); 36221420Sdesvoid free_hostkeys(struct hostkeys *); 37221420Sdes 38221420SdesHostStatus check_key_in_hostkeys(struct hostkeys *, Key *, 39221420Sdes const struct hostkey_entry **); 40221420Sdesint lookup_key_in_hostkeys_by_type(struct hostkeys *, int, 41221420Sdes const struct hostkey_entry **); 42221420Sdes 43255767Sdesint hostfile_read_key(char **, int *, Key *); 44221420Sdesint add_host_to_hostfile(const char *, const char *, const Key *, int); 4558582Skris 46146998Sdes#define HASH_MAGIC "|1|" 47146998Sdes#define HASH_DELIM '|' 48146998Sdes 49204917Sdes#define CA_MARKER "@cert-authority" 50204917Sdes#define REVOKE_MARKER "@revoked" 51204917Sdes 52146998Sdeschar *host_hash(const char *, const char *, u_int); 53146998Sdes 5458582Skris#endif 55