diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-04-13 14:13:44 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-04-13 14:13:44 -0400 |
commit | 55cb6c3fcdbeac31a88bcc62c0dbe5ded4605176 (patch) | |
tree | 2977cb6049a2669d849496bc10d8373920841dcb /src/feature/hs | |
parent | bfea7a7326143702e688d9bd8cccedde69a45bb6 (diff) | |
parent | f2f718bca504d0fe1cce566185f8c17e23862335 (diff) | |
download | tor-55cb6c3fcdbeac31a88bcc62c0dbe5ded4605176.tar.gz tor-55cb6c3fcdbeac31a88bcc62c0dbe5ded4605176.zip |
Merge branch 'bug33545_043_squashed' into maint-0.4.3
Diffstat (limited to 'src/feature/hs')
-rw-r--r-- | src/feature/hs/hs_client.c | 7 | ||||
-rw-r--r-- | src/feature/hs/hs_client.h | 2 | ||||
-rw-r--r-- | src/feature/hs/hs_descriptor.c | 8 |
3 files changed, 14 insertions, 3 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. */ diff --git a/src/feature/hs/hs_client.h b/src/feature/hs/hs_client.h index 3660bfa96c..d0a3a7015f 100644 --- a/src/feature/hs/hs_client.h +++ b/src/feature/hs/hs_client.h @@ -45,7 +45,7 @@ typedef enum { REGISTER_SUCCESS_AND_DECRYPTED, /* We failed to register these credentials, because of a bad HS address. */ REGISTER_FAIL_BAD_ADDRESS, - /* We failed to register these credentials, because of a bad HS address. */ + /* We failed to store these credentials in a persistent file on disk. */ REGISTER_FAIL_PERMANENT_STORAGE, } hs_client_register_auth_status_t; diff --git a/src/feature/hs/hs_descriptor.c b/src/feature/hs/hs_descriptor.c index 4d4200bd64..d1c81bbff8 100644 --- a/src/feature/hs/hs_descriptor.c +++ b/src/feature/hs/hs_descriptor.c @@ -1434,10 +1434,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, |