diff options
author | Suphanat Chunhapanya <haxx.pop@gmail.com> | 2018-08-19 08:26:43 +0700 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2018-09-07 13:59:22 -0400 |
commit | 9c362192361bec379f83f37426236b41c2a17e8e (patch) | |
tree | c305d490b88392182033337c04b8cdcd8c80f3cf /src/feature | |
parent | 8e81fcd51ae9b9b373f0254381728a8f4d93236d (diff) | |
download | tor-9c362192361bec379f83f37426236b41c2a17e8e.tar.gz tor-9c362192361bec379f83f37426236b41c2a17e8e.zip |
test: HS v3 client authorization loading secret key
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature')
-rw-r--r-- | src/feature/hs/hs_client.c | 14 | ||||
-rw-r--r-- | src/feature/hs/hs_client.h | 11 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/feature/hs/hs_client.c b/src/feature/hs/hs_client.c index 7c545c35d5..18c79e0c47 100644 --- a/src/feature/hs/hs_client.c +++ b/src/feature/hs/hs_client.c @@ -1428,7 +1428,7 @@ client_service_authorization_free_all(void) /* Check if the auth key file name is valid or not. Return 1 if valid, * otherwise return 0. */ -static int +STATIC int auth_key_filename_is_valid(const char *filename) { int ret = 1; @@ -1448,7 +1448,7 @@ auth_key_filename_is_valid(const char *filename) return ret; } -static hs_client_service_authorization_t * +STATIC hs_client_service_authorization_t * parse_auth_file_content(const char *client_key_str) { char *onion_address = NULL; @@ -1836,3 +1836,13 @@ hs_client_dir_info_changed(void) * AP_CONN_STATE_RENDDESC_WAIT state in order to fetch the descriptor. */ retry_all_socks_conn_waiting_for_desc(); } + +#ifdef TOR_UNIT_TESTS + +STATIC digest256map_t * +get_hs_client_auths_map(void) +{ + return client_auths; +} + +#endif /* defined(TOR_UNIT_TESTS) */ diff --git a/src/feature/hs/hs_client.h b/src/feature/hs/hs_client.h index 6d4c847742..1ba0338dc3 100644 --- a/src/feature/hs/hs_client.h +++ b/src/feature/hs/hs_client.h @@ -84,6 +84,11 @@ void hs_client_free_all(void); #ifdef HS_CLIENT_PRIVATE +STATIC int auth_key_filename_is_valid(const char *filename); + +STATIC hs_client_service_authorization_t * +parse_auth_file_content(const char *client_key_str); + STATIC routerstatus_t * pick_hsdir_v3(const ed25519_public_key_t *onion_identity_pk); @@ -99,6 +104,12 @@ STATIC int handle_rendezvous2(origin_circuit_t *circ, const uint8_t *payload, MOCK_DECL(STATIC hs_client_fetch_status_t, fetch_v3_desc, (const ed25519_public_key_t *onion_identity_pk)); +#ifdef TOR_UNIT_TESTS + +STATIC digest256map_t *get_hs_client_auths_map(void); + +#endif /* defined(TOR_UNIT_TESTS) */ + #endif /* defined(HS_CLIENT_PRIVATE) */ #endif /* !defined(TOR_HS_CLIENT_H) */ |