Lines Matching refs:hostkeys

215 struct hostkeys *
218 struct hostkeys *ret = xcalloc(1, sizeof(*ret)); in init_hostkeys()
227 struct hostkeys *hostkeys; member
234 struct hostkeys *hostkeys = ctx->hostkeys; in record_hostkey() local
248 if ((tmp = recallocarray(hostkeys->entries, hostkeys->num_entries, in record_hostkey()
249 hostkeys->num_entries + 1, sizeof(*hostkeys->entries))) == NULL) in record_hostkey()
251 hostkeys->entries = tmp; in record_hostkey()
252 hostkeys->entries[hostkeys->num_entries].host = xstrdup(ctx->host); in record_hostkey()
253 hostkeys->entries[hostkeys->num_entries].file = xstrdup(l->path); in record_hostkey()
254 hostkeys->entries[hostkeys->num_entries].line = l->linenum; in record_hostkey()
255 hostkeys->entries[hostkeys->num_entries].key = l->key; in record_hostkey()
257 hostkeys->entries[hostkeys->num_entries].marker = l->marker; in record_hostkey()
258 hostkeys->entries[hostkeys->num_entries].note = l->note; in record_hostkey()
259 hostkeys->num_entries++; in record_hostkey()
266 load_hostkeys_file(struct hostkeys *hostkeys, const char *host, in load_hostkeys_file() argument
274 ctx.hostkeys = hostkeys; in load_hostkeys_file()
286 load_hostkeys(struct hostkeys *hostkeys, const char *host, const char *path, in load_hostkeys() argument
296 load_hostkeys_file(hostkeys, host, path, f, note); in load_hostkeys()
301 free_hostkeys(struct hostkeys *hostkeys) in free_hostkeys() argument
305 for (i = 0; i < hostkeys->num_entries; i++) { in free_hostkeys()
306 free(hostkeys->entries[i].host); in free_hostkeys()
307 free(hostkeys->entries[i].file); in free_hostkeys()
308 sshkey_free(hostkeys->entries[i].key); in free_hostkeys()
309 explicit_bzero(hostkeys->entries + i, sizeof(*hostkeys->entries)); in free_hostkeys()
311 free(hostkeys->entries); in free_hostkeys()
312 freezero(hostkeys, sizeof(*hostkeys)); in free_hostkeys()
316 check_key_not_revoked(struct hostkeys *hostkeys, struct sshkey *k) in check_key_not_revoked() argument
321 for (i = 0; i < hostkeys->num_entries; i++) { in check_key_not_revoked()
322 if (hostkeys->entries[i].marker != MRK_REVOKE) in check_key_not_revoked()
324 if (sshkey_equal_public(k, hostkeys->entries[i].key)) in check_key_not_revoked()
328 hostkeys->entries[i].key)) in check_key_not_revoked()
350 check_hostkeys_by_key_or_type(struct hostkeys *hostkeys, in check_hostkeys_by_key_or_type() argument
361 for (i = 0; i < hostkeys->num_entries; i++) { in check_hostkeys_by_key_or_type()
362 if (hostkeys->entries[i].marker != want_marker) in check_hostkeys_by_key_or_type()
365 if (hostkeys->entries[i].key->type != keytype) in check_hostkeys_by_key_or_type()
369 hostkeys->entries[i].key->ecdsa_nid != nid) in check_hostkeys_by_key_or_type()
373 *found = hostkeys->entries + i; in check_hostkeys_by_key_or_type()
374 k = hostkeys->entries[i].key; in check_hostkeys_by_key_or_type()
379 hostkeys->entries[i].key)) { in check_hostkeys_by_key_or_type()
383 *found = hostkeys->entries + i; in check_hostkeys_by_key_or_type()
387 if (sshkey_equal(k, hostkeys->entries[i].key)) { in check_hostkeys_by_key_or_type()
390 *found = hostkeys->entries + i; in check_hostkeys_by_key_or_type()
396 *found = hostkeys->entries + i; in check_hostkeys_by_key_or_type()
399 if (check_key_not_revoked(hostkeys, k) != 0) { in check_hostkeys_by_key_or_type()
408 check_key_in_hostkeys(struct hostkeys *hostkeys, struct sshkey *key, in check_key_in_hostkeys() argument
413 return check_hostkeys_by_key_or_type(hostkeys, key, 0, -1, found); in check_key_in_hostkeys()
417 lookup_key_in_hostkeys_by_type(struct hostkeys *hostkeys, int keytype, int nid, in lookup_key_in_hostkeys_by_type() argument
420 return (check_hostkeys_by_key_or_type(hostkeys, NULL, keytype, nid, in lookup_key_in_hostkeys_by_type()
425 lookup_marker_in_hostkeys(struct hostkeys *hostkeys, int want_marker) in lookup_marker_in_hostkeys() argument
429 for (i = 0; i < hostkeys->num_entries; i++) { in lookup_marker_in_hostkeys()
430 if (hostkeys->entries[i].marker == (HostkeyMarker)want_marker) in lookup_marker_in_hostkeys()