Tor  0.4.7.0-alpha-dev
Macros | Functions
keypin.h File Reference

Header for keypin.c. More...

#include "lib/testsupport/testsupport.h"

Go to the source code of this file.

Macros

#define KEYPIN_FOUND   0
 
#define KEYPIN_ADDED   1
 
#define KEYPIN_MISMATCH   -1
 
#define KEYPIN_NOT_FOUND   -2
 

Functions

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)
 
static int keypin_open_journal (const char *fname)
 
static int keypin_load_journal (const char *fname)
 
void keypin_clear (void)
 
int keypin_check_lone_rsa (const uint8_t *rsa_id_digest)
 

Detailed Description

Header for keypin.c.

Definition in file keypin.h.

Function Documentation

◆ keypin_check()

int keypin_check ( const uint8_t *  rsa_id_digest,
const uint8_t *  ed25519_id_key 
)

As keypin_check_and_add, but do not add. Return KEYPIN_NOT_FOUND if we would add.

Definition at line 153 of file keypin.c.

◆ keypin_check_and_add()

int keypin_check_and_add ( const uint8_t *  rsa_id_digest,
const uint8_t *  ed25519_id_key,
const int  replace_existing_entry 
)

Check whether we already have an entry in the key pinning table for a router with RSA ID digest rsa_id_digest or for ed25519 key ed25519_id_key. If we have an entry that matches both keys, return KEYPIN_FOUND. If we find an entry that matches one key but not the other, return KEYPIN_MISMATCH. If we have no entry for either key, add such an entry to the table and return KEYPIN_ADDED.

If replace_existing_entry is true, then any time we would have said KEYPIN_FOUND, we instead add this entry anyway and return KEYPIN_ADDED.

Definition at line 140 of file keypin.c.

◆ keypin_check_lone_rsa()

int keypin_check_lone_rsa ( const uint8_t *  rsa_id_digest)

Check whether we already have an entry in the key pinning table for a router with RSA ID digest rsa_id_digest. If we have no such entry, return KEYPIN_NOT_FOUND. If we find an entry that matches the RSA key but which has an ed25519 key, return KEYPIN_MISMATCH.

Definition at line 280 of file keypin.c.

◆ keypin_clear()

void keypin_clear ( void  )

Remove all entries from the keypinning table.

Definition at line 487 of file keypin.c.

◆ keypin_close_journal()

int keypin_close_journal ( void  )

Close the keypinning journal file.

Definition at line 335 of file keypin.c.