summaryrefslogtreecommitdiff
path: root/changes/bug23512
blob: 91b2786de4394fb568ef5406e21562e27a949803 (plain)
1
2
3
4
5
6
  o Major bugfix (Relay bandwidth statistics):
    - When we close relayed circuits, report the data in the circuit queues
      as being written in our relay bandwidth stats. This mitigates guard
      discovery and other attacks that close circuits for the explicit purpose
      of noticing this discrepancy in statistics. Fixes bug 23512; bugfix
      on 0.0.8pre3.
.s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/* Copyright (c) 2014, The Tor Project, Inc. */
/* See LICENSE for licensing information */

#ifndef TOR_KEYPIN_H
#define TOR_KEYPIN_H

#include "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_open_journal(const char *fname);
int keypin_close_journal(void);
int keypin_load_journal(const char *fname);
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

/**
 * 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

#endif