blob: 881f010f0e90f298d8c873a30d3758adf9ef58d1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/* Copyright (c) 2014-2020, The Tor Project, Inc. */
/* See LICENSE for licensing information */
/**
* @file keypin.h
* @brief Header for keypin.c
**/
#ifndef TOR_KEYPIN_H
#define TOR_KEYPIN_H
#include "lib/testsupport/testsupport.h"
int keypin_check_and_add(const uint8_t *rsa_id_digest,
const uint8_t *ed25519_id_key,
const int replace_existing_entry);
int keypin_check(const uint8_t *rsa_id_digest,
const uint8_t *ed25519_id_key);
int keypin_close_journal(void);
#ifdef HAVE_MODULE_DIRAUTH
int keypin_open_journal(const char *fname);
int keypin_load_journal(const char *fname);
#else
static inline int
keypin_open_journal(const char *fname)
{
(void)fname;
return 0;
}
static inline int
keypin_load_journal(const char *fname)
{
(void)fname;
return 0;
}
#endif /* defined(HAVE_MODULE_DIRAUTH) */
void keypin_clear(void);
int keypin_check_lone_rsa(const uint8_t *rsa_id_digest);
#define KEYPIN_FOUND 0
#define KEYPIN_ADDED 1
#define KEYPIN_MISMATCH -1
#define KEYPIN_NOT_FOUND -2
#ifdef KEYPIN_PRIVATE
#include "ext/ht.h"
/**
* In-memory representation of a key-pinning table entry.
*/
typedef struct keypin_ent_st {
HT_ENTRY(keypin_ent_st) rsamap_node;
HT_ENTRY(keypin_ent_st) edmap_node;
/** SHA1 hash of the RSA key */
uint8_t rsa_id[DIGEST_LEN];
/** Ed2219 key. */
uint8_t ed25519_key[DIGEST256_LEN];
} keypin_ent_t;
STATIC keypin_ent_t * keypin_parse_journal_line(const char *cp);
STATIC int keypin_load_journal_impl(const char *data, size_t size);
MOCK_DECL(STATIC void, keypin_add_entry_to_map, (keypin_ent_t *ent));
#endif /* defined(KEYPIN_PRIVATE) */
#endif /* !defined(TOR_KEYPIN_H) */
|