-
Notifications
You must be signed in to change notification settings - Fork 931
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! hs-v3: Decrypt the descriptor with client private key
- Loading branch information
1 parent
4ba612a
commit 97404e3
Showing
1 changed file
with
10 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
|
@@ -1133,21 +1133,28 @@ decode_auth_client(const directory_token_t *tok, | ||
hs_desc_authorized_client_t *client) | hs_desc_authorized_client_t *client) | ||
{ | { | ||
int ret = -1; | int ret = -1; | ||
size_t tok0_len, tok1_len, tok2_len; | |||
|
|||
tor_assert(tok); | tor_assert(tok); | ||
tor_assert(tok->n_args >= 3); | tor_assert(tok->n_args >= 3); | ||
tor_assert(client); | tor_assert(client); | ||
|
|
||
/* Get the length once and only once. */ | |||
tok0_len = strlen(tok->args[0]); | |||
tok1_len = strlen(tok->args[1]); | |||
tok2_len = strlen(tok->args[2]); | |||
|
|||
if (base64_decode((char *) client->client_id, sizeof(client->client_id), | if (base64_decode((char *) client->client_id, sizeof(client->client_id), | ||
tok->args[0], strlen(tok->args[0])) < 0) { | tok->args[0], tok0_len) != (int) tok0_len) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
nmathewson
Contributor
|
|||
goto done; | goto done; | ||
} | } | ||
if (base64_decode((char *) client->iv, sizeof(client->iv), | if (base64_decode((char *) client->iv, sizeof(client->iv), | ||
tok->args[1], strlen(tok->args[1])) < 0) { | tok->args[1], tok1_len) != (int) tok1_len) { | ||
goto done; | goto done; | ||
} | } | ||
if (base64_decode((char *) client->encrypted_cookie, | if (base64_decode((char *) client->encrypted_cookie, | ||
sizeof(client->encrypted_cookie), | sizeof(client->encrypted_cookie), | ||
tok->args[2], strlen(tok->args[2])) < 0) { | tok->args[2], tok2_len) != (int) tok2_len) { | ||
goto done; | goto done; | ||
} | } | ||
|
|
||
|
I think this is not right.
base64_decode()
returns the number of bytes written, not read. Hence we should check that the retval is what we expect to be getting out of base64, in this case I thinksizeof(client->client_id)
if I'm not mistaken.e.g.: