summaryrefslogtreecommitdiff
path: root/src/feature/hs/hs_client.c
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2020-03-30 16:33:30 +0300
committerNick Mathewson <nickm@torproject.org>2020-04-13 14:13:33 -0400
commitf2f718bca504d0fe1cce566185f8c17e23862335 (patch)
tree00db8a640202b5e0ae981cf31081f9639c8caff2 /src/feature/hs/hs_client.c
parent37bcc9f3d2f2df0335a42c9692e7d5deafc03514 (diff)
downloadtor-f2f718bca504d0fe1cce566185f8c17e23862335.tar.gz
tor-f2f718bca504d0fe1cce566185f8c17e23862335.zip
hs-v3: Change all-zeroes hard-assert to a BUG-and-err.
And also disallow all-zeroes keys from the filesystem; add a test for it too.
Diffstat (limited to 'src/feature/hs/hs_client.c')
-rw-r--r--src/feature/hs/hs_client.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/feature/hs/hs_client.c b/src/feature/hs/hs_client.c
index af8cb0b410..da1202b642 100644
--- a/src/feature/hs/hs_client.c
+++ b/src/feature/hs/hs_client.c
@@ -2132,6 +2132,13 @@ parse_auth_file_content(const char *client_key_str)
"can't be decoded: %s", seckey_b32);
goto err;
}
+
+ if (fast_mem_is_zero((const char*)auth->enc_seckey.secret_key,
+ sizeof(auth->enc_seckey.secret_key))) {
+ log_warn(LD_REND, "Client authorization private key can't be all-zeroes");
+ goto err;
+ }
+
strncpy(auth->onion_address, onion_address, HS_SERVICE_ADDR_LEN_BASE32);
/* We are reading this from the disk, so set the permanent flag anyway. */