tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

relay_handshake.h (2423B)


      1 /* Copyright (c) 2001 Matej Pfajfar.
      2 * Copyright (c) 2001-2004, Roger Dingledine.
      3 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
      4 * Copyright (c) 2007-2021, The Tor Project, Inc. */
      5 /* See LICENSE for licensing information */
      6 
      7 /**
      8 * @file relay_handshake.h
      9 * @brief Header for feature/relay/relay_handshake.c
     10 **/
     11 
     12 #ifndef TOR_CORE_OR_RELAY_HANDSHAKE_H
     13 #define TOR_CORE_OR_RELAY_HANDSHAKE_H
     14 
     15 #ifdef HAVE_MODULE_RELAY
     16 struct ed25519_keypair_t;
     17 
     18 int connection_or_send_certs_cell(or_connection_t *conn);
     19 int connection_or_send_auth_challenge_cell(or_connection_t *conn);
     20 
     21 var_cell_t *connection_or_compute_authenticate_cell_body(
     22                              or_connection_t *conn,
     23                              const int authtype,
     24                              const struct ed25519_keypair_t *ed_signing_key,
     25                              int server);
     26 
     27 int authchallenge_type_is_supported(uint16_t challenge_type);
     28 int authchallenge_type_is_better(uint16_t challenge_type_a,
     29                                 uint16_t challenge_type_b);
     30 
     31 MOCK_DECL(int,connection_or_send_authenticate_cell,
     32          (or_connection_t *conn, int type));
     33 
     34 #ifdef TOR_UNIT_TESTS
     35 extern int certs_cell_ed25519_disabled_for_testing;
     36 #endif
     37 #else /* !defined(HAVE_MODULE_RELAY) */
     38 
     39 static inline int
     40 connection_or_send_certs_cell(or_connection_t *conn)
     41 {
     42  (void)conn;
     43  tor_assert_nonfatal_unreached();
     44  return -1;
     45 }
     46 static inline int
     47 connection_or_send_auth_challenge_cell(or_connection_t *conn)
     48 {
     49  (void)conn;
     50  tor_assert_nonfatal_unreached();
     51  return -1;
     52 }
     53 
     54 static inline var_cell_t *
     55 connection_or_compute_authenticate_cell_body(
     56                              or_connection_t *conn,
     57                              const int authtype,
     58                              const struct ed25519_keypair_t *ed_signing_key,
     59                              int server)
     60 {
     61  (void)conn;
     62  (void)authtype;
     63  (void)ed_signing_key;
     64  (void)server;
     65  tor_assert_nonfatal_unreached();
     66  return NULL;
     67 }
     68 
     69 #define authchallenge_type_is_supported(t) (0)
     70 #define authchallenge_type_is_better(a, b) (0)
     71 
     72 static inline int
     73 connection_or_send_authenticate_cell(or_connection_t *conn, int type)
     74 {
     75  (void)conn;
     76  (void)type;
     77  tor_assert_nonfatal_unreached();
     78  return -1;
     79 }
     80 
     81 #ifdef TOR_UNIT_TESTS
     82 extern int certs_cell_ed25519_disabled_for_testing;
     83 #endif
     84 
     85 #endif /* defined(HAVE_MODULE_RELAY) */
     86 
     87 #endif /* !defined(TOR_CORE_OR_RELAY_HANDSHAKE_H) */