1 /* Copyright (c) 2014-2021, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
6 * @brief Header for keypin.c
12 #include "lib/testsupport/testsupport.h"
14 int keypin_check_and_add(const uint8_t *rsa_id_digest
,
15 const uint8_t *ed25519_id_key
,
16 const int replace_existing_entry
);
17 int keypin_check(const uint8_t *rsa_id_digest
,
18 const uint8_t *ed25519_id_key
);
19 int keypin_close_journal(void);
21 #ifdef HAVE_MODULE_DIRAUTH
22 int keypin_open_journal(const char *fname
);
23 int keypin_load_journal(const char *fname
);
26 keypin_open_journal(const char *fname
)
32 keypin_load_journal(const char *fname
)
37 #endif /* defined(HAVE_MODULE_DIRAUTH) */
38 void keypin_clear(void);
39 int keypin_check_lone_rsa(const uint8_t *rsa_id_digest
);
41 #define KEYPIN_FOUND 0
42 #define KEYPIN_ADDED 1
43 #define KEYPIN_MISMATCH -1
44 #define KEYPIN_NOT_FOUND -2
51 * In-memory representation of a key-pinning table entry.
53 typedef struct keypin_ent_st
{
54 HT_ENTRY(keypin_ent_st
) rsamap_node
;
55 HT_ENTRY(keypin_ent_st
) edmap_node
;
56 /** SHA1 hash of the RSA key */
57 uint8_t rsa_id
[DIGEST_LEN
];
59 uint8_t ed25519_key
[DIGEST256_LEN
];
62 STATIC keypin_ent_t
* keypin_parse_journal_line(const char *cp
);
63 STATIC
int keypin_load_journal_impl(const char *data
, size_t size
);
65 MOCK_DECL(STATIC
void, keypin_add_entry_to_map
, (keypin_ent_t
*ent
));
66 #endif /* defined(KEYPIN_PRIVATE) */
68 #endif /* !defined(TOR_KEYPIN_H) */