relay: Silence compiler warnings when relay mode is disabled

Part of 32123.
This commit is contained in:
teor 2019-10-18 14:16:24 +10:00
parent 57e86a6d74
commit e2280d6f84
No known key found for this signature in database
GPG Key ID: 10FEAA0E7075672A
2 changed files with 10 additions and 0 deletions

View File

@ -372,6 +372,8 @@ assert_identity_keys_ok(void)
} }
} }
#ifdef HAVE_MODULE_RELAY
/** Returns the current server identity key; requires that the key has /** Returns the current server identity key; requires that the key has
* been set, and that we are running as a Tor server. * been set, and that we are running as a Tor server.
*/ */
@ -384,6 +386,8 @@ get_server_identity_key,(void))
return server_identitykey; return server_identitykey;
} }
#endif
/** Return true iff we are a server and the server identity key /** Return true iff we are a server and the server identity key
* has been set. */ * has been set. */
int int

View File

@ -28,7 +28,13 @@ struct ed25519_keypair_t;
MOCK_DECL(crypto_pk_t *,get_onion_key,(void)); MOCK_DECL(crypto_pk_t *,get_onion_key,(void));
time_t get_onion_key_set_at(void); time_t get_onion_key_set_at(void);
void set_server_identity_key(crypto_pk_t *k); void set_server_identity_key(crypto_pk_t *k);
/* Some compilers are clever enough to know that when relay mode is disabled,
* this function never returns. */
#ifdef HAVE_MODULE_RELAY
MOCK_DECL(crypto_pk_t *,get_server_identity_key,(void)); MOCK_DECL(crypto_pk_t *,get_server_identity_key,(void));
#else
#define get_server_identity_key() (tor_abort_(),NULL)
#endif
int server_identity_key_is_set(void); int server_identity_key_is_set(void);
void set_client_identity_key(crypto_pk_t *k); void set_client_identity_key(crypto_pk_t *k);
crypto_pk_t *get_tlsclient_identity_key(void); crypto_pk_t *get_tlsclient_identity_key(void);