summaryrefslogtreecommitdiff
path: root/src/feature/hs/hs_descriptor.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-04-13 14:14:41 -0400
committerNick Mathewson <nickm@torproject.org>2020-04-13 14:14:41 -0400
commite22a8d9c956f838138a7e5bc0714b1bb99f0e2a5 (patch)
tree158c80ae7e12fbb09e8bbff3f0ae5eb4a7691a46 /src/feature/hs/hs_descriptor.c
parent80031db32abebaf4d0a91c01db258fcdbd54a471 (diff)
parent55cb6c3fcdbeac31a88bcc62c0dbe5ded4605176 (diff)
downloadtor-e22a8d9c956f838138a7e5bc0714b1bb99f0e2a5.tar.gz
tor-e22a8d9c956f838138a7e5bc0714b1bb99f0e2a5.zip
Merge branch 'maint-0.4.3'
Diffstat (limited to 'src/feature/hs/hs_descriptor.c')
-rw-r--r--src/feature/hs/hs_descriptor.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/feature/hs/hs_descriptor.c b/src/feature/hs/hs_descriptor.c
index a39a4a09c9..50a46fb40f 100644
--- a/src/feature/hs/hs_descriptor.c
+++ b/src/feature/hs/hs_descriptor.c
@@ -1429,11 +1429,15 @@ 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.subcred,
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,