diff options
author | George Kadianakis <desnacked@riseup.net> | 2020-03-30 16:33:30 +0300 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-04-13 14:13:33 -0400 |
commit | f2f718bca504d0fe1cce566185f8c17e23862335 (patch) | |
tree | 00db8a640202b5e0ae981cf31081f9639c8caff2 /src/feature/hs/hs_descriptor.c | |
parent | 37bcc9f3d2f2df0335a42c9692e7d5deafc03514 (diff) | |
download | tor-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_descriptor.c')
-rw-r--r-- | src/feature/hs/hs_descriptor.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/feature/hs/hs_descriptor.c b/src/feature/hs/hs_descriptor.c index 65d6c7a581..27823aa796 100644 --- a/src/feature/hs/hs_descriptor.c +++ b/src/feature/hs/hs_descriptor.c @@ -1424,10 +1424,14 @@ decrypt_descriptor_cookie(const hs_descriptor_t *desc, tor_assert(!fast_mem_is_zero( (char *) &desc->superencrypted_data.auth_ephemeral_pubkey, sizeof(desc->superencrypted_data.auth_ephemeral_pubkey))); - tor_assert(!fast_mem_is_zero((char *) client_auth_sk, - sizeof(*client_auth_sk))); tor_assert(!fast_mem_is_zero((char *) desc->subcredential, DIGEST256_LEN)); + /* Catch potential code-flow cases of an unitialized private key sneaking + * into this function. */ + if (BUG(fast_mem_is_zero((char *)client_auth_sk, sizeof(*client_auth_sk)))) { + goto done; + } + /* Get the KEYS component to derive the CLIENT-ID and COOKIE-KEY. */ keystream_length = build_descriptor_cookie_keys(desc->subcredential, DIGEST256_LEN, |